r/programming • • 5d ago

The state of SIMD in Rust in 2026

https://shnatsel.github.io/state-of-simd-rust-2026/
152 Upvotes

10 comments sorted by

26

u/alexeyr 5d ago

Non-Rust part at the end: Bonus round: The state of hardware.

23

u/xADDBx 4d ago

> This year, at long last, AVX-512 is becoming mandatory in upcoming Intel CPUs via its rebranding into AVX 10.2.

From what I know AVX10 is a lot more than just rebranding and might’ve deserved its own section. Though this post made me look up the news again and I'm glad they decided to throw away the 256 E Core idea

15

u/alexeyr 4d ago

Wikipedia says

The first version of AVX10, notated AVX10.1, does not introduce any instructions or encoding features beyond what is already in AVX-512

Maybe that's what he meant by rebranding?

17

u/[deleted] 4d ago

[removed] — view removed comment

3

u/FrogNoPants 3d ago edited 3d ago

ARM hasn't remotely caught up on SIMD width, they are basically all 128 wide.

The author also appears to not be particularly experience in SIMD, AVX2 is actually quite easy to work with, has most features you would want, and the missing ops can all be emulated fairly easily. Meanwhile Neon is missing basic stuff like movemask.

8

u/juhotuho10 3d ago

AVX2 has some missing pieces when you actually try and use it in the real world that just make it annoying to use in general, and most of the missing pieces are in AVX512, like reduction operators, dealing with branches or easier way to do calculations with tail values

7

u/ack_error 3d ago

AVX has a couple of headaches that NEON doesn't.

SSE-AVX transitions are the most annoying part. All AVX code paths has to be careful to execute VZEROUPPER before returning, or else legacy SSE code paths might be slowed down. This penalty can be huge, I've seen SSE2 code run at quarter speed on Intel CPUs due to this issue. The result is that unless you're fortunate enough to have the entire OS compiled for AVX, you have to pepper VZEROUPPER everywhere. x86 had previous left this kind of annoying state transition behind with MMX/EMMS and Intel brought it back again with AVX.

The second problem is AVX lane switching penalties. AVX isn't an orthogonal 256-bit design, it behaves more as 128-bit lanes laminated together. VPALIGNR, for instance, doesn't do an extended shift on 256-bit vectors, it does 2 x 128-bit extended shifts, and VPSADBW computes 2 x 128-bit horizontal adds. Compounding this, cross-lane operations are also expensive at 3 cycles latency. This means that 128-bit SSE algorithms often don't cleanly extend to 256-bit AVX2.

It's true that NEON is missing some things like movemask, convenient general shuffles, and negated FMA (#$&*). But it also has a lot of nice features that AVX doesn't. Many operations like fused multiply/add can implicitly broadcast a source lane, so NEON code can pack constants more tightly than AVX code that has to burn registers on pre-splatted constants. Narrowing/widening and pairwise accumulation make it easier to use smaller lane sizes. Load/store operations can implicitly interleave or deinterleave. Cheap horizontal add/min/max. Rounding and saturation as options when narrowing. More flexible table lookup. And almost all of it is base ISA.

That being said, this flexibility has generally come at the cost of higher latencies (2-3c for NEON integer ops instead of 1c for SSE/AVX), and there are signs that ARM has adopted some AVX-like designs in SVE. Pack/unpack in SVE works even/odd elements instead of compacted input/output, for instance.