‹ 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. pletnes · · focus · HN ↗
        Which JIT languages use much simd in generated code, in general?
        1. louthy · · focus · HN ↗
          C# definitely does [1] and has intrinsics that allow auto-fallback (in the JIT compilation phase) to the most supported SIMD instructions (and in-software implementation if non are); it has a lot of low-level coding primitives that are picked up by the JIT compiler and optimised. I would assume JVM based languages too.

          [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....

          1. pjmlp · · focus · HN ↗
            Definitely, and in Java&#x27;s case there are plenty JVM implementations to chose from, which widens what is possible.
            1. louthy · · focus · HN ↗
              How does the JVM spot that the implementations should be converted to direct SIMD instructions? On dotnet, MS have the [Intrinsic] method-attribute that allows them to mark certain methods that the JIT knows about and do a compile-time replacement. With the JVM being a bit more &#x27;general&#x27;, how is that achieved? Or, do you just mean there&#x27;s more implementations of the JVM itself and because of that there&#x27;s choice?
              1. pjmlp · · focus · HN ↗
                I mean you get Hotspot on regular OpenJDK, Amazon and Microsoft OpenJDK forks have their own JIT downstream changes, Falcon on Azul, OpenJ9, PTC, Aicas,...

                Azul and OpenJ9 additionally have server JITs, which widen the abilities of optimisations are available.

                Additionally the ART cousin also does its own thing.

                Each JVM implementation has its own approach how to do auto-vectorisation or mark intrinsic methods.

                It is no different than talking about Ada, Fortran, COBOL, C, C++ and co compilers versus what ISO defines in the language standard.

                1. louthy · · focus · HN ↗
                  Got it. Thanks for the clarification!
        2. [deleted] · · focus · HN ↗

          [deleted]

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.