GPU: account for pending pipelines before promotion #2223
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!2223
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 08:16 UTC · original
andrewpozdnakov7-jpg:codex2/pso-queue-accounting→main· +70 −22 · 1 files · 2 commits · openAn 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.
@Marvisak on GitHub · 2026-11-25 13:29 UTC · original · edited 2026-11-26 01:24 UTC
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
@DenRakEiw on GitHub · 2026-11-25 08:22 UTC · original · approved these changes
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 on GitHub · 2026-11-25 08:48 UTC · original · reviewed
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.
@fuzeofficlal on GitHub · 2026-11-26 19:27 UTC · original · approved these changes
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.
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 20:47 UTC · original
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.