4 ms·
People claim that the JVM is able to auto-vectorize simple loops: https://stackoverflow.com/questions/59725341/java-auto-vectorization-example https://stackover
by tralarpa 5y ago
People claim that the JVM is able to auto-vectorize simple loops:
https://stackoverflow.com/questions/59725341/java-auto-vectorization-example https://stackoverflow.com/questions/59725341/java-auto-vecto...
That said, I tried the matrix-multiplication example from section 1.2 on different computers and with different jdk version, but I didn't manage to convince the JVM JIT to emit SIMD instructions. No idea whether the loop is too complex for the JIT or whether there is some secret JVM option that I'm not aware of.
- sereja 5y agoIt is not technically legal to use SIMD on most floating-point loops, including the inner product in matrix multiplication, because rounding errors are not commutative. C compilers don't vectorize such loops either unless you pass the -ffast-math flag. I'm sure the JIT compiler of JVM has a similar option. (read the article I linked below, it's all explained there)