RFR: 8312425: [vectorapi] AArch64: Optimize vector math operations with SLEEF [v4]

Magnus Ihse Bursie ihse at openjdk.org
Mon Mar 25 09:27:26 UTC 2024


On Fri, 22 Mar 2024 15:30:35 GMT, Hamlin Li <mli at openjdk.org> wrote:

> > 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.

You misunderstand me; perhaps I'm not clear enough here.

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?

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. If there is a DL verification, you will not even reach this check, but get a DLL loading failure before that. Sure, regardless of which happens, you will not execute bad code, but I'd like to know which is the case.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18294#issuecomment-2017553490


More information about the build-dev mailing list