Skip to content

Stop long freezes on pipeline compiles - #2580

Open
Kajcsi wants to merge 2 commits into
trustno1-coder:mainfrom
Kajcsi:stutter-fixes
Open

Kajcsi wants to merge 2 commits into
trustno1-coder:mainfrom
Kajcsi:stutter-fixes

Conversation

@Kajcsi

@Kajcsi Kajcsi commented Nov 29, 2026

Copy link
Copy Markdown

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 and others added 2 commits November 29, 2026 15:26
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
@DrDarkDK

Copy link
Copy Markdown

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.

moritz-eckhard-nickel added a commit to moritz-eckhard-nickel/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…compiles

trustno1-coder#2580, head c9ffe60.
Conflicts in pipeline/make.rs: kept the memory guard's starved floor and take_out_of_memory (trustno1-coder#3398 and main) with the PR's Building guard; wait_loop and compute_left from the PR (it already ends on retry_waits and boosts the maker).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moritz-eckhard-nickel added a commit to moritz-eckhard-nickel/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
moritz-eckhard-nickel added a commit to moritz-eckhard-nickel/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…-coder#2580 port, trustno1-coder#2623 reverted)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JustOptimize added a commit to JustOptimize/VIctory-Enhanced that referenced this pull request Nov 30, 2026
Port of trustno1-coder#2580, applied clean. A draw's pipeline wait ends when the driver compile begins; compute pipelines are made on their own threads (at most 4) and screen passes wait at most VICTORY_PIPELINE_COMPILE_GRACE_MS (50) for a build that reaches the compiler; a wait ends when the memory guard puts its build off. VICTORY_PIPELINE_WAIT_COMPILES=1 restores the old waits. Optional victory warm --waited and VICTORY_WARM_WAITED=1 in play-foxhound.ps1 are off by default and not used here. The shader cache key is unchanged. Upstream: played 13 minutes on an RTX 4090 (longest frame 10.5 s to 186 ms), not on a 3080; three pipeline::host tests that make real pipelines failed upstream on a busy card. Trade-off: a never-seen compute or screen pass can be skipped for a few frames while it compiles.
JustOptimize added a commit to JustOptimize/VIctory-Enhanced that referenced this pull request Nov 30, 2026
JustOptimize added a commit to JustOptimize/VIctory-Enhanced that referenced this pull request Nov 30, 2026
…der#3474)

Port of trustno1-coder#3474 (fixes trustno1-coder#2293), three conflicts with trustno1-coder#2580 in pipeline/make.rs and refused.rs, merged by hand. Under the commit floor compiles go one at a time instead of all being put off (compilemem.rs, memguard.rs, procmem.rs); a memory refusal (the guard's put-off or a driver 0x8007000E) is retried with back-off, not recorded as a permanent failure, and no frame waits 10 s for one; a compile's cost is measured without the card memory the title loads meanwhile. Merge choices: trustno1-coder#2580's wait_loop already ends a wait on a put-off build (retry_waits), so the PR's wait_cut helper, its WAIT_SLICE and its inline loop were dropped; the PR's starved screen-pass budget (screen_or_wait_budget, 50 ms while compiles are put off) is kept and its test reduced to the budget asserts; refused.rs keeps both test modules. Upstream: 32 GB PC, black screen at 0.2 fps reproduced 4 times and gone with the PR; not tried on a 3080 here, and with a warm shader cache the starved path should not engage, so this run only checks for regressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants