Card compare: one thread group per 64 KiB piece instead of one thread #518
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!518
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-518"
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?
@pug205gti6 on GitHub · 2026-11-25 01:57 UTC · original
pug205gti6:pr/451-card-compare-wide→main· +137 −18 · 2 files · 1 commits · openThe compare's single thread per piece walked 4,096 dependent 16-byte steps, so every pass took the time of a whole piece (0.4-0.77 ms on an RX 9070 whatever its group count) and several hundred passes ran a frame. Now 64 threads hash a piece together, each taking every 64th 16-byte block, and thread 0 folds their hashes in thread order. card_compare_dispatch records a pass as a group per piece, in dispatches of at most 65,535 groups. New WARP test: a change in every part of a piece is flagged, also with a skewed copy and swapped blocks.
@Headache3318 on GitHub · 2026-11-25 07:51 UTC · original
Independent verification: PR #518 merges cleanly onto main, no conflicts. Build: success. Tests (per-package, target): victory-gpu 118/118 pass, victory-core 11/11 pass, victory 1/1 pass, victory-hle 95/96 pass. Known failure: victory-hle::net::tests::only_loopback_is_reachable fails on Wine (missing WSAConnectByList) — pre-existing on main. PR is clean: builds, no new failures, all GPU tests pass. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.
@LeonardoS11 on GitHub · 2026-11-25 08:48 UTC · original
Numbers for this from an RTX 3080 Ti, on current
main(9376fd6), in case they help it along.Windows 11, RTX 3080 Ti 12 GB, 64 GB RAM,
diagbuild withdiagnostics; a still scene in the prologue (the room with the window onto the yard, about 4,900 draws a frame), 300 s a run, averages of the last 8 frame-rate lines. All runs withVICTORY_LEVELS_ON_DEMAND=1 VICTORY_INDIRECT_WINDOW=1 VICTORY_INDIRECT_KEEP=1(the last is #780).9376fd6+ #780VICTORY_CARD_FETCH_INFLIGHT=1, without this PRVICTORY_CARD_FETCH_INFLIGHT=1, with this PRSo here the 64-thread compare takes 25–30 ms off the wait for the card, and it is what makes the new in-flight fetch pay: without it the fetch moves the time from "copying back" to the card. The picture was the same in all of these (walls, posters, the mesh in the window), no device loss.
The PR does not apply to
9376fd6as it is (the in-flight fetch touched the same code). I reapplied it there without changing its design — the shader,card_compare_dispatchand the WARP tests are this PR's; the only real change is that theCARD_FETCHtests now callcard_compare_dispatch. The rebased commit is 811c5f5 inLeonardoS11/victory-fork(branchport/v4-770, with other things of ours under it); I can put it on a clean branch if you want to take it.(Runs by me on the hardware above; rebase and this note with Claude Code.)
@Andry018 on GitHub · 2026-11-25 15:14 UTC · original
Measured on an AMD Radeon RX 6600 (8 GB, RDNA2) with a Ryzen 7 9700X and 32 GB RAM, Windows 11, on
mainatf85101bwith the same design as this PR: one group of 64 threads per 64 KiB piece inCARD_COMPARE. My branch is Andry018/victory-fork@perf/parallel-card-compare. It also has a switch,VICTORY_CARD_COMPARE_SERIAL=1, that brings back the one-thread-per-piece compare, so A and B run the same executable and the same warm shader cache.Default settings, prologue cutscene from the same save. Each run was about 5 to 7 minutes long and showed no device loss.
About 16,800 pieces are compared per frame. With one thread walking each 64 KiB piece, the compare is the longest wait on this card. Splitting the work across a group takes about 70 ms of GPU time off each frame, roughly -20% frame time end to end. This agrees with the 90 -> 32 ms GPU wait reported in #264 on an RX 6800.
Rebasing onto
f85101bneeds one change: the new testwarp_card_fetch_copies_flagged_pieces_to_their_slotsdispatchesCARD_COMPAREasDispatch(1, 1, 1), which is the one-thread shape. With a group per piece it has to dispatch one group per piece, or it hashes only piece 0.Unrelated to the compare and the same in both modes: on this card, faces in the world stay black (as reported on an RX 6800 in #264), and face textures sometimes arrive late, depending on the texture queue.
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.