gpu: compare 64-byte and 8-byte unaligned u64 blocks in shadow::changed_runs #1126

Open
DoktorTK wants to merge 1 commit from upstream-pr/1129 into main
DoktorTK commented 2026-11-25 20:59:50 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by DoktorTK on 2026-11-25T20:59:50Z.


Speeds up shadow::changed_runs by scanning 64 bytes (8 x u64) and 8 bytes (u64) at a time via unaligned loads for both equal runs and differing runs (using a branchless SWAR zero-byte check on a ^ b to detect 8-byte blocks where every byte differs) before falling back to single-byte tail steps.

  • Reduces submit-thread CPU overhead when scanning large GPU write-back pieces (80–104 MB/frame).
  • Verified with cargo test --release -p victory-gpu changed_runs (including the 20,000-case changed_runs_are_the_ones_a_walk_byte_by_byte_finds property test, 0 failures).
<!-- greyfinch-sync:fxceless/victory-fork:issue:6613647270 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1129). Originally posted by [DoktorTK](https://github.com/DoktorTK) on 2026-11-25T20:59:50Z. --- Speeds up `shadow::changed_runs` by scanning 64 bytes (`8 x u64`) and 8 bytes (`u64`) at a time via unaligned loads for both equal runs and differing runs (using a branchless SWAR zero-byte check on `a ^ b` to detect 8-byte blocks where every byte differs) before falling back to single-byte tail steps. - Reduces submit-thread CPU overhead when scanning large GPU write-back pieces (`80–104 MB/frame`). - Verified with `cargo test --release -p victory-gpu changed_runs` (including the 20,000-case `changed_runs_are_the_ones_a_walk_byte_by_byte_finds` property test, 0 failures).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1129:upstream-pr/1129'
git switch 'upstream-pr/1129'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1129'
git switch 'upstream-pr/1129'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1129'
git switch 'upstream-pr/1129'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1129'
git switch 'main'
git merge --squash 'upstream-pr/1129'
git switch 'main'
git merge --ff-only 'upstream-pr/1129'
git switch 'main'
git merge 'upstream-pr/1129'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1126
No description provided.