‹ BackHN Continuity

Thread

The state of SIMD in Rust in 2026

209 points · 65 comments · verdagon

  1. Archit3ch · · focus · HN ↗
    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. ;)

    1. louthy · · focus · HN ↗
      > there is no portable SIMD

      Except in languages with a JIT compiler

      1. marginalia_nu · · focus · HN ↗
        That still just gets you autovectorization, and generally locks you out of the performance you could have with direct SIMD intrinsics.

        Granted, the number of cases this distinction matters is relatively small, making a function faster only makes a program appreciably faster if that function is a bottleneck.

        1. louthy · · focus · HN ↗
          > That still just gets you autovectorization

          Erm, not sure how direct you want. But at least in dotnet you can use the Vector64, Vector128, Vector256, and Vector512 types [1] where each method gets effectively directly converted to a raw SIMD instruction. So, Vector512.LoadAligned call will be replaced with a raw SIMD register load instruction - supported by the CPU it is running on; and generally a JIT compiler will spot common patterns-of-use to optimise those too. There's no runtime check to see what is supported and no per-function-branching. It's as close to the CPU as you can get really (in a compiled language). Maybe I'm missing something?

          If you just mean the difference between hand-coded assembly and the output of an optimising compiler, then sure, you can always be better with hand-coded assembly.

          [1] <a href="https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;api&#x2F;system.runtime.intrinsics?view=net-10.0" rel="nofollow">https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;api&#x2F;system.runtime....

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.