simd: U64x8::transpose8 — the 8×8 u64 cross-lane transpose, all six backends - #332
Merged
Merged
Conversation
…ackends out[i] lane j == rows[j] lane i. The one physical routing step a lane-wise consumer cannot express as a coordinate map: argon2's row pass -> column pass (a column G reads words that live in eight different lanes). AVX-512: 8 unpack + 16 vshufi64x2 (24). AVX2: four 4x4 unpack/vperm2i128 blocks; off-diagonal blocks swap by destination choice only. NEON / wasm: 32 vtrn1q/vtrn2q or i64x2.shuffle on 2x2 blocks, block placement is renaming. Scalar / nightly: the index map. Tests: facade test on 64 distinct words (fixture asserted non-symmetric so identity fails; transpose is an involution); NEON (qemu) and wasm (node) parity arms gain check 0x310. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019HnekoM1EidTwQLS3oFVFm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019HnekoM1EidTwQLS3oFVFm
Contributor
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (10)
✨ Finishing Touches📝 Generate docstrings
Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_3c24c383-cb16-45c8-a83f-78f58e9ab85b) |
AdaWorldAPI
marked this pull request as ready for review
September 25, 2026 00:10
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.
What
U64x8::transpose8(rows: [U64x8; 8]) -> [U64x8; 8], whereout[i]lanej==rows[j]lanei. It is implemented on every backend:unpacklo/hi_epi64, then 16vshufi64x2, for 24 shufflesunpack+vperm2i128, 8 each); the off-diagonal blocks trade places by choice of destination onlyvtrn1q_u64/vtrn2q_u64on 2×2 blocks; block placement is register renamingi64x2_shuffle, same structure as NEONWhy a transpose
Argon2's
Block::compressneeds exactly one cross-lane move. I counted how many words change lane between stages (8 lanes, choice of register free):Greads rows 0, 2, 4 and 6, which sit in different lanes. This primitive does that move in registers.Verification
simd::tests::u64x8_transpose8_matches_the_index_map:It passes on native AVX-512 and on pinned
x86-64-v3.The NEON parity arm (qemu) and the wasm parity arm (node) pass with the new check
0x310.Disable runs. I broke each backend in turn and confirmed its check fails:
0x88to0xDD;vperm2i128from0x20to0x31;vtrn2qforvtrn1q(rc 784);<1,3>for<0,2>(rc 784).Full
cargo test --libon native: 2483 passed.clippy -D warningsis clean on native and on v3.Not run: the nightly-simd arm.
🤖 Generated with Claude Code
https://claude.ai/code/session_019HnekoM1EidTwQLS3oFVFm
Generated by Claude Code