The state of SIMD in Rust in 2026

(shnatsel.github.io)

44 points | by verdagon 2 days ago

3 comments

  • the__alchemist 7 minutes ago
    I am using my own lib, `lin_alg`, which apes core_simd for floating point values, and extends the concept to vectors and quaternions. I will eventually replace the floating point portions with core::simd upon its arrival in stable Rust.

    Downside: It's currently x86 only.

  • Archit3ch 1 hour ago
    Hot take: there is no portable SIMD.

    You can either have performance (=write manual ASM for each platform), or portability, but not both.

    What so-called "portable SIMD" libraries give you is "portable auto-vectorization". "Portable performance" is a global property of the algorithm. Relying on auto-vectorization will result in e.g. sub-optimal register spills in practice. The microbenchmarks will look great, though. ;)

    • the__alchemist 6 minutes ago
      I agree with that historically auto-vertorization does not seem to work reliably. I'm not sure about your broad claim.

      Thoughts on an abstraction over ARM and x86, at 128, 256, and 512-bit widths which, either in a manual or automatic way (The latter more challenging) makes your floating point computations 4-16x faster with minimal restructuring? I think that's doable, and a nice goal of SIMD.

    • Sharlin 57 minutes ago
      Getting 2x or 4x performance in your inner loops using a reasonable SIMD library is infinitely better than theoretically getting 8x performance with hand-coded nonportable intrinsics, because the latter is never going to happen in most programs, so the actual point of comparison is scalar code, or autovectorized code at best.
    • louthy 1 hour ago
      > there is no portable SIMD

      Except in languages with a JIT compiler

      • Tanjreeve 54 minutes ago
        Starts to get a bit philosophical on what constitutes "portable" but JIT compilers would emit an opcode based off of whatever the frontend/IR is saying to do surely?
    • IshKebab 42 minutes ago
      It's a continuum. Some things basically all SIMD implementations support. Want to add 2 4xf32 vectors together? That's pretty easy to do portably.

      But yeah to be fair if you are at that point, you probably want to go fully non-portable anyway. Especially with AI.

      Has anyone even figured out how to do vector stuff (SVE/RVV) without assembly?

    • Scene_Cast2 1 hour ago
      What about numpy, numba, and torch.compile?
      • izacus 30 minutes ago
        Those are manually optimized per arch, aren't they?
  • justmeeew 1 hour ago
    [flagged]