Repository navigation
GPU: a pipeline is waited for in one frame only (#1181) - #1234
milesah3ad wants to merge 1 commit into
Conversation
A pipeline the worker has not made within a frame's wait budget (a slow or stuck driver compile) was waited for again in every frame that drew with it, each taking the whole budget (VICTORY_PIPELINE_WAIT_MS, 500 ms): world frames waited 500 ms each while four pipelines stayed MAKING (fxceless#1181), felt in play as a freeze while moving that the pause menu (no world draws) let go. Now the first frame with budget left claims the pipeline's one wait; later frames drop its draws until it is made, as past the budget before. The claim is taken under the budget lock and only with time left, so a pipeline first bound after another spent the frame's budget keeps its wait for a later frame. VICTORY_PIPELINE_WAIT_EVERY_FRAME=1 restores the old behaviour. The one-frame cap is from powplusplus' fxceless#867; claiming only with budget left is BradRoland's correction posted there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a2fa580 to
7195775
Compare
|
Rebased onto One fix to the test, too: it marked the pipeline as waited "in the frame before" with Full AI-assisted (Claude Code). |
- Single-frame-only PSO wait (clean-room GPL-3.0 adaptation of fxceless/victory-fork#1234, authors milesah3ad / powplusplus / BradRoland): - Extend StuckPipelineTracker in runtime/src/compile_budget.h with lock-free waited_frame_ (UINT64_MAX sentinel) plus can_wait_on_frame() and try_claim_wait_frame(), reset on reset() and mark_finished(). - Wire into all four async PSO wait sites in d3d12_vulkan_device.cpp (wait_async_compute, materialize_compute, lazy_compute, graphics variant()), claiming waited_frame_ only when remaining wait budget > 0 and returning pending_compile_pipeline() immediately (0.0 ms) on subsequent frames after checking completion. - Add unit & concurrency tests in runtime/test/compile_budget_test.cpp. - Cap console descriptor heap rescan churn in d3d12_vulkan_device.cpp: - Throttle evict_stale_title_windows() in before_execute to every 16th epoch or when title_window_bytes_atomic > 3/4 of title_window_cap. - Cap refresh_console_copy() live V# rescans to <= LEONIDA_CONSOLE_RESCAN_US (default 2000 us) per frame across multi-submission frames via last_rescan_frame + rescan_frame_spent_us on ConsoleHeapCopy (honoring LEONIDA_CONSOLE_RESCAN_US=0 for full pass; dirty_ranges remain immediate). - Change frame_perf diagnostic log prefix from [rt] d3d12: frame_perf to [rt] perf: so boot_bench.py does not count telemetry as D3D12 warnings. Verified on NVIDIA GeForce RTX 3080 (LEONIDA_VK_VALIDATION=1): compile_budget (16/16), d3d12_vulkan_device, d3d12_unmapped_vsharp, gta6rt build, check_no_game_data.py, and test_docs_env_vars.py all pass.
|
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 The four arms are clean receiver; the exact change from this PR at 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 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 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 AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High). |
|
Confirmed from Linux/Wine (RTX 3080 Ti, vkd3d-proton 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 ( With it, the same scene (about 4,790 draws a frame): 395–413 ms, and the frame log says For whoever worked around the old behaviour with |
|
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 e4245f3 with 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). |
@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; Clippy: main is clean again with -D warnings, with and without --all-features (3 lints) #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