rust-random / rust-random/rand
Simd & fill optimizations
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 512
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 7
Description
#1579 notes some unfinished business:
The
Simdandm128ietc. type generation should be equivalent, but they're not in terms of code; theSimdimpls currently usefillto avoid moreunsafecode here.Notice from the above that
u32x4,u16x8andu8x16are the same size asu128andm128ibut cost about twice as much to generate here. This indicates thefillcode may be sub-optimal.Additionally, the
m128iimpl performed even worse when transmuting au128value (~4.3ns or +%130) which, as far as I can tell, is purely because theu128value is returned viarax, rdxwhile the__m128ivalue is returned viardx, r10(withraxequal to the struct address). I don't understand this.
Optimizing Fill for such cases may not be possible without specialization, and even then it's unclear if we'd want to due to the implied value-breaking changes.
Optimizing SIMD impls would require either specialization or replacing the generic Simd<$ty, LANES> impls with a (large) number of specific impls.
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
Start with issue #1579 and compare the generic Simd<$ty, LANES> and m128i implementations, including their fill behavior and reported generation costs. Investigate the compiler output and transmute performance described here. Done requires a decided, validated approach to the SIMD and fill optimizations, but this issue names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100