Pipelines: a pass over the screen holds frames for its 10 s once in all, not every frame (map freeze, #3059) #3788
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3788"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T07:11:14Z.
Problem
Opening the in-game map freezes the game, with no crash (#3059 on v2026.11.29.03: RTX 5070 Ti + 9850X3D; "same" from a 5090 + 14900KF and from a third user). The logs are attachments and were not read. #3467 (zinixyt, RTX 3060, 32 GB, Series S, main
41adb551) measured the same screen in its text: "the map ran at about 10 seconds a frame", 42 quiet windows of over 5 s in 11 minutes, the six biggest 9.2 to 9.8 s. The line right after each window was:and the card was idle behind the CPU. #2822 (RTX 4090, 64 GB) lists "map stalls" with system commit exhaustion and memory-guard deferrals, gone with a larger page file.
Root cause
Read from the code and #3467's log line (#3059's logs were not read, so this is the likely cause, not a measured one). What the map does differently: it draws passes over the screen (full-screen graphics passes,
Pending::screen) that the world has not drawn, so their pipelines are not made yet, and it draws them every frame while it is open.crates/victory-gpu/src/pipeline/make.rs:ready→wait(p, frame): a draw whose pipeline is not made waits for it. A pass over the screen getsscreen_budget()(VICTORY_SCREEN_WAIT_MS, 10 s) per frame, others 500 ms per frame (wait_budget).screen_wait_once): "every screen wait that reached the 10 s budget ended without the pipeline (55 waits, 550 s) and 34 of the 43 waits after such a one ran out again". The only way out,VICTORY_SCREEN_WAIT_ONCE=1(#1743), is off by default.compilemem::begin: a pipeline worker waits up to 10 s to be let start, then the compile is put off), the memory guard puts it off (Pending::defer, retried 1 s later and put off again while commit stays low), or a long driver compile or a long queue.make_withnotifiesDONEafterdefer(), the waiter wakes, seesmadeunset, and waits out the rest of its 10 s for a pipeline nothing will make during its pause.So on the map every frame can take the screen's whole 10 s, which the player sees as a freeze. The title's 30 s watchdog does not end it (each frame is under 30 s, and it is told to quit).
Fix
wait(nowwait_within(p, frame, screen_budget, draw_budget)so tests can pass small budgets):Pending::screen_waited_uscounts what draws waited for it as a pass over the screen. A wait gets at most what is left of that allowance. Once it is used up and the pipeline is still not made, the pass waits as other draws do, within the frame's shared 500 ms, until it is made. Its first 10 s are unchanged, so a loading screen or a pass the title draws once still gets them. A line says when a pass has used its allowance (formats, shaders).p.retry_waits()in the loop condition).VICTORY_SCREEN_WAIT_EVERY_FRAME=1gives back the old wait (the whole budget every frame).VICTORY_SCREEN_WAIT_ONCE=1still drops such a pass at once.With this, a map pass not made in time costs at most 10 s of waiting in all, then frames of 500 ms at most until it is made, instead of 10 s each.
Verification
Windows 11 26200, rustc 1.98.1 (the pinned toolchain), Ryzen 7 9800X3D. On
700a84fd:cargo check -j 6 --locked -p victory-gpu --all-targets: passes (victory-gpu's existing warnings only).cargo test -j 6 --locked -p victory-gpu --lib pipeline::make::tests::: 32 passed, 0 failed. The two new ones:a_pass_over_the_screen_holds_frames_for_its_budget_once_in_all: a pass over the screen that is never made, with budgets of 300 ms (screen) and 20 ms (others) in place of 10 s and 500 ms. The first frame waits at least 290 ms. The next four frames each return in under 150 ms (they wait as other draws do).a_wait_ends_when_its_build_is_put_off: a screen draw waits with a 5 s budget on another thread. 50 ms later the build is put off for memory throughmake_with(the gate's ownrefuse_compile). The waiter returns in under 2 s, the pipeline is not recorded as refused, and only the time actually waited is charged to the pass.a_pipeline_whose_compile_was_put_off_for_memory_is_made_laterand the other wait tests pass unchanged.cargo clippy -j 6 --locked -p victory-gpu --all-targets: finishes with warnings only. None is on a line this adds (checked againstgit diff -U0 41adb551 700a84fd). The one inmake.rsis main's (popnever used, l.1367).NOT tested
made=trueafter 9 s each, for a different pass each time (many new passes, each a slow compile), this change does nothing for them: each new pass still gets its first 10 s. #2580's compile grace and #3474's short screen wait while starved are aimed at that.Diagnostic to pin it (needs Selim's OK to read the attached play log of #3059, and of #3467 if zinixyt agrees):
grep "a pass over the screen was waited for": for each line,ms,made,formats,shaders. The sameshadersagain and again withmade=falseis the case this fixes. A newshaderseach time withmade=trueis the slow-compile case (#2580).grep "memory guard: a compile is put off\|host pipeline not made: the PC is short of memory\|compile memory:"around those times: put-offs point at #2188 / #3474 (and #2886), and a larger page file as the workaround (#2822).VICTORY_COMMIT_FLOOR_MB=60000to force the memory guard to put compiles off (it refuses every compile while free commit is under 60 GB), which reproduces the put-off case on any PC.Exact repro steps for the reporters: start the game, load into the world, open the pause menu and the map, wait 60 s. Before: frames of 9 to 10 s (the title bar's fps goes to 0.1), the log line above every 10 s. After: at most one 10 s frame for each map pass, then the map moves again, possibly with a part of it missing until its pipeline is made, and a line "a pass over the screen waited for its whole budget in all".
Overlap
gh pr list --state open --searchfor "screen wait", "pass over the screen", "SCREEN_WAIT", "screen passes", "held frame" (2026-11-30).git merge-treeof this branch with each PR head: all four below merge cleanly with main alone, and each conflicts with this branch inmake.rs'swait:!p.retry_waits()), in a helperwait_for_pipeline, and it keepsVICTORY_SCREEN_WAIT_ONCEfrom firing after a put-off. 3 conflict hunks. Whichever lands second drops its copy of the condition. This branch adds the per-pass allowance, which #2188 does not have.compilemem::starved()), ends waits on a put-off, and backs off retries 1 to 8 s. 2 conflict hunks. It covers the starved case harder than this. This branch also covers the cases where nothing is put off (a long compile, a long queue).VICTORY_PIPELINE_COMPILE_GRACE_MS(50) into a compile. It also ends waits on a put-off. 4 conflict hunks. It is the one that covers many new passes with a slow compile each (each one's first 10 s), which this does not. 597 lines over 8 files.outcomeandpipeline_keyto the "a pass over the screen was waited for" line. 1 conflict hunk (the same log call). It would make the diagnostic above one grep.VICTORY_SCREEN_WAIT_ONCE=1), #1744 (VICTORY_SCREEN_EARLY=1), #1124 (VICTORY_HELD_FRAME_MS), #1734 (the dropped-pass log). Closed: #497 (the same idea for draws that are not passes over the screen).AI use
Claude Code (Claude Opus 5.5) read the issues' text (no attachments) and the pipeline code, wrote the change and its tests, ran the checks listed above, and wrote this note. Nothing was run in game.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tyr0nsur on 2026-11-30T07:23:07Z.
I found a race in the per-pass allowance on
700a84f.wait_withinreadsscreen_waited_usbefore taking the frame-budget mutex, and charges the pass after waiting. Two concurrent draws of the same pending pass can each book the last 100 ms, even withVICTORY_PIPELINE_WAIT_SHARED=1, when the shared frame budget has room for both.The regression test starts with 400 ms charged against 500 ms, then holds the first caller at
DONEafter it books time. On this PR's head the second caller also enters the wait. With the follow-up, it returns immediately and the pass is charged exactly 500 ms total. The patch books per-pass time under the existing frame-budget lock and releases any unused reservation when the wait ends, including on memory deferral.Cherry-pickable commit
1d2f2cc. All 33pipeline::make::testspassed on Windows with 1 and 4 test threads (SCREEN_WAIT_EVERY_FRAME=0,SCREEN_WAIT_ONCE=0,PIPELINE_WAIT_SHARED=1, all with theVICTORY_prefix).cargo xtask policy --stagedpassed. This exercises the wait loop in unit tests. Game impact remains unmeasured. Codex implemented and tested the change, with Claude Code assisting in the review of adjacent deferral behavior.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-30T08:55:49Z.
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with--profile diag --features diagnostics, and the CPU tests of the touched code pass. A run on an RTX 4090 is queued. Frame times will follow here.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-11-30T13:14:52Z.
The same repeated screen wait appears during launch and world entry on
v2026.11.29.05.made=falseThe recorded wait durations were 10,000 ms in 186 of the events and 9,998 ms in one. Every waited-on shader set in those logs matches an earlier
E_OUTOFMEMORYrefusal key in its own run. The diagnostic groups pipeline variants by shader hashes. The repeated-wait fix lets later frames advance while the pipeline is missing. The underlying driver refusals remain a separate issue.I cherry-picked
700a84fthen @tyr0nsur's1d2f2cconto release main41adb551. Both applied cleanly. A native Windows test called the actual wait path for one pending screen pass on three successive frames, scaling the screen/draw budgets to 300/20 ms.VICTORY_SCREEN_WAIT_ONCE=1VICTORY_SCREEN_WAIT_EVERY_FRAME=1The reviewer's unchanged concurrent-booking test failed on
700a84fwith "two waits booked the same remaining time". It passed with1d2f2cc, including the assertion that 400 ms already charged plus the single 100 ms grant totals exactly 500 ms. The pipeline unit suite passed 30/30 on main, 32/32 on the PR, and 33/33 with the review commit with both one and four test threads. The review commit also checks release of the unused reservation on memory deferral.Please include
1d2f2ccwith its original Git author when updating this PR. The current Windows CI run stops at the existingvictory-loader::unwind_copyunused-function lint before reaching the tests.Integration follow-up. #3474 changes the same wait loop. I verified a combined review branch that keeps the short wait and early exit on memory deferral together with the screen allowance and reservation. All 75 targeted tests passed. Details and the author-preserving stack.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by SmallDevBigNothing on 2026-11-30T18:28:21Z.
I can confirm the repeat on another RTX 3060 12 GB / 32 GB system. A VILauncher log recorded fifteen 10,000 ms waits for the same unmade pipeline across fifteen frames. A separate run on
84bd61e2with Series S, 540p internal, DLSS Performance and frame generation off hit a 10.08 s median across 18 frames with 500+ draws. That run's log filter omitted wait events, so the direct attribution comes from the older capture.I rebased
700a84fwhile preserving main's monotonic frame budgets and driver-retry cutoff. Forty focused release tests passed on the initial adaptation. I've added @tyr0nsur's1d2f2ccreservation fix on top and isolated the wait tests from one another's frame counters. I'm building the combination one1251c31for a same-build comparison usingVICTORY_SCREEN_WAIT_EVERY_FRAME=1as the control.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by SmallDevBigNothing on 2026-11-30T18:52:26Z.
The test branch rebased onto e1251c31 includes this PR and @tyr0nsur’s reservation fix. All 41 focused tests passed in three single-threaded and three four-threaded runs. The locked release build and staged asset check passed.
On the RTX 3060, the integrated build exhausted the long allowance once for each of 14 different shader sets. Across the first 100 consecutive scene frames, the p95 was still 10.05 s. A later run explicitly preloaded 1,331 unique driver pipelines and set
VICTORY_HELD_FRAME_MS=100. Starting 30 seconds after scene entry, it averaged 17.68 rendered FPS over 126 seconds with a 109 ms p95. Frame generation was disabled. The cache and wait cap both changed between these runs. This supports the per-pipeline fix for repeated waits and shows the remaining cost when several distinct pending pipelines are encountered.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T18:59:05Z.
@tyr0nsur, thanks, the race is real.
wait_withinread the allowance before taking the frame-budget lock and charged the pass only after the wait, so two draws of the same pass could each book the last 100 ms. Your1d2f2ccis now in this branch with you as its author.@andrewpozdnakov7-jpg, thanks for the log tally and the timing table. I did what you asked and kept the original author.
The branch is rebased onto main
84bd61e2(v2026.11.30.02) and force-pushed. Three commits, now ending atbf49b9da:9cd9219f: the per-pass allowance. Main's #2188 (v2026.11.30.01) already ends a wait when the build is put off for memory (wait_for_pipeline,retry_waits()), so that half of this PR now comes from main, and the commit message no longer claims it. The allowance goes in as a limit on theroompassed to main'sreserve_wait.169a6e6a: tyr0nsur's commit, ported ontoreserve_wait. What is left of the allowance, minus what waiting draws have booked, is theroomthe booking gets. Booking, charging and releasing the unused part all happen under the frame-budget lock, as in1d2f2cc. The commit message says where it was cherry-picked from.bf49b9da(new): the screen wait tests take turns and use fresh frames. Main's frame budgets now give no wait to a frame older than their own (time_for_frame,ebff7087), and the tests share those budgets. So a test that ran after one with later frames had nothing to wait for: the put-off test passed without waiting, and the concurrent-booking test would stop at "a test thread did not reach its wait".wait_turngives each test frames later than any used before and runs the tests one at a time. The put-off test now also checks that it really waited.Checks on
bf49b9da(Windows 11, rustc 1.98.1, its own target dir):cargo check -p victory-gpupasses, with only main's one warning (Shadow::rangednever used).cargo test -p victory-gpu --lib -- pipeline::make: 41 passed, 0 failed, among themconcurrent_screen_draws_do_not_book_the_same_allowance,a_wait_ends_when_its_build_is_put_offanda_pass_over_the_screen_holds_frames_for_its_budget_once_in_all. Nothing was run in game.Two things changed on main since this was opened:
VICTORY_PIPELINE_WAIT_ALL(66124155, on by default in .30.02) makes every graphics draw wait as a pass over the screen, 10 s a frame, with a held frame capped at 20 s. With this PR, each such pipeline gets 10 s in all. After that, its draws are dropped once the frame's 500 ms is spent, as every draw was before WAIT_ALL, until the pipeline is made. That trades WAIT_ALL's "a hitch once" for frames that move, with something missing.VICTORY_SCREEN_WAIT_EVERY_FRAME=1brings back main's behaviour. Maintainers, your call.victory playno longer setsVICTORY_COMPILE_MEMORY=0(78978f86), so the compile memory gate is again one reason a pipeline can miss its 10 s.#3474: I haven't folded the combined stack in here, to keep this PR to the allowance. Main now has #2188's exit on a put-off. Whichever of the two lands second can be rebased onto the other's wait.
@dyshay, the head changed, so janus-prs needs the new one.
AI use: Claude Code (Claude Opus 5.5) did the rebase, ported the review commit, wrote the test commit, ran the tests and wrote this reply.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:48:44Z.
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