Hacker News new | ask | show | jobs
by louthy 66 days ago
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] https://learn.microsoft.com/en-us/dotnet/api/system.runtime....

1 comments

Definitely, and in Java's case there are plenty JVM implementations to chose from, which widens what is possible.
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 'general', how is that achieved? Or, do you just mean there's more implementations of the JVM itself and because of that there's choice?
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.

Got it. Thanks for the clarification!