gpu: parallelize relay card_merge_relay under VICTORY_WIDE_MERGE=1 #665
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from fxceless/victory-fork. Originally posted by JavierBlanco23 on 2026-11-25T04:14:23Z.
Refocused 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.Imported from fxceless/victory-fork. Originally posted by CuteBooty on 2026-11-25T05:54:58Z.
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.
Imported from fxceless/victory-fork. Originally posted by DoktorTK on 2026-11-25T07:41:26Z.
found this while trying out some optimizations, don't have a lot of experience in this so i figured i just post it here.
The author implemented VICTORY_WIDE_MERGE=1 (wide_merge()) for the non-relay card_back path, but forgot to wire wide_merge() into relay_card_back.
Imported from fxceless/victory-fork. Originally posted by HLVM04 on 2026-11-25T10:24:29Z.
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.
[PR #665] gpu: dedicated D3D12 copy queue + parallel wide merge for relay card fetchesto [PR #665] gpu: parallelize relay card_merge_relay under VICTORY_WIDE_MERGE=1Imported from fxceless/victory-fork. Originally posted by JavierBlanco23 on 2026-11-25T11:15:21Z.
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).Imported from fxceless/victory-fork. Originally posted by UwUCammie on 2026-11-25T22:00:50Z.
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
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.