GPU: parallelize relay copy-back merges with VICTORY_WIDE_MERGE=1 #1066
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!1066
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1066"
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?
@UwUCammie on GitHub · 2026-11-25 18:18 UTC · original
UwUCammie:pr/relay-wide-merge→main· +275 −40 · 3 files · 4 commits · openVICTORY_WIDE_MERGE=1fans out piece merges viashadow::wide_runinHost::card_back, but underVICTORY_RELAY=2the three relay landing loops (relay_card_back,relay_card_inflight, andrelay_hand_back) still ran one piece at a time on the single landing thread (~28–33 ms/frame here).card_merge_lock: RwLock<()>onShadowsomerge_under_writes(carded path) takes the write lock and concurrentcard_merge_relayworkers take the read lock instead of serializing onself.before.wide_merge()(VICTORY_WIDE_MERGE=1) intorelay_card_back,relay_card_inflight, andrelay_hand_backwhen there are >= 8 pieces/spans.(shadow_ptr, 64 KiB page)for carded merges (and byshadow_ptrfor PC copies) into up to 8wide_runjobs so any pieces touching the same(copy, 64 KiB page)always land in the same bucket in their original plan order.Tested on Linux + Wine 11.22 + RX 7900 XT (RADV,
VICTORY_RELAY=2,VICTORY_WIDE_MERGE=1,VICTORY_BACK_OWN_VIEW=1, 480 s run into the cell scene):@UwUCammie on GitHub · 2026-11-25 22:00 UTC · original
I fixed the worker assignment in
ad4fb00. Card pieces are cut at 64 KiB boundaries in title memory, but the original code chose a worker by the offset from the buffer base. Two declarations could overlap in the same page and land on different workers when the buffer started partway into a page. The workers now use the title page, including when two buffers name it. Overlapping CPU-side spans land in their original order.The two regression tests cover clipped ranges, two buffer bases on the same page, and adjacent CPU spans. Windows host tests under Wine: 39 passed, one ignored.
@Proudnoob4 on GitHub · 2026-11-25 22:16 UTC · original
AI-assisted testing (Gemini in OpenCode); measured locally on my own machine.
RTX 4080 Windows 10 measurement (
ad4fb00+VICTORY_WIDE_MERGE=1): copy-back38.2 -> 23.2 ms(-39%)Setup: Windows 10 Pro 22H2 (Agility SDK 1.620.2), i5-13600K (6P+8E), 32 GB RAM, RTX 4080 16 GB (driver 621.01), Series X profile, diagnostics release build, warm cache,
VICTORY_RELAY=2 VICTORY_LATE_WAIT=3 VICTORY_QUEUE2=1 VICTORY_WIDE_BACK=1 VICTORY_COPY_PLAIN=1 VICTORY_CARD_BUFFERS_MIN_KB=64 VICTORY_CARD_BUFFERS_MB=1536 VICTORY_CARD_HASH_LEN=1 VICTORY_INDIRECT_WINDOW=1 VICTORY_INDIRECT_GATHER=1 VICTORY_JOIN_PARTS=1 VICTORY_ASYNC_SUBMIT=1.Comparing two runs on the same
9c184b3-based bundled speed stack before and after adding#1066(ad4fb00,VICTORY_WIDE_MERGE=1) alongside#1058,#1146,#1158,#1159:framelogusual frame /fpslines)fxnext_win, no#1066)fxnext_turbo,#1066VICTORY_WIDE_MERGE=1)copy-back(framelogusual frame)38.2 ms(62.85 MB)23.2 ms(62.52 MB) (-39%)copying back(median across world lines)39.4 ms24.3 msthe relay per frame)25.4 mslanding in all (8.0landings,4.4 msfetch wait,1,372.9pieces fetched)27world lines, 330 s)5.20med /9.40max (18 lines)8.50med /9.20p90 /9.30max (last10:8.3–9.3)0device loss,0crashes);66/66targetedvictory-gputests pass(Note: bundled run with
#1058,#1146,#1158,#1159added in the same rebuild, so this is a bundled measurement rather than an isolated single-PR A/B;#1058also dropped<256 Bkernel copy fallbacks5,266 -> 47/frame.)@SkillIssueXO on GitHub · 2026-11-26 02:27 UTC · original
AI-assisted source review and native Windows fixture. I checked
ad4fb005and reranmodules::xmem::tests::physical_pages_map_alias_and_unmapsuccessfully. The title-page bucket fixes overlapping declarations at the same virtual page. The HLE test also confirms that two distinct title virtual pages can show the same physical bytes.relay_merge_bucketcan place those two views on different workers because it hashes the virtual page. For example, views at0x100000and0x210000hash to buckets 0 and 1.Could the parallel card paths keep writes to the same backing section page in plan order, or fall back to serial for aliased ranges? A fixture that maps one 64 KiB page twice and lands overlapping updates from two copies would cover the remaining case. This is a source-level ordering concern. I have not reproduced a gameplay corruption from it.
@UwUCammie on GitHub · 2026-11-26 13:52 UTC · original
@SkillIssueXO The two virtual addresses in your example could go to different workers. Fixed in
9029467d. The relay and direct card paths now check the section-page map before splitting a landing. A span touching a page with multiple live views takes the serial path in plan order.The regression maps one anonymous section twice under Wine, makes two overlapping writes through the different views, and checks the five resulting bytes. It also checks that the unaliased neighboring page stays eligible and that removing the second view restores eligibility. All three relay bucket tests passed.
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.