Hacker News new | ask | show | jobs
by twic 605 days ago
It's possibly worth mentioning that Java is getting a vector API which explicitly abstracts over some of the details of SIMD, including width. You have a type Vector<T> which represents enough of some type T to fill a vector register (eg eight 32-bit numbers in a 256-bit register), operations on Vector<T> which produce another Vector<T>, and some way to break arrays up into Vectors of the right size for the platform. The API is a bit clunky, but you write code with it, the compiler performs a miracle, and efficient platform-specific vector code comes out.

https://docs.oracle.com/en/java/javase/23/docs/api/jdk.incub...

https://docs.oracle.com/en/java/javase/23/docs/api/jdk.incub...

1 comments

Though it's pretty much incubating forever, or until Valhalla, whichever comes first.