GPU: test a queue segment's waits after the segments before it ran #3381
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3381"
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 Kolkka on 2026-11-26T21:06:04Z.
Problem
In
crates/victory-gpu/src/hold.rs,Held::pumpgathers a queue's ready segments into one piece and runs the piece only when it reaches a segment that cannot run yet. A segment with value waits was therefore tested against memory before the segments ahead of it in its own queue had run. A wait could pass on a value one of those segments overwrites with its bottom-of-pipe write, or hold on one it writes.On the macOS fork (pragyaangaur/VIctory-macOS), GTA VI's Series S intro stopped about two minutes into
Prestream. The title's render thread sat in an infinite wait, and then the title's hang checker ended the run. No queue was held and the host GPU was not stuck. With this change the same run reached the world. The pump is the same code here.Fix
hold::tests::a_wait_reads_what_earlier_segments_of_its_queue_wrote: a label starts at 1, segment A sets it to 0, and segment B waits for 1. Before the change, B ran on the stale 1. Now B stays held until the label is 1 again.Verification
cargo test -p victory-gpu --lib --target x86_64-pc-windows-gnullvmunder Wine with D3DMetal 4.0 beta 3 on an M5: all 11holdtests pass. The suite has the same 30 failures onmain(tests D3DMetal cannot run), and one more passing test (202 against 201).cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings: no warnings.Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T21:26:51Z.
Independent local verification of PR #3381 (
Queues: test a segment's waits after its queue's earlier segments ran), headdf3faef98b.cargo test --locked,CARGO_BUILD_JOBS=2, per-worktreeCARGO_TARGET_DIR(D:\Victory-Contrib\target-3381).cargo test --locked -p victory-gpu --lib -- --exact hold::tests::a_wait_reads_what_earlier_segments_of_its_queue_wrote-> 1 passed, 0 failed, 232 filtered, exit 0.git diff --check origin/main HEAD-> clean.63bcca43..., so it is genuinely added by this PR.Fakememory map; no GPU adapter or game data involved. The Wine/D3DMetal run reported by the author was not independently reproduced.AI-assisted (Hy4 flash). GPU/driver: N/A for this CPU test. No game data used.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T21:30:45Z.
Review: APPROVED
LGTM — verified on Windows against
origin/main(63bcca4).cargo test -p victory-gpu --lib hold:: -- --test-threads=1: all passed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T22:44:35Z.
I checked the complementary queue case on
df3faef. Two ready segments are recorded together. The second writes the value needed by the third. When the queue tests the wait, that write should already be visible, including in the wait diagnostics.On
main63bcca4the same test reaches the consumer in the end, but reports one stall because the first check sees the old value. Ondf3faefit runs the same two pieces in order, reports zero stalls, and leaves no held work. The test-only commit passed all 12 hold tests on Windows, along with strict GPU Clippy in both feature configurations andcargo xtask policy.The fixture uses the synthetic queue executor. The Prestream result remains the one in the PR description. @Kolkka, if you fold in the test, please keep the Git author or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T01:02:16Z.
Review: APPROVED
Looks good. Flushing accumulated
piecesegments before evaluating a subsequent segment'swaitsinHeld::pump(crates/victory-gpu/src/hold.rs:144-150) ensures bottom-of-pipe writes from earlier segments on the same queue are visible before wait evaluation, and the newa_wait_reads_what_earlier_segments_of_its_queue_wrotetest directly exercises that causal ordering.Verified:
cargo xtask policypasses cleanly.cargo clippy --tests -p victory-gpu(default and--features diagnostics,-D warnings) passes with zero warnings.hold::testspasses (11/11) on both RTX 5090 and WARP withVICTORY_D3D12_DEBUG=1.Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-27T18:12:43Z.
Overlap with #3141 (fuzeofficlal, opened 11-26 09:57Z, about 11 h before this one): it makes the same fix in
Held::pump. The hunk this PR adds before the segment's waits are tested (if !waits.is_empty() && !piece.is_empty() { (w.run)(*queue, std::mem::take(&mut piece)); done.pieces += 1; }) is line for line the first hunk of #3141. #3141 also runs the gathered piece before anItem::FenceWaitis tested, which this PR leaves as it is. Its tests adda_wait_runs_the_work_before_it_firstanda_wait_for_an_earlier_segment_on_the_same_queue_does_not_stall, the same case asa_wait_reads_what_earlier_segments_of_its_queue_wrotehere.Both merge cleanly into
main63bcca4on their own. Merged into each other (df3faefonto469d7a6), they conflict incrates/victory-gpu/src/hold.rs, so only one can go in as is. Onmainthe bug is as both describe: the segment arm tests its waits (hold.rs:143-157) without running the piece gathered before it. #2611 tried the same flush earlier and was closed unmerged.What this PR adds over #3141 is the title-level evidence from the macOS fork (the intro hang at
Prestream).Checked by reading and a local test merge only, no run. AI-assisted (Claude Code, Claude Opus 5.5 compared the diffs).
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.