Stop long freezes on pipeline compiles #2580

Manually merged
github merged 2 commits from github-bot/gh-2580 into main 2026-11-30 14:14:48 +00:00 AGit
Owner

@⁠Kajcsi on GitHub · 2026-11-29 14:36 UTC · original
Kajcsi:stutter-fixes → main · +382 −27 · 8 files · 2 commits · merged 2026-11-30 14:12 UTC

Two changes to how the pipeline maker waits. Together they fix the long stutters and freezes (half a second up to about 10 seconds) while driving and on new screens. What is left is typically a short microstutter when a pipeline is seen for the first time.

What was happening

Measured on an RTX 4090, Series S profile, DLSS with frame generation, in a long drive through the city:

  • Draws. A load from the pipeline library takes about 11 ms. A driver compile took 580 to 720 ms on average. A draw waited up to the frame's 500 ms budget (VICTORY_PIPELINE_WAIT_MS), which a compiling pipeline rarely made. So the frame stalled for about 500 ms (often two frames in a row), and its draws were dropped anyway. These were the hard stutters when driving into streets not seen before.
  • Compute and passes over the screen. These froze the game for 3 to 11 s at a time:
    • Compute pipelines were made on the title's own thread. One took 8.5 s in the driver.
    • A pass over the screen waited its whole 10 s for a build that the memory guard had put off 6 ms into the wait. Nothing asked for that build again until the next frame, which then made it in 18 ms.

The changes

  1. Stop a draw's pipeline wait when the driver compile begins. The library tells the maker when a build goes past it to the driver's compiler. Draws that are waiting are woken and stop waiting, and later draws of that pipeline don't wait for it. Translation and library loads are still waited for within the budget.
  2. Stop freezing on compute and screen-pass compiles.
    • A wait ends when the memory guard puts its build off. A later frame asks again.
    • Passes over the screen and dispatches wait at most VICTORY_PIPELINE_COMPILE_GRACE_MS (default 50) once their build reaches the driver's compiler or translates a shader afresh. A pipeline already in the driver's cache arrives within that time.
    • A dispatch's compute pipeline is made at once on a thread of its own (at most 4 at a time), no longer on the title's thread.
    • New, optional: victory warm --waited. Before a run, it makes the book's compute pipelines and screen passes that no earlier run has drawn with, each in a process of its own. play-foxhound.ps1 runs it before the game when VICTORY_WARM_WAITED=1 (off by default). Pipelines made before are skipped, so later starts spend about a second there. The first run made 3,801 pipelines in 511 s with 10 processes, none failed. Per pipeline: p90 5.9 s, p99 8.2 s, longest 33 s. Each of those used to be an in-game freeze.

VICTORY_PIPELINE_WAIT_COMPILES=1 restores the old waits.

Results

Same PC, same profile, comparable drives:

Before After (about 13 min of play)
Longest frame 10.5 s 186 ms
Frames over 1 s 13 0
Seconds with a frame over 500 ms 47 0
Waits on screen passes and compute many, up to 10 s 0

In that run, 228 frames took over 100 ms. These are the short microstutters that remain: a pipeline's first use, with the frame going on without it.

Trade-off

A compute pass or screen pass never seen before can be skipped for a few frames while it compiles, instead of freezing the game. A one-shot compute pass skipped that way can give a wrong picture for that moment. After warm --waited this is rare, because the book barely grows during play (67 new of 88,634 in one session). In the run above, one dispatch was dropped.

Testing

  • On top of current main: cargo build --release --locked -p victory passes. Of the victory-gpu pipeline unit tests, 75 pass, including the maker's new ones. Three pipeline::host tests make real pipelines on the card. They failed while the game was running on the same card with the PC's memory nearly full. They test code this PR doesn't change, and I haven't rerun them on an idle card yet.
  • Played about 13 minutes on an RTX 4090 (Windows 11, 64 GB RAM), Series S profile, DLSS with frame generation, with VICTORY_WARM_WAITED=1. The "before" column is the same setup without either change.

🤖 Generated with Claude Code

**@⁠Kajcsi** on GitHub · 2026-11-29 14:36 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2580) `Kajcsi:stutter-fixes` → `main` · +382 −27 · 8 files · 2 commits · merged 2026-11-30 14:12 UTC Two changes to how the pipeline maker waits. Together they fix the long stutters and freezes (half a second up to about 10 seconds) while driving and on new screens. What is left is typically a short microstutter when a pipeline is seen for the first time. ## What was happening Measured on an RTX 4090, Series S profile, DLSS with frame generation, in a long drive through the city: - **Draws.** A load from the pipeline library takes about 11 ms. A driver compile took 580 to 720 ms on average. A draw waited up to the frame's 500 ms budget (`VICTORY_PIPELINE_WAIT_MS`), which a compiling pipeline rarely made. So the frame stalled for about 500 ms (often two frames in a row), and its draws were dropped anyway. These were the hard stutters when driving into streets not seen before. - **Compute and passes over the screen.** These froze the game for 3 to 11 s at a time: - Compute pipelines were made on the title's own thread. One took 8.5 s in the driver. - A pass over the screen waited its whole 10 s for a build that the memory guard had put off 6 ms into the wait. Nothing asked for that build again until the next frame, which then made it in 18 ms. ## The changes 1. **Stop a draw's pipeline wait when the driver compile begins.** The library tells the maker when a build goes past it to the driver's compiler. Draws that are waiting are woken and stop waiting, and later draws of that pipeline don't wait for it. Translation and library loads are still waited for within the budget. 2. **Stop freezing on compute and screen-pass compiles.** - A wait ends when the memory guard puts its build off. A later frame asks again. - Passes over the screen and dispatches wait at most `VICTORY_PIPELINE_COMPILE_GRACE_MS` (default 50) once their build reaches the driver's compiler or translates a shader afresh. A pipeline already in the driver's cache arrives within that time. - A dispatch's compute pipeline is made at once on a thread of its own (at most 4 at a time), no longer on the title's thread. - New, optional: `victory warm --waited`. Before a run, it makes the book's compute pipelines and screen passes that no earlier run has drawn with, each in a process of its own. `play-foxhound.ps1` runs it before the game when `VICTORY_WARM_WAITED=1` (off by default). Pipelines made before are skipped, so later starts spend about a second there. The first run made 3,801 pipelines in 511 s with 10 processes, none failed. Per pipeline: p90 5.9 s, p99 8.2 s, longest 33 s. Each of those used to be an in-game freeze. `VICTORY_PIPELINE_WAIT_COMPILES=1` restores the old waits. ## Results Same PC, same profile, comparable drives: | | Before | After (about 13 min of play) | |---|---|---| | Longest frame | 10.5 s | 186 ms | | Frames over 1 s | 13 | 0 | | Seconds with a frame over 500 ms | 47 | 0 | | Waits on screen passes and compute | many, up to 10 s | 0 | In that run, 228 frames took over 100 ms. These are the short microstutters that remain: a pipeline's first use, with the frame going on without it. ## Trade-off A compute pass or screen pass never seen before can be skipped for a few frames while it compiles, instead of freezing the game. A one-shot compute pass skipped that way can give a wrong picture for that moment. After `warm --waited` this is rare, because the book barely grows during play (67 new of 88,634 in one session). In the run above, one dispatch was dropped. ## Testing - On top of current `main`: `cargo build --release --locked -p victory` passes. Of the `victory-gpu` `pipeline` unit tests, 75 pass, including the maker's new ones. Three `pipeline::host` tests make real pipelines on the card. They failed while the game was running on the same card with the PC's memory nearly full. They test code this PR doesn't change, and I haven't rerun them on an idle card yet. - Played about 13 minutes on an RTX 4090 (Windows 11, 64 GB RAM), Series S profile, DLSS with frame generation, with `VICTORY_WARM_WAITED=1`. The "before" column is the same setup without either change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A load from the pipeline library takes about 11 ms; a driver compile
took 580 to 720 ms on average on an RTX 4090 (Series S profile, a
long drive through the city). The frame's 500 ms
budget rarely got a compiling pipeline, so its draws were dropped all
the same after a frame of about 500 ms, often two frames in a row: the
hard stutters while driving into streets not met before.

The library now tells the maker when a build goes past it to the
driver's compiler; waiting draws are woken and stop waiting, and later
draws of that pipeline do not wait for it. Translation and library loads
are still waited for within the budget. Passes over the screen keep
their own wait, and compute pipelines made on the asking thread are not
affected. VICTORY_PIPELINE_WAIT_COMPILES=1 restores the old wait.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The same session froze 3 to 11 s at a time. Compute pipelines were made on the
title's own thread, and one took 8.5 s in the driver. A pass over the
screen waited its whole 10 s for a build that the memory guard had put
off 6 ms into the wait; nothing asked for it again until the next frame.

- A wait ends when its build is put off for memory. A later frame asks
  for it again.
- Passes over the screen and dispatches wait at most
  VICTORY_PIPELINE_COMPILE_GRACE_MS (50) once the build reaches the
  driver's compiler, or translates a shader afresh. A pipeline already in
  the driver's cache comes within that time.
- A dispatch's compute pipeline is made at once on a thread of its own
  (at most 4 at a time), no longer on the title's thread.
- New: victory warm --waited. Ahead of a run, it makes the book's compute
  pipelines and screen passes that no earlier run drew with, each in a
  process of its own. The launcher runs it before the game when
  VICTORY_WARM_WAITED=1.

VICTORY_PIPELINE_WAIT_COMPILES=1 restores the old waits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 14:39:24 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-29 18:14 UTC · original

I tested #2580 on an RTX 4070 Ti / Ryzen 9 7900X. I compared clean #2334 (77427629) with #2580 (c9ffe60a) merged on top. Both runs were windowed at 2560×1440 with DLSS Ultra Performance and Frame Generation at 2×.

First 55 seconds of logged gameplay:

Metric Clean #2334 With #2580
10-second screen-pass timeouts 5 0
Median async submit wait at Present 4,974.2 ms 40.5 ms
Median logged FPS 0.2 10.7
Median draws per frame 12,757 10,666

The patched run recorded zero screen-pass timeouts across all 68 seconds of logged gameplay. This was one run per build. The draw counts differed, but the recurring 10-second wait was gone with Frame Generation still active at 2×.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-29 18:14 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2580#issuecomment-7260325402) I tested #2580 on an RTX 4070 Ti / Ryzen 9 7900X. I compared clean #2334 (`77427629`) with #2580 (`c9ffe60a`) merged on top. Both runs were windowed at 2560×1440 with DLSS Ultra Performance and Frame Generation at 2×. First 55 seconds of logged gameplay: | Metric | Clean #2334 | With #2580 | |---|---:|---:| | 10-second screen-pass timeouts | 5 | 0 | | Median async submit wait at Present | 4,974.2 ms | 40.5 ms | | Median logged FPS | 0.2 | 10.7 | | Median draws per frame | 12,757 | 10,666 | The patched run recorded zero screen-pass timeouts across all 68 seconds of logged gameplay. This was one run per build. The draw counts differed, but the recurring 10-second wait was gone with Frame Generation still active at 2×. *AI-assisted with Codex.*
github manually merged commit c07ab7de93 into main 2026-11-30 14:14:48 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

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