Pipelines: a pipeline's draws wait for it once a run, not every frame (VICTORY_PIPELINE_WAIT_ONCE_MS) #3819

Closed
Remag501 wants to merge 1 commit from upstream-pr/3819 into main
Remag501 commented 2026-11-30 08:22:32 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Remag501 on 2026-11-30T08:22:32Z.


Disclosure

This change was written by an LLM coding agent (Kimi, via OpenCode), working with its operator, who reviewed the design and the diff.

What it changes

A draw that binds an unmade pipeline waits for it within the frame's shared budget (VICTORY_PIPELINE_WAIT_MS, 500 ms). Because the budget is per frame, a slow pipeline that is bound every frame takes the budget again every frame until it is made — the re-burn measured in fxceless/victory-fork#1181 (a median of 761 ms a frame, 1.3 fps, under vkd3d-proton). And the tree's own numbers say the re-waits nearly never pay: every screen wait that ran out its 10 s once ran out again (55 waits, 550 s; 34 of the 43 waits after such a one too), while every wait under 5 s got its pipeline (make.rs, the screen_wait_once comment).

With VICTORY_PIPELINE_WAIT_ONCE_MS=<ms>, one pipeline is waited for at most its cap in the whole run, passes over the screen included; past the cap its draws drop at once while the workers build it, exactly as after the frame's budget today. The cap is per pipeline and cumulative across frames, so the worst case for one frame is bounded and flat instead of occasionally 500 ms rechargeable by the same pipeline the next frame. Unset or 0: the frame's budget alone, as before. It composes with the frame budget (e.g. VICTORY_PIPELINE_WAIT_MS=50 for a small consistent per-frame cost), and a pipeline that exhausts its cap is logged at powers of two.

This is the same idea as the fork tiadiff/VIctory-NVIDIA-LowStutter's VICTORY_PIPELINE_WAIT_ONCE, written against current main with the screen class folded in, per-pipeline accounting (Pending::waited_ms), and unit tests.

How it was tested

  • GPU and profile: GeForce RTX 2080 8 GB, Linux + Proton (Wine, vkd3d-proton), Series S profile 720p→1080p, DLSS off, frame generation off, ray tracing off.
  • Before: a cold pipeline library at world entry gave the known storm (frame lines to 32.4 s, dropped 466 (573 being made)).
  • After: same protocol, --set VICTORY_PIPELINE_WAIT_ONCE_MS=100 --set VICTORY_PIPELINE_WAIT_MS=50: the log shows host pipeline wait budget per frame millis=50 and the new pipelines whose once-wait is spent lines firing n=8, 16, 32 — pipelines spending their cap once and their draws dropping at once while workers kept building; the run completed world entry with no crash and no watchdog stop. A matched play-window A/B (same player, same route, cold library both arms) is the one measurement still owed; the switch is off by default until then.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): n/a (no shader changes).
  • cargo test passed for the crates it touches: yes — victory-gpu lib tests cross-built and run under Proton: 32 of 33 pipeline::make tests pass (the one failure, a_waiting_draw_raises_the_worker_making_its_pipeline, fails identically on the unmodified tree under Wine, which does not honor the thread-priority raise), including the three new tests for the cap; the full lib suite's failure set is byte-identical before and after. cargo clippy -p victory-gpu shows no new warnings.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: tiadiff/VIctory-NVIDIA-LowStutter (fork, VICTORY_PIPELINE_WAIT_ONCE); fxceless/victory-fork#1181 (the re-burn report); VICTORY_SCREEN_WAIT_ONCE and VICTORY_PIPELINE_WAIT_FREE in make.rs itself.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5561634851 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3819). Originally posted by [Remag501](https://github.com/Remag501) on 2026-11-30T08:22:32Z. --- ## Disclosure This change was written by an LLM coding agent (Kimi, via OpenCode), working with its operator, who reviewed the design and the diff. ## What it changes A draw that binds an unmade pipeline waits for it within the frame's shared budget (`VICTORY_PIPELINE_WAIT_MS`, 500 ms). Because the budget is per frame, a slow pipeline that is bound every frame takes the budget **again every frame** until it is made — the re-burn measured in fxceless/victory-fork#1181 (a median of 761 ms a frame, 1.3 fps, under vkd3d-proton). And the tree's own numbers say the re-waits nearly never pay: every screen wait that ran out its 10 s once ran out again (55 waits, 550 s; 34 of the 43 waits after such a one too), while every wait under 5 s got its pipeline (`make.rs`, the `screen_wait_once` comment). With `VICTORY_PIPELINE_WAIT_ONCE_MS=<ms>`, one pipeline is waited for at most its cap in the whole run, passes over the screen included; past the cap its draws drop at once while the workers build it, exactly as after the frame's budget today. The cap is per pipeline and cumulative across frames, so the worst case for one frame is bounded and flat instead of occasionally 500 ms rechargeable by the same pipeline the next frame. Unset or 0: the frame's budget alone, as before. It composes with the frame budget (e.g. `VICTORY_PIPELINE_WAIT_MS=50` for a small consistent per-frame cost), and a pipeline that exhausts its cap is logged at powers of two. This is the same idea as the fork tiadiff/VIctory-NVIDIA-LowStutter's `VICTORY_PIPELINE_WAIT_ONCE`, written against current main with the screen class folded in, per-pipeline accounting (`Pending::waited_ms`), and unit tests. ## How it was tested - GPU and profile: GeForce RTX 2080 8 GB, Linux + Proton (Wine, vkd3d-proton), Series S profile 720p→1080p, DLSS off, frame generation off, ray tracing off. - Before: a cold pipeline library at world entry gave the known storm (frame lines to 32.4 s, `dropped 466 (573 being made)`). - After: same protocol, `--set VICTORY_PIPELINE_WAIT_ONCE_MS=100 --set VICTORY_PIPELINE_WAIT_MS=50`: the log shows `host pipeline wait budget per frame millis=50` and the new `pipelines whose once-wait is spent` lines firing n=8, 16, 32 — pipelines spending their cap once and their draws dropping at once while workers kept building; the run completed world entry with no crash and no watchdog stop. A matched play-window A/B (same player, same route, cold library both arms) is the one measurement still owed; the switch is off by default until then. - For shader changes, the wave sizes tested (32 and/or 64 lanes): n/a (no shader changes). - `cargo test` passed for the crates it touches: yes — `victory-gpu` lib tests cross-built and run under Proton: 32 of 33 `pipeline::make` tests pass (the one failure, `a_waiting_draw_raises_the_worker_making_its_pipeline`, fails identically on the unmodified tree under Wine, which does not honor the thread-priority raise), including the three new tests for the cap; the full lib suite's failure set is byte-identical before and after. `cargo clippy -p victory-gpu` shows no new warnings. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: tiadiff/VIctory-NVIDIA-LowStutter (fork, `VICTORY_PIPELINE_WAIT_ONCE`); fxceless/victory-fork#1181 (the re-burn report); `VICTORY_SCREEN_WAIT_ONCE` and `VICTORY_PIPELINE_WAIT_FREE` in `make.rs` itself.
andrewpozdnakov7-jpg commented 2026-11-30 08:30:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-11-30T08:30:31Z.

Code review location: crates/victory-gpu/src/pipeline/make.rs; line 1097

@@ -1051,6 +1094,20 @@ fn wait(p: &Pending, frame: u64) {
         boost(p, false);
     }
     let waited = started.elapsed().min(left);
+    let before = p.waited_ms.fetch_add(waited.as_millis() as u64, Ordering::Relaxed);

The cumulative cap loses fractional milliseconds at this line. Both held_room() and the remaining frame budget can leave less than 1 ms. Each such wait contributes zero to waited_ms, so a pending pipeline can keep consuming these slices across frames without spending its cap.

I ran the exact wait_once_left and charge expression from 6749a6b sequentially in a native Windows Rust fixture. With a 2 ms cap and wait slices of 750, 750, and 500 µs, the reported room was 2,000 → 2,000 → 2,000 µs. With nanosecond accounting it reached 1,250 → 500 → 0 µs. This reproduces the rounding loss with one waiter.

Could the counter retain fractional milliseconds and include this case in the cap tests? The configuration can keep accepting milliseconds. The RTX 3080 Ti log from #3781 is also a Windows case of one screen pipeline consuming its per-frame timeout repeatedly.

If you reuse the regression case, please retain its authorship with Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review-comment:4736590059 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3819#discussion_r4736590059). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-30T08:30:31Z. **Code review location:** `crates/victory-gpu/src/pipeline/make.rs`; line 1097 ~~~~diff @@ -1051,6 +1094,20 @@ fn wait(p: &Pending, frame: u64) { boost(p, false); } let waited = started.elapsed().min(left); + let before = p.waited_ms.fetch_add(waited.as_millis() as u64, Ordering::Relaxed); ~~~~ --- The cumulative cap loses fractional milliseconds at this line. Both `held_room()` and the remaining frame budget can leave less than 1 ms. Each such wait contributes zero to `waited_ms`, so a pending pipeline can keep consuming these slices across frames without spending its cap. I ran the exact `wait_once_left` and charge expression from `6749a6b` sequentially in a native Windows Rust fixture. With a 2 ms cap and wait slices of 750, 750, and 500 µs, the reported room was 2,000 → 2,000 → 2,000 µs. With nanosecond accounting it reached 1,250 → 500 → 0 µs. This reproduces the rounding loss with one waiter. Could the counter retain fractional milliseconds and include this case in the cap tests? The configuration can keep accepting milliseconds. The RTX 3080 Ti log from [#3781](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3781#issuecomment-7272930999) is also a Windows case of one screen pipeline consuming its per-frame timeout repeatedly. If you reuse the regression case, please retain its authorship with `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
trustno1-coder commented 2026-12-01 18:48:27 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:48:27Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321581540 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3819#issuecomment-7321581540). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:48:27Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

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