News for hackers. Stuff that matters.
Re:Hardware Intrinsics in .NET 8 by doikor on Tuesday December 19, 2023 @06:27AM (#38694342)
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

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)

Re:Hardware Intrinsics in .NET 8 by Const-me on Tuesday December 19, 2023 @08:03AM (#38694994)
Vector 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.
Re:Hardware Intrinsics in .NET 8 by doikor on Tuesday December 19, 2023 @08:11AM (#38695070)
Yeah 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.

Re:Hardware Intrinsics in .NET 8 by hajile on Tuesday December 19, 2023 @10:13AM (#38696547)
This 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.
Re:Hardware Intrinsics in .NET 8 by Const-me on Tuesday December 19, 2023 @11:16AM (#38697456)
For 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 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.

Re:Hardware Intrinsics in .NET 8 by pjmlp on Tuesday December 19, 2023 @07:53AM (#38694914)
Some alternative implementations like PTC and Aicas do, for the Real Time Java implementation.