Repository navigation
Conversation
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.
Summary
Adds runtime-dispatched AVX2 (32 bytes/iter) fast paths to
merge_piece,first_difference, andlast_differenceincrates/victory-gpu/src/shadow.rs(with zero new dependencies and the existing scalar/u64implementations preserved as fallbacks):merge_piece(AVX2 + skip-unchanged fast path): Whennow[i..i+32] == held[i..i+32](_mm256_movemask_epi8(eq) == -1), skips reading/writingtitleand avoids dirtyingheldcachelines — reducing DRAM traffic from 5 streams to 2 streams on untouched 32-byte blocks.first_difference&last_difference(AVX2 32 B/iter): Scans 32 bytes per iteration via_mm256_cmpeq_epi8+_mm256_movemask_epi8+trailing_zeros/leading_zeros.difference_teststo cover 31/32/33/64/65/97-byte boundaries and addedmerge_piece_matches_scalar_across_lengthsverifying bit-for-bit agreement with the scalar implementation.Synthetic CPU Benchmark (i5-12400, 64 MiB = 1024 × 64 KiB pieces)
merge_piece: 13.64 ms → 6.94 ms (1.97× faster, 4.58 → 9.01 GB/s single-thread)first_difference: 4.42 ms → 3.04 ms (1.46× faster, 14.13 → 20.57 GB/s)