swizzle_dyn: 64 byte swizzle_dyn for AVX2#480
Open
87flowers wants to merge 2 commits intorust-lang:masterfrom
Open
swizzle_dyn: 64 byte swizzle_dyn for AVX2#48087flowers wants to merge 2 commits intorust-lang:masterfrom
87flowers wants to merge 2 commits intorust-lang:masterfrom
Conversation
3bdb528 to
c045fbe
Compare
| use x86::_mm256_permute2x128_si256 as avx2_cross_shuffle; | ||
| use x86::_mm256_shuffle_epi8 as avx2_half_pshufb; | ||
| let high = Simd::splat(64u8); | ||
| // SAFETY: Caller promised AVX2 |
Member
There was a problem hiding this comment.
you should probably add more safety comments, e.g. answer why is the transmute sound?
Author
There was a problem hiding this comment.
Added one for the transmute. Can't really think of anywhere else where its required.
|
The |
Author
|
@jhorstmann Agreed. |
| let z0 = half_swizzler(bytes0, bytes1, idxs0); | ||
| let z1 = half_swizzler(bytes0, bytes1, idxs1); | ||
|
|
||
| // SAFETY: Concatenation of two 32-element vectors to one 64-element vector |
Member
There was a problem hiding this comment.
this says what your doing, what it should say is why it's safe to use transmute like this. e.g.:
[Simd<u8, 32>; 2] and Simd<u8, 64> both have the same size (64) and no padding bytes, so transmuting is safe
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.
Implemented a 64 bit
swizzle_dynfor AVX2.Use case: Encountered this while implementing a chess move generator in rust with portable simd.
Would like an alternative suggestion for use of
mem::transmutehere.