rust-lang / rust-lang/portable-simd
Add `{u32,f32,...}xN` shorthand types for `Simd<{u32,f32,...}, N>`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.1k
- Forks
- 108
- Avg merge
- 22h 53m
- Merged PRs (30d)
- 3
Description
Shorthand types that are generic over lane count:
type u32xN<const N: usize> = Simd<u32, N>;
type f32xN<const N: usize> = Simd<f32, N>;
type u64xN<const N: usize> = Simd<u64, N>;
type f64xN<const N: usize> = Simd<f64, N>;
// etc.
I've found it easier to write these compared to Simd<u32, N> (which I find quite noisy).
And possibly the inverse, although not as useful(?):
type Tx1<T> = Simd<T, 1>;
type Tx2<T> = Simd<T, 2>;
type Tx4<T> = Simd<T, 4>;
type Tx8<T> = Simd<T, 8>;
// etc.
This would be used in code that is generic over lane count, for example:
fn multiply_add<const N: usize>(x: f32xN<N>, y: f32xN<N>, z: f32xN<N>) -> f32xN<N>
where LaneCount<N>: SupportedLaneCount
{
x * y + z
}
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 the proposed u32xN and f32xN aliases and the possible TxN inverse aliases in the issue. Determine which shorthand forms belong in the portable SIMD API and how they should behave for generic lane counts. Done means the accepted shorthand types are exposed with suitable coverage for the shown generic usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100