linebender / linebender/fearless_simd
Shuffle/swizzle operations
A pull request for this has already been merged.
- #276 by @Shnatsel — merged
- Dominant language
- Rust
- Stars
- 457
- Forks
- 30
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 25
Description
I'd like to replace my [homegrown SIMD implementation](https://github.com/valadaptive/ntsc-rs/blob/93e533d2564d86b283ca22f119db34b538a33049/crates/ntscrs/src/f32x4.rs) with this crate. My use case requires support for a "shuffle" / "swizzle" / "permute" operation, which this crate currently doesn't appear to have.
One obstacle I encountered when implementing shuffles in my SIMD implementation is that different architectures' intrinsics take different types for shuffle indices (they differ in signedness and size), so we can't use const generics to specify them currently. However, LLVM appears to optimize constant permutes into shuffle instructions.
My thought is to give each SIMD type an associated `Indices` type (name not final), which is like its `Mask` or `Block` types, and is a `[usize; N]`. A shuffle function would take it as input.
Contributor guide
No contributing guide indexed for this repository
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
Review the linked merged pull request #276 first, then compare its implementation with the referenced crates/ntscrs/src/f32x4.rs SIMD code. Check how shuffle, swizzle, or permute indices are represented across SIMD types and verify that the resulting API covers the requested operation.
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
- 25/100