3 ms·
I really wish JDK had some API for hardware intrinsics. Hopefully we get something soon as the Vector API is coming (7th incubator version rolling on) https://
by doikor 3y ago
I really wish JDK had some API for hardware intrinsics.
Hopefully we get something soon as the Vector API is coming (7th incubator version rolling on) https://openjdk.org/jeps/460 https://openjdk.org/jeps/460
Though the Vector API is pending on Valhalla to get far enough (it won't leave incubator until the necessary parts of Valhalla are in preview stage)
- pjmlp 3y agoSome alternative implementations like PTC and Aicas do, for the Real Time Java implementation.
- Const-me 3y agoVector API is very far from being hardware intrinsics. Unfortunately for Java programmers, it’s merely a least common denominator of SIMD instructions across different ISAs. This makes the feature very limited by design, IMO borderline useless.
- doikor 3y agoYeah while not great it is still a step in the right direction (giving control to the developer). Before this in the OpenJDK the developer had exactly 0 control. You just wrote code and hoped JDK would slap in vectorization etc.
- hajile 3y agoThis depends on the implementation under the hood and I'd say that the ability to use SIMD even at less than peak efficiency is better than not being able to use it at all.
- Const-me 3y agoFor some problems, sticking to the SIMD subset exposed to Java might be slower than no SIMD at all. Example: https://news.ycombinator.com/item?id=36624240 https://news.ycombinator.com/item?id=36624240 The linked C++ code is easily portable to C# because hardware intrinsics, but not to Java because nothing similar to _mm256_sad_epu8 is available there.