3 ms·
The Java code is impressively written, using newer features like MemorySegment. Looked at the author and realized it's Alfonso from the Graal team -- makes sen
by gavinray 3y ago
The Java code is impressively written, using newer features like MemorySegment.
Looked at the author and realized it's Alfonso from the Graal team -- makes sense.
I wonder whether the "matmul" code could be further optimized with the Vector API and SIMD.
- kurhan 3y agoAlso new virtual threads might be beneficial. I was experimenting using Vector api for matrix multiplication once and effect was pretty good.
- mike_hearn 3y agoVirtual threads shouldn't help as the program isn't I/O or wait bottlenecked. It's a pure computation, so it's all about vectorization here.
- mukel 3y agoAuthor here: I implemented several versions of matmul with different unrolling schemes using the Vector API and I got a ~4X speedup with a single thread, but the speedup fades the more threads you add. I think that performance is constrained by memory bandwidth which is saturated with a small number of threads, regardless of vectorization.