fix(gpu): a dispatch waits for its compute pipeline until it is made #243

Merged
mutlusinan merged 1 commit from upstream-pr/243 into main 2026-11-28 19:39:39 +00:00
mutlusinan commented 2026-11-27 20:04:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mutlusinan on 2026-11-27T20:04:49Z.


Problem

A draw whose pipeline is not ready within the frame's budget is dropped — and drawn again next frame, so it costs one frame. A dispatch may not be drawn again: the title runs some compute passes once, when a scene changes (a buffer is reset or cleared), and what they leave is read for as long as the scene lasts.

In the prison corridor, a compute program met for the first time took 4.4 s to make on a 16 GB machine; its one dispatch was dropped after the half second of budget, and the windows of the previous room stayed blended over the picture for minutes (run 195 of the fork it comes from).

Fix

In pipeline::make::ready, a compute pipeline (p.graphics.is_none()) is now made/waiting until it exists, whatever the frame's budget; a draw still waits within the budget. VICTORY_PIPELINE_COMPUTE_WAIT=0 restores the old behaviour. The pipeline library has the program on the next run, so the multi-second wait happens once.

Verification

  • cargo check -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked — clean.
  • Not run in game here; the observable check is the prison corridor / scene-change passes (no more blended-over windows after a first-time compute pipeline).

Ported from fxceless/victory-fork a42b627 (pull request #1312), GPL-3.0-or-later.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5532448605 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/243). Originally posted by [mutlusinan](https://github.com/mutlusinan) on 2026-11-27T20:04:49Z. --- ### Problem A draw whose pipeline is not ready within the frame's budget is dropped — and drawn again next frame, so it costs one frame. A **dispatch** may not be drawn again: the title runs some compute passes once, when a scene changes (a buffer is reset or cleared), and what they leave is read for as long as the scene lasts. In the prison corridor, a compute program met for the first time took 4.4 s to make on a 16 GB machine; its one dispatch was dropped after the half second of budget, and the windows of the previous room stayed blended over the picture for minutes (run 195 of the fork it comes from). ### Fix In `pipeline::make::ready`, a compute pipeline (`p.graphics.is_none()`) is now made/waiting until it exists, whatever the frame's budget; a draw still waits within the budget. `VICTORY_PIPELINE_COMPUTE_WAIT=0` restores the old behaviour. The pipeline library has the program on the next run, so the multi-second wait happens once. ### Verification - `cargo check -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked` — clean. - Not run in game here; the observable check is the prison corridor / scene-change passes (no more blended-over windows after a first-time compute pipeline). Ported from fxceless/victory-fork `a42b627` (pull request #1312), GPL-3.0-or-later.
mutlusinan commented 2026-11-27 20:21:27 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mutlusinan on 2026-11-27T20:21:27Z.


Risk assessment (porting review)

  • Highest risk in this batch. The change blocks the submitting thread until the compute pipeline exists. That is deliberate (a dropped one-shot dispatch leaves the picture wrong for the whole scene), but it runs against the design decision the module documents: pipelines are made off the title's threads and waited for only within a per-frame budget (decision 0007).
  • Cold cache: up to 4.4 s for one program upstream. Several first-time compute pipelines in one frame could trip the title's own hang watchdog, which is the failure mode this design exists to avoid.
  • Default on; VICTORY_PIPELINE_COMPUTE_WAIT=0 restores the old behaviour. Draws are unchanged (still budgeted and dropped).
  • Recommendation: measure on a cold %LOCALAPPDATA%\victory cache and on the title's first world frame before merging; if the watchdog shows up, this should go in default-off.
  • Compatibility: merges cleanly and type-checks against main at e69e39c.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7227422970 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/243#issuecomment-7227422970). Originally posted by [mutlusinan](https://github.com/mutlusinan) on 2026-11-27T20:21:27Z. --- ### Risk assessment (porting review) - **Highest risk in this batch.** The change blocks the submitting thread until the compute pipeline exists. That is deliberate (a dropped one-shot dispatch leaves the picture wrong for the whole scene), but it runs against the design decision the module documents: pipelines are made off the title's threads and waited for only within a per-frame budget (decision 0007). - Cold cache: up to 4.4 s for one program upstream. Several first-time compute pipelines in one frame could trip the title's own hang watchdog, which is the failure mode this design exists to avoid. - Default on; `VICTORY_PIPELINE_COMPUTE_WAIT=0` restores the old behaviour. Draws are unchanged (still budgeted and dropped). - **Recommendation:** measure on a cold `%LOCALAPPDATA%\victory` cache and on the title's first world frame before merging; if the watchdog shows up, this should go in default-off. - **Compatibility:** merges cleanly and type-checks against `main` at `e69e39c`.
mutlusinan commented 2026-11-28 12:01:32 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mutlusinan on 2026-11-28T12:01:32Z.


Rebased onto current main

Rebased onto 63b902f (force-with-lease) and re-verified: cargo check --workspace --target x86_64-pc-windows-msvc --locked is clean. pipeline::make::ready on main still waits only within the frame's budget, so this change is not superseded.

The risk note above stands as written — this remains the one change in the set that can block the submitting thread for seconds, and it is default-on. Still worth a cold-cache measurement before merging.

CI shows action_required (maintainer approval to run a fork's workflow).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7238940096 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/243#issuecomment-7238940096). Originally posted by [mutlusinan](https://github.com/mutlusinan) on 2026-11-28T12:01:32Z. --- ### Rebased onto current `main` Rebased onto `63b902f` (force-with-lease) and re-verified: `cargo check --workspace --target x86_64-pc-windows-msvc --locked` is clean. `pipeline::make::ready` on `main` still waits only within the frame's budget, so this change is not superseded. The risk note above stands as written — this remains the one change in the set that can block the submitting thread for seconds, and it is default-on. Still worth a cold-cache measurement before merging. CI shows `action_required` (maintainer approval to run a fork's workflow).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!243
No description provided.