GPU: account for pending pipelines before promotion #2221
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2223"
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?
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T08:16:00Z.
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.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T08:22:48Z.
Review: APPROVED
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).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:48:25Z.
Review: COMMENTED
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.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:29:52Z.
Automated triage for the maintainers.
Merge candidate. The branch now merges cleanly into current
main(4f2b0f3). The race is real inmain'spipeline/make.rs.enqueuesetsqueuedbefore it incrementsWAITING. A draw that promotes the entry in between can send it to a worker, and the worker'sWAITING.fetch_subthen wraps below zero. After that,drained()no longer fires at the right time andmaking()reports nonsense. TurningPending::queuedinto astd::sync::Once, with the count taken insidecall_once, makes a concurrent promotion wait until the count is in. The queue-selection logic is unchanged. The new test forces the interleaving with channels, and the existingenqueuetest no longer adjusts the globalWAITINGby hand. CI (check) passes on this head.Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 20:06:09 +00:00
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T19:27:44Z.
Review: APPROVED
Reviewed and verified
4f2b0f33975ecc38a7b8d786405fe40d5823ada3merged ontoorigin/main(63bcca43c6a00a758510398fa43096ce7e4f7df0) on Windows 11 x64 (RTX 5090 + Microsoft WARP, Rust 1.98.1 MSVC).Code & Concurrency Audit
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.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.enqueueiterations on a singlePendinginstance — passed (counted strictly once, worker always observedwaiting == 1before decrement, finalwaiting == 0).Looks good to merge.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T20:47:15Z.
I tested #2223 at
4f2b0f3with #3353 atdf15a80and #3025 at018b56a. The new presentation path can hit the same accounting race viahurry: the regression pauses the first enqueue before its count and checks whether the presentation path can promote it. The two-PR control admitted the uncounted pipeline.Combined commit
335eb7buses #2223's completed registration for both promotion paths. The presentation path can promote it as soon as the count completes. Graphics still goes first, compute keeps its cap, and a worker claims a promoted entry once. The two new presentation tests fromdf15a80pass too.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
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the resolution into another commit.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.