linebender / linebender/fearless_simd

missing APIs vs std::simd

Open
#355 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
457
Forks
30
Avg merge
1d 10h
Merged PRs (30d)
25

Description

## Desirable, needs implementation (vectors)

- [x] `reduce_sum` https://github.com/linebender/fearless_simd/pull/357
- [x] `reduce_max`/`reduce_min` https://github.com/linebender/fearless_simd/pull/358

## Desirable, needs implementation (masks only)

- [x] Rotations https://github.com/linebender/fearless_simd/pull/360
- [ ] padded shifts

## Not investigated (TODO: move into another category)

- [ ] Horizontal bitwise reductions: `reduce_or`, `reduce_xor`, etc. #346
- [x] `reduce_product` https://github.com/linebender/fearless_simd/pull/361
- [ ] Signed int `saturating_abs`, `saturating_neg`, `is_positive`, `is_negative`, `signum`.
- [ ] `leading_zeros`, `trailing_zeros`, `leading_ones`, `trailing_ones` ([expensive emulation](https://chatgpt.com/share/6a9093b5-fe34-83eb-97d0-542ab698ee2b) but maybe still faster than scalar?)
- [ ] interleave and deinterleave on masks
- [ ] `to_degrees`, `to_radians` on floats
- [ ] Sign, NaN, infinity, finite, subnormal, and normal classification on floats
- [ ] `simd_clamp` on floats
- [ ] Ties-away-from-zero `round` on floats (round-ties-even is supported; ties away from zero has [poor hardware support](https://chatgpt.com/share/6a909862-5374-83ed-8b58-d263f5d23829))

## Compatibilty/convenience wrappers

Not sure if we should add all of these, the API surface is large enough as it is.

- [ ] `to_bits`/`from_bits` on floats (as an API compatibility wrapper around `bitcast`) https://github.com/linebender/fearless_simd/pull/370
- [x] `reverse` https://github.com/linebender/fearless_simd/pull/356
- [ ] `recip`
- [ ] `first_set`/`last_set` on masks (wrapper around `to_bitmask()` + scalar popcnt?)
- [ ] Boolean-scalar `&`, `|`, and `^` in either operand order on masks

## Tricky API questions

- [ ] `extract`
- [ ] `simd_swizzle!`
- [ ] generic `cast` between arbitrary same-lane-count vectors (we have explicit to_float/to_int and widen/narrow but not fully generic cast)
- [ ] lane-wise `abs_diff` that always needs to return unsigned values, and std doesn't implement for floats

## Not planned

- integer `div`, `rem`: no hardware support
- Masked load/store: `load_or_default`, `load_or`, `load_select` (only supported on AVX-512)
- Scatter/gather (impractically slow, often slower than scalar) #171
- Trigonometry, exponents, etc. (likely needs a separate crate with configurable trade-offs, not part of base fearless_simd)
- floating-point remainder: no hardware support, approximations available for special cases, [full support complex and expensive](https://chatgpt.com/share/6a9097ff-03d8-83eb-a15c-cc2f9d8493bc) (might bundle with trigonometry crate?)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the unchecked items in this checklist with the corresponding std::simd APIs, while noting the completed entries and linked pull requests. Choose one narrowly scoped missing API, then determine its implementation and verification points; done means the selected API is implemented and its behavior matches the intended std::simd compatibility.

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
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.