Repository navigation
Conversation
The 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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CARD_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 from 2119b0e plus some local changes; this branch is the same change on top of a803c87.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