Card compare: one thread group per 64 KiB piece instead of one thread #451
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!451
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/451/head"
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?
@tightfall on GitHub · 2026-11-25 01:01 UTC · original
tightfall:card-compare-groups→main· +137 −18 · 2 files · 1 commits · closed without mergingCARD_COMPAREhashes the pieces of copies in the card's memory, after ranges are sent up and after the lists. It ran one thread per 64 KiB piece, and that thread walked its piece alone in 4,096 dependent 16-byte steps. So every pass took the time of one whole piece, however few pieces it had. The comment onrehash_runsalready says so.A Radeon GPU Profiler capture on an RX 9070 (Windows 11, Adrenalin 26.11.2) in the prison yard showed it as the most expensive pipeline of the capture: 295 dispatches of 1 to 44 groups, each 0.39 to 0.77 ms whatever its group count, 8.0 ms in all; one wave of 64 threads each. The log at the same time: about 600 hash passes a frame over about 1,600 pieces. RGP also put the GPU idle at 66% of the capture, so the time these passes take at the start of each submission is time the CPU waits.
With this change a group of 64 threads hashes one piece. Thread
itakes the 16-byte blocksi,i + 64, ..., so neighbouring threads read neighbouring blocks, and thread 0 folds the 64 hashes in thread order. That is 64 steps per thread instead of 4,096. Each thread's seed includes its index, so two blocks that swap places still change the hash. The hash is only ever made and compared by this shader, so its new form needs nothing else to change.card_compare_dispatchrecords a pass as one group per piece, in dispatches of at most 65,535 groups, and both call sites and the existing WARP test use it.Measured (same settings, scripted input, prison yard; medians over the world frames of the fps lines):
The runs used
VICTORY_INPLACE=2and a tree of this fork's main from2119b0eplus some local changes; this branch is the same change on top ofa803c87.Tested:
warp_card_compare_sees_a_change_in_every_part_of_a_piece: a byte changed at the first and last byte of a piece and in every thread's share, also with a copy that starts inside its first piece, flags that piece only; two swapped blocks are flagged too.warp_card_compare_stores_the_hash_it_made_when_toldpasses unchanged except for its dispatch size.cargo test -p victory-gpu(113 passed) and with--features diagnostics(120 passed);cargo clippy -p victory-gpu --all-targets -D warningswith and withoutdiagnostics;cargo xtask policy --staged.AI-assisted: found with RGP and written with Claude Code; tested on one machine (RX 9070, Windows 11, Adrenalin 26.11.2).
🤖 Generated with Claude Code
@tightfall on GitHub · 2026-11-25 01:10 UTC · original
Closing in favour of #253, which makes the same change to the compare pass and also to the hash passes before the lists (and puts the copies ahead of one barrier). It is older and covers more. My RX 9070 measurements with this compare-only version are on #253.
Pull request closed