Repository navigation
Conversation
fuzeofficlal
left a comment
There was a problem hiding this comment.
Code review on f962bf02 (static source inspection):
crates/victory-gpu/src/pipeline/make.rs:193-212cleanly avoids atomic RMW traffic on the hot path by checkingp.used.load(Ordering::Relaxed)before falling back top.used.swap(true, Ordering::Relaxed)(preserving single-recorder election under contention) and returning early fromp.made.get()without re-callingstart/wait.first_use_of_a_finished_pipeline_is_recorded_without_queueingcleanly covers bothusedrecording and non-queueing on an already-completed pipeline.
|
Confirmed the first-use race and the throughput gain through On a Ryzen 7 9850X3D, the completed-pipeline measurements below use aggregate wall ns per lookup.
There is a separate opportunity if recording threads bind the shared PSO frequently. With an actual 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 |
kotekompotek
left a comment
There was a problem hiding this comment.
LGTM — read-then-swap preserves the single note_used winner under races; the made.get() early return is equivalent to the old is_none() gate (made pipelines skipped start/wait before too) while staying read-only. Test asserts queued stays clear for finished lookups.
|
Automated triage for the maintainers. Merge candidate (small). In The gain is small per lookup (a tester measured about 13 → 0.6 ns with 4 threads sharing one pipeline, and confirmed CI: passing. Recommending a look, not approving. Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64:
- Diff review: Guarding
p.used.swap(true, Relaxed)behind!p.used.load(Relaxed)and returning early onp.made.get()avoids dirtying the shared cache line on every hot-path lookup after first use while still recording first use exactly once. cargo test -p victory-gpu --features diagnostics pipeline::make::tests: 4 passed, 0 failed (includingfirst_use_of_a_finished_pipeline_is_recorded_without_queueing).cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…with the branch The refreshed community PRs merge cleanly as text but did not build together with the branch: - Marvisak#2935 returns `None` for an unaccepted present, but on this branch `present_planes_with_compositor` returns the primary plane's state too. The unaccepted present now returns `(None, primary_state)`: the present copy has already run, so the plane is back in that state. - Marvisak#2509 makes `Staging::layout` the whole texture (all planes). The levels-on-demand check (Marvisak#2389) reads plane 0's level layout, so it now passes `layout.planes[0].layout`, as before Marvisak#2509. - Tests from Marvisak#1933, Marvisak#2336 and Marvisak#2729 used older APIs: the depth twin test imports `D3DCompile` itself (the branch's twin.rs writes its DXIL and no longer imports it), `HostShader` and `Translated` gained `written_root_uavs`, `threads` and `atomics64`, `hand_out` takes the title's bytecode pointers and `emit::emit` a `Target`. Marvisak#3005's test reads `queued` as the `Once` Marvisak#2223 makes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change
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.