pipeline: avoid repeating per-frame waits for slow in-flight pipelines #497

Closed
tiadiff wants to merge 1 commit from upstream-pr/497 into main
tiadiff commented 2026-11-27 23:35:25 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tiadiff on 2026-11-27T23:35:25Z.


Problem

When a slow non-screen pipeline (1-5s host driver compile) hits wait_budget() (500 ms) on its first draw, subsequent frames keep waiting another 500 ms for the same Pending while its worker is already compiling it in the background.

Change

  • Add waited_out: AtomicBool to Pending (crates/victory-gpu/src/pipeline/make.rs).
  • When a non-screen wait returns with p.made.get().is_none(), set waited_out = true so subsequent frames skip waiting while the worker finishes (VICTORY_PIPELINE_WAIT_ONCE=0 restores repeating waits).
  • Screen and bake passes (screen && screens_first()) keep their full screen_budget() behavior unchanged.

Verification

  • cargo test --release --locked -p victory-gpu --lib pipeline::make:: (8 passed; 0 failed, including slow_non_screen_pipeline_does_not_repeat_frame_waits)
  • cargo xtask policy (290 files ok)
  • cargo build --release --locked -p victory (succeeded)
  • Unit-tested and built on Windows 11 (i7-11700K, RTX 4070); not separately benchmarked in-game in isolation.

Part of the low-stutter patch stack tested in https://github.com/tiadiff/VIctory-NVIDIA-LowStutter.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5534484144 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/497). Originally posted by [tiadiff](https://github.com/tiadiff) on 2026-11-27T23:35:25Z. --- ### Problem When a slow non-screen pipeline (1-5s host driver compile) hits `wait_budget()` (500 ms) on its first draw, subsequent frames keep waiting another 500 ms for the same `Pending` while its worker is already compiling it in the background. ### Change - Add `waited_out: AtomicBool` to `Pending` (`crates/victory-gpu/src/pipeline/make.rs`). - When a non-screen wait returns with `p.made.get().is_none()`, set `waited_out = true` so subsequent frames skip waiting while the worker finishes (`VICTORY_PIPELINE_WAIT_ONCE=0` restores repeating waits). - Screen and bake passes (`screen && screens_first()`) keep their full `screen_budget()` behavior unchanged. ### Verification - `cargo test --release --locked -p victory-gpu --lib pipeline::make::` (`8 passed; 0 failed`, including `slow_non_screen_pipeline_does_not_repeat_frame_waits`) - `cargo xtask policy` (`290 files ok`) - `cargo build --release --locked -p victory` (succeeded) - Unit-tested and built on Windows 11 (i7-11700K, RTX 4070); not separately benchmarked in-game in isolation. Part of the low-stutter patch stack tested in https://github.com/tiadiff/VIctory-NVIDIA-LowStutter.
Machad3x commented 2026-11-28 01:27:41 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Machad3x on 2026-11-28T01:27:41Z.


Tested in a batch on an RTX 3080 Ti + Ryzen 7 5700X, 1440p, DLSS Quality, title ray tracing on (VICTORY_BVH_BUILDER=1), 240 s run into the prison cell scene. Batch: #516, #501, #498, #497, #532, #521.
Result: alive for the whole run, 61.5-63.9 ms/frame, 1 draw/frame dropped (not from this batch), no shader or pipeline refused.
No problem found in this PR.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7231681437 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/497#issuecomment-7231681437). Originally posted by [Machad3x](https://github.com/Machad3x) on 2026-11-28T01:27:41Z. --- Tested in a batch on an RTX 3080 Ti + Ryzen 7 5700X, 1440p, DLSS Quality, title ray tracing on (VICTORY_BVH_BUILDER=1), 240 s run into the prison cell scene. Batch: #516, #501, #498, #497, #532, #521. Result: alive for the whole run, 61.5-63.9 ms/frame, 1 draw/frame dropped (not from this batch), no shader or pipeline refused. No problem found in this PR.
Rafa7046 commented 2026-11-28 01:28:27 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Rafa7046 on 2026-11-28T01:28:27Z.


Measured on an RTX 5080 16 GB + Ryzen 9 9950X3D (Series X, 1440p, DLSS Performance, frame generation off, diagnostics build on 64d4931 with only this PR applied, pipelines made ahead with victory warm), same stretch each run: Lucia's arrest cutscenes, then Jason on the boat and a minute standing still.

Cutscenes, fps (median) Boat, fps preparing in the cutscenes
main, run 1 37.4 35.8 19.6 ms
main, run 2 35.0 34.7 21.4 ms
with #497 35.2 35.7 21.3 ms

Two runs of plain main differ by about 2.4 fps, so this is within the run-to-run spread on this machine: no measurable change in frame rate here, and no new warnings, faults or crashes in the log. On this card the frame is set by the submitting thread (about 21 ms of a 28 ms frame), which is probably why a saving of this size does not show.

One thing not in the numbers: playing it, the textures looked a little better, with fewer visual glitches than in the other runs. That is one person's impression from one run, not measured; with the pipelines made ahead no pipeline was in flight during the scenes in any run, so I cannot tie it to this change from the log.

Same machine and scene with and without the title's ray tracing: #535.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7231690416 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/497#issuecomment-7231690416). Originally posted by [Rafa7046](https://github.com/Rafa7046) on 2026-11-28T01:28:27Z. --- Measured on an RTX 5080 16 GB + Ryzen 9 9950X3D (Series X, 1440p, DLSS Performance, frame generation off, diagnostics build on `64d4931` with only this PR applied, pipelines made ahead with `victory warm`), same stretch each run: Lucia's arrest cutscenes, then Jason on the boat and a minute standing still. | | Cutscenes, fps (median) | Boat, fps | `preparing` in the cutscenes | |---|---|---|---| | `main`, run 1 | 37.4 | 35.8 | 19.6 ms | | `main`, run 2 | 35.0 | 34.7 | 21.4 ms | | **with #497** | **35.2** | **35.7** | **21.3 ms** | Two runs of plain `main` differ by about 2.4 fps, so this is within the run-to-run spread on this machine: no measurable change in frame rate here, and no new warnings, faults or crashes in the log. On this card the frame is set by the submitting thread (about 21 ms of a 28 ms frame), which is probably why a saving of this size does not show. One thing not in the numbers: playing it, the textures looked a little better, with fewer visual glitches than in the other runs. That is one person's impression from one run, not measured; with the pipelines made ahead no pipeline was in flight during the scenes in any run, so I cannot tie it to this change from the log. Same machine and scene with and without the title's ray tracing: #535.
tiadiff commented 2026-11-28 22:33:13 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tiadiff on 2026-11-28T22:33:13Z.


This PR was auto-closed by GitHub when the original fork was detached into standalone repo tiadiff/VIctory-NVIDIA-LowStutter.

I rebased the patch cleanly onto current main (d4b5d51) and re-ran cargo test --release --locked -p victory-gpu --lib pipeline::make:: (13 passed; 0 failed, including slow_non_screen_pipeline_does_not_repeat_frame_waits):

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246816509 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/497#issuecomment-7246816509). Originally posted by [tiadiff](https://github.com/tiadiff) on 2026-11-28T22:33:13Z. --- This PR was auto-closed by GitHub when the original fork was detached into standalone repo `tiadiff/VIctory-NVIDIA-LowStutter`. I rebased the patch cleanly onto current `main` (`d4b5d51`) and re-ran `cargo test --release --locked -p victory-gpu --lib pipeline::make::` (`13 passed; 0 failed`, including `slow_non_screen_pipeline_does_not_repeat_frame_waits`): - Branch: https://github.com/tiadiff/VIctory-NVIDIA-LowStutter/tree/pr/pipeline-wait-once - Commit: https://github.com/tiadiff/VIctory-NVIDIA-LowStutter/commit/c32c0b02a503d61d4ce4bd7c6fb7591559f655d7 - Direct patch (`git am`): https://github.com/tiadiff/VIctory-NVIDIA-LowStutter/commit/c32c0b02a503d61d4ce4bd7c6fb7591559f655d7.patch

Pull request closed

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!497
No description provided.