GPU: flush buffered segment piece before evaluating queue memory waits #2609
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2611"
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 fuzeofficlal on 2026-11-25T16:46:47Z.
Summary
In
crates/victory-gpu/src/hold.rs,Held::pumpbatches consecutive ready segments on a queue intopieceand evaluates the next segment'sValueWaits againstw.readbefore flushingpiece.Because
piecehas not run yet (including its bottom-of-pipe writes), evaluating waits against pre-piecememory causes two ordering bugs:pieceoverwrites a word (for example7 -> 8) and the next segment on the same queue waits for== 7, the wait reads the stale7and passes immediately in the same piece instead of blocking.piecewrites the value (8) that the next segment waits for (>= 8), the wait reads the stale value, blocks on the first check, and falsely records a wait inPumped::waited.Changes
crates/victory-gpu/src/hold.rs:Held::pump, flushpiece((w.run)(*queue, std::mem::take(&mut piece)); done.pieces += 1;) before evaluating a segment'swaitswhen!waits.is_empty() && !piece.is_empty(). Consecutive wait-free segments (waits.is_empty()) continue batching into a single piece.a_wait_for_the_value_overwritten_by_its_queue_stays_heldanda_wait_for_its_queues_write_holds_on_the_first_check.Verification
cargo test -p victory-gpu --lib hold::tests— 12/12 pass.cargo clippy -p victory-gpu --all-targets -- -D warningsand--features diagnostics— pass (0 warnings).cargo xtask policy— pass (184 files ok).Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T17:15:49Z.
WARP verification of
922b89bmerged cleanly ontoorigin/main13f91ca(detached checkout).Environment: Windows 11. No physical GPU device was created:
VICTORY_D3D12_WARP=1,VICTORY_WARP=1,cargo -j 4, separateCARGO_TARGET_DIR.Commands and results:
cargo clippy -j 4 -p victory-gpu --features diagnostics --all-targets: clean.cargo test -j 4 -p victory-gpu --features diagnostics --lib: 200 passed, 0 failed, 1 ignored (origin/main: 198 passed). Both newhold::tests pass.hold::).Review notes:
hold.rspump): textually clean and complementary; together 204 passed, 0 failed, 1 ignored. #2611 also covers wait-bearing segments that follow a segment without a read-back, which #2608 does not.Worldchange, see my #2608 comment.)runcall only happens when a segment has waits and the buffered piece is non-empty.memory::a_submission_that_missed_leaves_the_copies_at_oncefailed in roughly 4 of 20 full runs on bothorigin/mainand the merged PRs, andframe::waits_end_on_ticks_and_count_framesfailed once onorigin/main.Not tested: physical GPU, or a retail title.
Independent review and WARP verification by Claude Code (Claude Sonnet 5.5), an AI. No game files, dumps or retail data were used.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:50:58Z.
Reviewed: running the buffered piece before evaluating the next segment's waits is correct — a queue's own earlier writes must be visible to its later waits (both tests pin the two sides: wait-for-own-write passes on first check, wait-for-overwritten-value stays held). Complements #2608 (post-submission writes) and #2605 (unreadable memory). CI green.
Imported from Marvisak/VIctory. Originally posted by Machad3x on 2026-11-25T18:26:37Z.
Setup: RTX 3080 Ti (driver 621.24), Windows 11, a local stack of open PRs merged with main
67e8ae1.Applied cleanly on that stack, together with #2601, #2598, #2576, #2626. One 10-minute game run reached gameplay with no device removal. These five PRs were not tested one by one, so nothing in that run is attributed to this PR alone.
Written with Claude Code; tested locally.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:21:26Z.
Automated triage for the maintainers.
The change in
Held::pump(crates/victory-gpu/src/hold.rs) runs the buffered piece before evaluating any segment that has waits, so a wait sees the memory its own queue's earlier segments wrote. The code does what it says and the two tests cover it, but it changes queue ordering behaviour without stated evidence: on hardware, a memory wait after a bottom-of-pipe write on the same queue is not automatically ordered after that write lands, so whether the wait ina_wait_for_the_value_overwritten_by_its_queue_stays_heldshould block is exactly what needs a reference (public RDNA2/PM4 documentation, D3D12 queue-ordering docs, or the title's own use that depends on it). It also has a cost: every wait-bearing segment that follows buffered work now forces a separate run-to-completion submission where before the segments were batched, and the second test only changes thewaiteddiagnostic. Please add the evidence and say which title pattern it fixes; a narrower flush (only when a wait would otherwise pass) would also reduce the extra submissions. CI:checkpassing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:24:38Z.
Good point on both the hardware EOP-write vs CP-wait ordering (a bottom-of-pipe
RELEASE_MEMwrite on the same queue isn't automatically ordered ahead of a subsequentWAIT_REG_MEM) and the extra submission cost.Since there's no confirmed title pattern depending on blocking an already-satisfied wait behind an unsubmitted same-queue segment, and
Held::pumpalready flushespieceand re-checks when a wait isn't yet satisfied, I'll close this rather than adding unnecessary submission splits. Thanks for the review!Pull request closed