Repository navigation
GPU: account for pending pipelines before promotion - #2223
andrewpozdnakov7-jpg wants to merge 2 commits into
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib pipeline::make::— 3 passed, 0 failed (includingan_urgent_enqueue_cannot_overtake_the_first_queue_count)cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean ordering fix accounting for pending pipelines before urgent promotion. Looks good.
AI-assisted (Gemini 4 Neon).
catminou4
left a comment
There was a problem hiding this comment.
Account for pending pipelines before promotion; replaces queued AtomicBool with Once and adds a PEAK waiting metric. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
|
Automated triage for the maintainers. Merge candidate. The branch now merges cleanly into current Generated by Claude Code |
…efore promotion
…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>
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified 4f2b0f33975ecc38a7b8d786405fe40d5823ada3 merged onto origin/main (63bcca43c6a00a758510398fa43096ce7e4f7df0) on Windows 11 x64 (RTX 5090 + Microsoft WARP, Rust 1.98.1 MSVC).
Code & Concurrency Audit
- Replacing
Pending::queued: AtomicBoolwithstd::sync::Once(crates/victory-gpu/src/pipeline/make.rs:33) and runningnote_waiting()insidep.queued.call_once(...)(L221-230) closes the early-vs-urgent promotion race cleanly: any concurrent urgent caller blocks incall_onceuntilWAITING.fetch_add(1)completes, so a worker picking up the promoted entry can never executeWAITING.fetch_sub(1)(L331) before the count is registered. - Queue selection (
first || ahead && !p.taken.load(Relaxed)) and worker single-claim deduplication viap.taken.swap(true, Relaxed)(L327) remain intact, soWAITINGis still incremented and decremented strictly once even when an entry enters both queues. start(L210-214) andcount_waiting(L216-218) keepPEAKtracking accurate without altering external behavior.
Local Verification
cargo xtask policy— pass.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features) — 0 warnings.cargo test --locked -p victory-gpu --lib pipeline::make::(RTX 5090 and WARP) — all passed, includingan_urgent_enqueue_cannot_overtake_the_first_queue_count.- Additional synthetic stress probe racing 8 threads across 500 barrier-synchronized early + urgent
enqueueiterations on a singlePendinginstance — passed (counted strictly once, worker always observedwaiting == 1before decrement, finalwaiting == 0).
Looks good to merge.
|
I tested #2223 at Combined commit Windows: 15/15 queue and presentation tests with default features, 16/16 with diagnostics, strict Clippy in both configurations, and the asset policy check passed. This was a scheduler test with synthetic pipelines. Maintainers can carry the combined resolution forward if #3353 or #3025 lands first. Please keep the Git author or use |
An early enqueue marks a PSO as queued before it increments the pending count. A concurrent first draw can promote that entry and send it to a worker in between. If the worker finishes first, it can decrement the pending count from zero.
Run the first count through a per-pipeline Once so any concurrent promotion waits for the count to be registered. Urgent and early queue selection remains in the same code path.
The regression pauses the early enqueue before its count and then starts a concurrent promotion. The simulated worker saw 0 before the fix and 1 after it. The existing first-use test also exercises the worker queue.
Coordination claim in #1633.
AI-assisted using Codex. Synthetic data only.