rust-lang / rust-lang/portable-simd
swizzle_dyn: variant where out-of-bounds indices return implementation-defined result
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.1k
- Forks
- 108
- Avg merge
- 22h 53m
- Merged PRs (30d)
- 3
Description
One of the swizzle variants is defined like this:
With zeroing_idxs being a function that sets the most significant bit to 1 (so that the result is 0) without touching the relevant least significant bits.
The problem is: there are situations where the user can guarantee that out-of-bounds indices always have the most significant bits set to 1, but there is no way to communicate it to swizzle_dyn, which will always waste performance with zeroing_idxs.
The only way to prevent the inefficiency is with a new function that doesn't call zeroing_idxs in the first place.
Similar situation with avx2_pshufb, which does pretty much the same thing.
Relevant: https://github.com/linebender/fearless_simd/pull/304.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with crates/core_simd/src/swizzle_dyn.rs at the linked definition, then inspect avx2_pshufb and the linked fearless_simd pull request for the related use case. Define the requested variant that avoids zeroing_idxs when callers guarantee the high bits of out-of-bounds indices, covering both relevant swizzle paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100