GPU: make already-used pipeline lookups read-only #3005
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!3005
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3005"
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?
@AwsAli05 on GitHub · 2026-11-26 03:09 UTC · original
AwsAli05:gpu/ready-pipeline-fast-path→main· +24 −5 · 1 files · 1 commits · openChange
Avoid an unconditional atomic exchange and a second readiness check on every draw or dispatch using a finished pipeline. An atomic exchange still chooses one thread to record first use. Unfinished pipelines still enter the existing queue and wait within the existing frame budget.
I checked the open queue for matching work. #275 changes the wait after a cache miss. #2986 changes how the warm-up key is formed.
Verification
victory-gpupipeline tests passed with default features (3) and diagnostics enabled (4).git diff --checkpassed.AI-assisted with Codex.
@steven-seagull27 on GitHub · 2026-11-26 03:34 UTC · original
Confirmed the first-use race and the throughput gain through
pipeline::host_pipeline, the entry point used by draws and dispatches. Each worker held the same valid guest graphics pipeline. With 32 callers starting together, all obtained the same host object. I counted calls at the entry tolibrary::note_used, before its set deduplicates keys. It ran exactly once per guest object. Each of 16 fresh objects built once, and none of 16 prebuilt objects entered the queue. This passed on RTX 5080 and WARP at both63bcca43andf962bf0. Cold callers could retry after the frame wait budget expired.On a Ryzen 7 9850X3D, the completed-pipeline measurements below use aggregate wall ns per lookup.
SetPipelineStateevery 16 lookupsThere is a separate opportunity if recording threads bind the shared PSO frequently. With an actual
SetPipelineStateon each worker's own guest command list before every lookup, the PR measured 18.0 ns. Each bind still exchangesPipeline::bound. Adding the same relaxed load before that exchange in a local control reduced the median to 2.85 ns, with one first-bind event per guest object in the race. The parent varied from 14.55 to 38.15 ns between processes on this workload.The timing used WARP to create the finished D3D12 PSOs, with one recording worker pinned per physical core. The table gives the median of four fresh-process medians, seven batches per process and 320,000 lookups per worker in the multithreaded batches. The timings cover CPU lookup and the indicated binding calls. To reproduce, set
VICTORY_PROBE_DXCto the SDK compiler andPROBE_CORESto eight comma-separated affinity masks, then runcargo test --release -p victory-gpu --features diagnostics --lib actual_guest_pipeline_lookups -- --ignored --nocapture. Standalone review fixture@Marvisak on GitHub · 2026-11-26 05:49 UTC · original
Automated triage for the maintainers.
Merge candidate (small). In
pipeline::make::ready, a relaxedloadofusednow comes before theswap, so a pipeline already recorded no longer does an atomic exchange on every draw. Theswapstill makes sure only one thread callslibrary::note_used. A finished pipeline returns frommade.get()straight away. The not-yet-made path (start(p, true),wait, thenmade.get()) is unchanged. I checked that this is equivalent to the old code. The new testfirst_use_of_a_finished_pipeline_is_recorded_without_queueingcovers first-use recording and that a finished pipeline isn't queued again.The gain is small per lookup (a tester measured about 13 → 0.6 ns with 4 threads sharing one pipeline, and confirmed
note_usedstill runs exactly once per object under a 32-caller race on RTX 5080 and WARP), but the change is simple and safe.CI: passing.
Recommending a look, not approving.
Generated by Claude Code
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.