RFR: 8312425: [vectorapi] AArch64: Optimize vector math operations with SLEEF [v4]
Robbin Ehn
rehn at openjdk.org
Thu Mar 28 17:15:35 UTC 2024
On Mon, 25 Mar 2024 15:13:54 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
>>
>> fix jni includes
>
>> > > But that raises an interesting question. What happens if you try to load a library compiled with `-march=armv8-a+sve` on a non-SVE system? Is the ELF flagged to require SVE so it will fail to load? I'm hoping this is the case -- if so, everything will work as it should in this PR, but I honestly don't know. (After spending like 10 years working with building, I still discover things I need to learn...).
>> >
>> >
>> > I think we can handle it, when a jdk built with sve support runs on a non-sve machine, the sve related code will not be executed with the protection of UseSVE vm flag which is detected at runtime startup.
>>
>> First of all, my question was of a more general nature. Is there such a mechanism in the dynamic linker that protects us from loading libraries that will fail if an ISA extension is used that is missing on the running system? Or do the linker just check that the ELF is for the right CPU?
>
> That shouldn't matter to us. If the machine we're running on doesn't support what we need, why should we even try to open it?
>
>> Secondly, I assume that libsleef.so proper needs to be compiled with SVE support as well. So if we were to skip the shim vectormath library and load libsleef directly from hotspot, what would happen then?
>>
>> Thirdly, the check with UseSVE happens _after_ you load the library.
>
> At best that's a waste of time during startup.
> 2. depends on external sleef at run time only, like @theRealAph suggested. Cons: requires sleef installed in system at runtime
> 3. depends on external sleef at build time only, like @magicus suggested. Cons: requires sleef installed in system at build time
It seem like everyone wants sleef as a "backend".
As we have hard time, at least now, integrating sleef, and doing both or one above, doesn't interfere with such integration.
And it doesn't hurt anyone if Hamlin is willing to put in the effort.
I'd say go head with something like that.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18294#issuecomment-2025721135
More information about the build-dev
mailing list