gpu: parallelize relay card_merge_relay under VICTORY_WIDE_MERGE=1 #665
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!665
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-665"
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?
@JavierBlanco23 on GitHub · 2026-11-25 04:14 UTC · original
JavierBlanco23:perf/relay-copy-queue-and-wide-merge→main· +90 −26 · 1 files · 1 commits · openRefocused after review feedback from @CuteBooty and @HLVM04:
VICTORY_CARD_FETCH_INFLIGHT=1already removes the fetch wait cleanly inside the flight).WINDOW_MOSTback to 64.card_merge_relayunderVICTORY_WIDE_MERGE=1inHost::relay_card_backand extended it per-plan (preserving plan order) toHost::relay_card_inflight.@CuteBooty on GitHub · 2026-11-25 05:54 UTC · original
A landing without pieces can drop notes that a later fetch still needs
Found by reading 15579433, not by a run. Two independent reads agree.
In
relay_card_back, when a landing has no pieces, the code callsrelay_fetched(QUEUE_ORDER). That was right whilethe fetch queued behind the sends on the main queue. On the copy queue it is not: the merge's "after" is the plans'
highest
sent_as(S), not the queue's count (N).card_dirtydrops every note whose send number is at or belowRELAY_FETCHED.card_merge_relaykeeps title bytes only where a note's send is above the merge'sfetched_after."after" S+1, but the notes for S+2..N are gone. It then takes the card's bytes, which are older there, as shader
writes and puts them over title memory: a stale or wrong picture, silently.
Suggested fix, on the copy-queue path only (the main-queue path keeps
QUEUE_ORDER):Plans land in line order, so every later "after" is at least S, and pruning up to S never removes a note a later
merge needs. Empty
plansprunes nothing.Two things I did not verify, both with the copy queue on:
I expect stale-for-a-frame, corrected when that flight lands, but have not shown it.
copy queue meanwhile is outside D3D12's rules. Not tried with the debug layer.
Not run in the game yet on this card.
Setup: RTX 3070 8 GB (driver 621.24, 32-lane waves), Ryzen 5 3600, 32 GB, Windows 11, Series X mode, 1920x1080, relay at its default (stage 2), card buffers 1 / 1024 MB, a diagnostics build.
@HLVM04 on GitHub · 2026-11-25 10:24 UTC · original
A/B on an RTX 5070 Ti (wave32, NVIDIA 616.64), Series S profile. Tree:
9376fd6+ #798, #783, #799, #780 (withVICTORY_INDIRECT_KEEP=1 VICTORY_INDIRECT_WINDOW=1), #770 and #827, then this PR merged on top. The only conflict was the two newerCardPlanfields (inflight,inflight_landed), and I kept both. One run each, about 4.5 minutes, frame lines after the first 60 s:VICTORY_RELAY_COPY_QUEUE=0WINDOW_MOST64 → 512 change interacting withVICTORY_INDIRECT_WINDOW=1; I haven't separated it.No device loss in either run.
@JavierBlanco23 on GitHub · 2026-11-25 11:15 UTC · original
Thanks @CuteBooty and @HLVM04 for the thorough code review and A/B benchmark — both hit the nail on the head:
VICTORY_RELAY_COPY_QUEUE): removed from this PR. Between the empty-landingrelay_fetched(QUEUE_ORDER)bug, the cross-queue read/state hazard onNON_PIXEL_SHADER_RESOURCE, and theWHY_STALEjump (0.1 → 42.8 ms/frame) pushingpreparingup, it isn't the right mechanism — especially now that9376fd6'sVICTORY_CARD_FETCH_INFLIGHT=1eliminates the fetch wait inside the flight itself.WINDOW_MOST64 → 512: reverted back to64(didn't belong in this PR and regressed withVICTORY_INDIRECT_WINDOW=1).I've rebased onto
9376fd6and refocused the PR strictly on parallelizingcard_merge_relayunder the existingVICTORY_WIDE_MERGE=1switch, covering bothHost::relay_card_backandHost::relay_card_inflight(per-plan, preserving flight order across plans).@UwUCammie on GitHub · 2026-11-25 22:00 UTC · original
There’s an ordering case in the wide merge worth checking here too. Two declarations can cover different, overlapping parts of one title page, and distinct buffers can name that same page. Splitting the pieces by their position in the vector can put those writes on different workers. I ran into the same issue in #1066 and changed the partition to use the absolute title page. That also handles a buffer starting partway through a page.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.