GPU: the dropped passes a presented image reads go first in the pipeline queue #3378
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3378
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3378"
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?
@neonbyte1 on GitHub · 2026-11-26 20:58 UTC · original
neonbyte1:fix/hurry-feeders→main· +1003 −23 · 9 files · 3 commits · openStacked on #3353 (
fix/hold-unwritten-frames,df15a809); only the last commit (dba19ba2) is new here.What is wrong
#3353 fixes the flicker while pipelines are still being made: a dropped draw into the presented image holds the frame and its pipeline goes to the head of the workers' queue. A dropped pass further back still leaves the image wrong, because the image is then written from stale inputs.
Grand Theft Auto VI's world on a cold driver cache (
__GL_SHADER_DISK_CACHE=0 VKD3D_SHADER_CACHE_PATH=0, RTX 5090, Wine + vkd3d-proton) first binds ~1,900 pipelines in one frame. With #3353, the final upscale is made at once. But the world then stays black (brightest probed pixel 0–1 of 255) until the compute pass that resolves the lighting (structure_lod_wetness:CS_RaytracingResolve) is made. That pass waited 47–54 s in the queue in three runs, and then took 5.8–6.1 s to build. The image turns bright on the first frame after both pipelines exist, while ~1,000–1,700 others are still queued.What changes
While pipelines are queued, each frame notes:
At the present, a walk goes back from the presented images through passes that ran. It finds the dropped passes whose writes those passes read, and the nearest ones go to the head of the workers' queue (
crate::feeds). Once a hurried pass runs, a later frame's walk goes on behind it.The walk must not take the world's content. A first version did: one round put 666 mesh pipelines first and pushed back 103 pipelines the queue would have made within 15 s (a TAA resolve, a tiled-lighting clear, decal and particle compute). The world went dark again for about a minute. Hence three limits:
FAN_IN_MAX). One or a few passes (a resolve, lighting) leave a resource stale; hundreds of draws into depth or a geometry buffer leave objects missing. The walk still goes through such targets' passes that ran.HURRY_MAX), nearest first. Only pipelines that can still be hurried count toward the 8: queued, not taken by a worker, not hurried before.The first 64 pipelines a run hurries (
FIRST_MAX) are listed infirst-pipelines.txt, besideearly-pipelines.txt. The next run starts them ahead of the other early starts, during loading.The code names no shader.
Measured
All runs below use the same cold-cache setup, one 480 s run each, and the same diag build family. "+s" is the time since the scene's first frame.
made firstroundsfirst-pipelines.txtLimits
Cost
When nothing is queued (a warm run, or once the queue drains):
OnceLock::get. Refused pipelines stop there. A container's resource records are parsed only for pipelines being made, once per container.mem::takeof an empty graph, which allocates nothing.While pipelines are queued:
NOTES_MAX).first-pipelines.txtis capped at 64 keys.Tests
CPU only, under Wine; they create no D3D12 device.
feeds::tests:the_dropped_passes_a_presented_image_reads_are_found_nearest_first(including the second round once the resolve runs)nearer_feeders_come_firstthe_image_s_own_writer_and_writeless_passesa_cycle_endsa_target_many_dropped_draws_write_is_not_followeda_shared_pipeline_s_passes_are_followed_apartnotes_are_cappedpipeline::library::tests:the_first_list_keeps_this_run_first_under_its_capa_run_lists_its_first_hurries_onlyshown,pipeline::makeand early-list tests: 20 passed.cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings, with and without--all-features: clean.Related
make.rs: a pipeline is marked queued before it is counted as waiting, so a promotion in between can let a worker make it before the count.make::hurry(from #3353, used here too) is another promotion through the same window. @andrewpozdnakov7-jpg's combined commit335eb7b(#2223 + #3353 + #3025) waits for completed registration on both paths; whichever lands second needs a small rebase inmake.rs.AI-assisted (Claude); measured on my machine, no game data shared.
@neonbyte1 on GitHub · 2026-11-26 21:04 UTC · original
CI note: the one failing test,
frame::tests::waits_end_on_ticks_and_count_frames(frame.rs:231, a zero-time-out wait gotS_OKinstead ofTIMEOUT), is the known flaky frame-clock test. #2861 and #2877 describe exactly this line: 2 ms ticks on a loaded runner, plus the test sharing the global clock withwaits_begun_together_take_different_ticks. This PR doesn't touchframe.rs, and the other 246victory-gputests passed, including the newfeeds::,shown::andpipeline::library::ones. #3353, with most of the same code, passed CI twice. I can't re-run the job from a fork; a maintainer re-run should clear it.AI-assisted (Claude); no game data shared.
@Dukestar69 on GitHub · 2026-11-26 21:08 UTC · original · approved these changes
LGTM — verified on RTX 5090 (Windows / D3D12) against
origin/main(63bcca4).shownand the pipeline worker queue.cargo test -p victory-gpu --lib feeds:: -- --test-threads=1: 7 passed, 0 failed.cargo test -p victory-gpu --lib shown:: -- --test-threads=1: all passed.cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1: all passed.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 193 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.