[VectorAPI] Enhancement of floating-point math vector API implementation

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Fri Jan 6 22:10:36 UTC 2023


>> As an idea for an incremental improvement, consider lifting native library linkage code from JVM into JDK code and refactor corresponding intrinsics (require new ones I believe) to accept the specialized entry point address of the correspoding vectorized math routine (instead of the operation code). Then C2 could use the address to generate direct leaf call into the stub.
>>
>> That would allow to make JVM code library-agnostic and abstract away all the differences between SVML and SLEEF libraries (and, in the future, any other library added as a backing implementation).
>>
>> On JDK level multiple plug-in implementations could be supported and the final decision what implementation to use is performed at runtime depending on the presence of required libraries or user choice.
>>
> 
> Yes, users could plug in using service providers. We would need to be careful about potential abuses. Might need to be gated, perhaps by Panama’s command --enable-native-access flag.

Service provides look very promising.

IMO it's fine to forbid non-trusted providers initially (in other words, 
all supported providers should be bundled with the JDK).

In the end, Vector API implementation should just call method handles 
prepared by Foreign Linker API for native vector math routines from some 
native library (SVML, SLEEF, or something else). It can be hidden behind 
a service interface which returns a MethodHandle when requested 
particular math operation of particular shape.

Best regards,
Vladimir Ivanov


More information about the panama-dev mailing list