GPU: a pipeline is waited for in one frame only (#1181) #1231
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1234"
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 fxceless/victory-fork. Originally posted by milesah3ad on 2026-11-26T01:02:08Z.
@fxceless — requesting your review and merge.
Fixes the steady-state stall in #1181: a pipeline the worker has not made within a frame's wait budget was waited for again in every frame that drew with it, each time for the whole
VICTORY_PIPELINE_WAIT_MS(500 ms). In play this reads as the game freezing while you move, and un-freezing after opening the pause menu (no world draws there, so the worker catches up).Change
crates/victory-gpu/src/pipeline/make.rsonly (+60/−3):Pendinggetswaited_frame: the first title frame that waited for it. A pipeline is waited for in one frame; later frames drop its draws until it is made, exactly as draws past the budget are dropped today.VICTORY_PIPELINE_WAIT_EVERY_FRAME=1restores the old behaviour.Credit: the one-frame cap is powplusplus' (#867 — which also carries unrelated changes that removed the device for HrHd); claiming only with budget left is BradRoland's correction posted on #867. This PR is just that piece, on its own.
Tests
cargo test -p victory-gpu --locked: 195 passed, 1 failed —watch::tests::written_pages_are_reported_to_every_asker, which fails the same way onmain(a183ea2) here, without this change.VICTORY_PIPELINE_WAIT_EVERY_FRAME=1it waits 510 ms and fails; with the fix it returns immediately.cargo clippy --all-targets --all-features: nothing inmake.rs(the existing errors onmainremain; #841).In the game
RTX 5080 16 GB (wave32), driver 621.24, Ryzen 7 9800X3D, 64 GB, Windows 11 26300, Series X profile, release build of this branch (on
006c353) +VICTORY_RELAY=1 VICTORY_TEXTURE_BACK=1 VICTORY_FRAME_LOG=1, cold pipeline cache.waitedin the usual frameThe tester reported play as "very smooth and steady" where the previous build froze whenever the character moved. I did not run an A/B on this exact tree without the change, so the before side is #1181's measurement (500 ms waited every world frame with 4 stuck pipelines) plus the tester's experience on an earlier build.
Note on the cold start: with hundreds of first-time pipelines every frame still finds a new one to wait for, so the budget is spent until they are made (first row). That is the existing design and unchanged here.
AI-assisted (Claude Code, Claude Opus 5.5): the change, tests and measurements were prepared with it; a person ran the game, judged the result and asked for this PR to be opened.
🤖 Generated with Claude Code
Imported from fxceless/victory-fork. Originally posted by milesah3ad on 2026-11-26T02:10:04Z.
Rebased onto
fc63ce1.a35c557addedformatsandvarianttoPending, next to this PR'swaited_frame; the conflict was only that. Both are kept, and each format variant is its ownPending, so it gets its own single wait like any other pipeline.One fix to the test, too: it marked the pipeline as waited "in the frame before" with
frame.wrapping_sub(1), which at frame 0 (the test run alone) isu64::MAX, the "not waited yet" sentinel, so the run alone waited and failed. It now usesframe.wrapping_add(1). Run alone: 6/6 inpipeline::make; withVICTORY_PIPELINE_WAIT_EVERY_FRAME=1the test still fails after a 500 ms wait, as it should.Full
cargo test -p victory-gpu: passes, apart fromwatch::tests::written_pages_are_reported_to_every_asker, which fails intermittently here onmaintoo (one run 200/200, the next 199/200).AI-assisted (Claude Code).
Imported from fxceless/victory-fork. Originally posted by ArturoWolff on 2026-11-26T07:21:21Z.
Independent, game-free scheduler comparison on the receiving fxceless tree. This supports the one-frame wait cap, but also gives a reason to keep the policy for a once-only compute dispatch separate from that for an ordinary draw.
Setup and provenance: receiver
46bf5351707b1697c04e5d871c30973ebaa3e973, native Linux Rust 1.98.1, separate source trees and Cargo targets. I exercised the actualpipeline/make.rsworker queue, condition variable andready()implementation in a small Rust adapter. Only host pipeline construction, the frame counter, library bookkeeping and the Windows/Wine-specific environment interfaces are replaced by synthetic fixtures; no D3D12, title data, shader conversion, driver cache or GPU. Each scenario starts in a fresh process.VICTORY_PIPELINE_WAIT_MS=80, shared budget on, with explicit compute-policy selection. The shorter render budget makes the test cheap, not a proposed in-game setting.The four arms are clean receiver; the exact change from this PR at
7195775ba6f09a797b7523c749c7d8b558255a7f; the compute-wait policy only from Beqren's #129,c0fdca08d3446294336cfb6d59c2dbaa2cced69awith the concurrent-caller follow-upda4cee66b2a7d2fe1339c08f5b1a6732082f7de5; and the combination. Credit for the one-frame cap and budget-claim correction also goes to powplusplus and BradRoland (#867), as noted in the PR. The compute change on this receiver keeps its existing graphics wait, worker queue and logging style. I am testing the readiness policy, not the other #129 changes or the reworked branch now in draft.Measured:
Each controlled job builds exactly once; after eventual publication its ready result remains usable. To reproduce the compute case, hold one synthetic graphics job until the shared budget expires. Have a worker claim a second, compute job but hold its result. Call
ready()once from each of one or two recording threads. Release the synthetic builder only when each caller has entered the real condition-variable wait or returned without it. Count returned host IDs, not just queued jobs. The baseline and #1234 lose those simulated one-shot calls even though the worker soon publishes successfully. The compute-wait variant returns the same successfully built host object to both callers. This models readiness only, not the subsequent command recording, binding or dispatch effect.Controls: a pipeline that did not get any wait in one frame can still use the next frame's budget; a second graphics pipeline does not get extra budget in the spent frame. With
VICTORY_PIPELINE_WAIT_EVERY_FRAME=1the combined arm returns to four graphics waits; withVICTORY_COMPUTE_WAIT=0it returns to the baseline one-shot behavior. With a compute job deliberately held, the real 20-second allowance expires at 20,000 ms, the next call skips waiting, and the later published result is accepted. The two new tests in #1234 and the inherited scheduler tests pass in the combined arm. Totals across four arms: 50 passing focused test invocations, four intentional assertion failures that reproduce the old/missing behavior. All four isolated builds/runners exited successfully; no OOM, game launch or GPU workload.Implication: the repeated-wait fix and the once-only correctness concern are complementary, not substitutes. I would keep the cap for draws and investigate an explicitly selected bounded compute policy rather than globally setting the wait budget to zero. The 20 s limit here is per wait call before the give-up flag skips later waits, not a guaranteed total frame time; multiple delayed jobs can still accumulate long waits. The delay before a worker starts building matters too, and a real application-level dispatch/consumer witness is still needed before attributing missing geometry to this mechanism.
Beqren's corrected report is consistent with our earlier RTX 4060 runs with vkd3d-proton
71cae091, where five of the six named programs reached host completion (the sixth remained unresolved within our observation window). The converter fix is a separate matter from the remaining cold-cache readiness race. Thanks for checking that on both runtime versions. My test does not establish a native Windows/AMD/NVIDIA gameplay result, any particular head/skin repair, or a safe final choice of wait duration. No title launch or change to the installed runtime was made for this comparison.AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
Imported from fxceless/victory-fork. Originally posted by slauko on 2026-11-26T07:30:23Z.
Confirmed from Linux/Wine (RTX 3080 Ti, vkd3d-proton
ec20719, uiliannn's line with this patch taken as it is).Before it, every world frame stood at the wait budget, whatever the build or the preset: 507–519 ms in one run and 622–627 ms in another on the next build, and 512–514 ms in three earlier ones, all at about 4,800 draws. Each frame's first draw with one of 40 compute pipelines the workers never finished took the 500 ms again, and 340 draws were dropped a frame (
dropped 340 without a host pipeline (4 being made)).With it, the same scene (about 4,790 draws a frame): 395–413 ms, and the frame log says
pipelines: 0.0 ms waited. What is left of a 403 ms frame: 112 ms preparing, 268 ms waiting for the card, the card idle 65 ms — so it is the card's time now.For whoever worked around the old behaviour with
VICTORY_PIPELINE_WAIT_MS=0: that drops a pipeline's draw in the frame that first asks for it, every time. With the one-frame claim the default budget is right again.Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-26T17:39:55Z.
I reproduced the repeated-wait behavior from #1181 on Bazzite 44, RTX 5060 Laptop 8 GB, NVIDIA 615.78.08, GE-Proton11-14, and vkd3d-proton 3.2.0 (cae8353ed7959c4+). All three Series S replays used the same offline checkpoint, initial caches and 54-second stationary camera window before input. The compatibility baseline was main
e4245f3c1bwith the same Linux bring-up changes in each arm.Four to six pipelines were still pending in all three windows. The #1234 arm retained working camera input after the measurement. All six focused pipeline tests passed under Proton on the compatibility build.
I rebased the scheduler change onto
e4245f3, preserving the original authorship and current main's first-use tracker. The scheduler file matches the tested port byte for byte and the staged asset-policy check passed. Clean rebase c988e0f.Assisted by Codex (GPT-6.2-Sol High).
Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-27T17:13:54Z.
I repeated the A/B on a local Proton-enabled build of the newer NVIDIA renderer from
52dfd12, with only this PR's one-frame wait port changed and the default 500 ms budget in both runs. Same Series S checkpoint and starting caches, no input in either 11.4 s gameplay sample. On the RTX 5060 Laptop with GE-Proton11-14 and vkd3d-proton 3.2.0, the comparable view went from 3.05 to 4.74 unique rendered Presents per second. Frame times were 333/454 vs 165/459 ms median/p95. Aggregate recording-thread waits around that view fell from about 500 ms to 84–182 ms per frame. The control and candidate reported about 2,983 and 2,949 draws in their sampled frame groups. The two runs showed differing water artifacts and the same later mission failure. All nine focused scheduler tests passed on the forward port.Assisted by Codex (GPT-6.2-Sol High).
Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-27T18:43:57Z.
Retested the one-frame wait as the only source change on the
f299fbarenderer with the same Proton compatibility patches in both arms. On the RTX 5060 Laptop, GE-Proton11-14 and vkd3d-proton 3.2.0, the matched 7.7-second Series S boat view went from 3.01 to 4.00 rendered FPS, with p50/p95 intervals of 333/494 versus 226/469 ms.Over a separate 124-second boating stretch, the runs took different routes and averaged 3.08 versus 5.12 real Presents per second. The candidate rendered about 4,065 versus 3,712 draws in its frame summaries. After most compilation finished, seven jobs remained queued in both runs. The baseline kept spending about 500 ms on the same shader and the candidate recorded about 0–2 ms in the final samples. All nine scheduler tests and three physical compatibility checks passed.
Assisted by Codex (GPT-6.2-Sol High).
Imported from fxceless/victory-fork. Originally posted by akimfomin on 2026-11-28T01:30:25Z.
The pinned pair
7195775bplus #1503 (0d7a2baf) conflicts inpipeline/make.rs. If those streams meet, an integration test should compare one pending graphics variant used on repeated draws with one pending compute dispatch used only once. The per-frame wait budget must retain its variant identity, and any private-list deferral must still allow the eventual dispatch. This only adds a combination check to the existing Linux A/B evidence.Imported from fxceless/victory-fork. Originally posted by BitWuehler on 2026-11-28T18:36:33Z.
In-world A/B on rebased
main368967fon CachyOS Linux (Ryzen 7 9800X3D, RTX 5080 16 GB620.73.04,GE-Proton11-14with RB-treewineserver+vkd3d-proton, Series X profile at 2560x1440,releasebuild,VICTORY_PIPELINE_WAIT_MS=500in both runs):the card's clock: nothing of ours queuedpreparing(submitting thread)368967f+ Proton bring-up (without #1234)In the control run, the last host PSO finished compiling 2m 21s before exit while 7 translated compute shaders (
17829ac71aab4e8d,32ed072b9f845048,559d9f0184e15fe3,a1b20bc47e3c9597,afeea48bbb9913ad,e8c962358d862e3f,fdd56d97a806bcca) remained stuck insidevkd3d-proton, burning the full 500 ms wait budget on every subsequent frame. With #1234 ported onto368967f'spipeline/make.rs(plusmake::tests::9/9 passing), the repeated 500 ms stall disappears completely while keeping the initial 500 ms first-frame budget intact.(AI-assisted port, log analysis, and summary.)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.