RFR: 8312425: [vectorapi] AArch64: Optimize vector math operations with SLEEF [v4]
Andrew Haley
aph at openjdk.org
Mon Mar 25 15:16:25 UTC 2024
On Fri, 15 Mar 2024 13:58:05 GMT, Hamlin Li <mli at openjdk.org> wrote:
>> Hi,
>> Can you help to review this patch?
>> Thanks
>>
>> This is a continuation of work based on [1] by @XiaohongGong, most work was done in that pr. In this new pr, just rebased the code in [1], then added some minor changes (renaming of calling method, add libsleef as extra lib in CI cross-build on aarch64 in github workflow); I aslo tested the combination of following scenarios:
>> * at build time
>> * with/without sleef
>> * with/without sve support
>> * at runtime
>> * with/without sleef
>> * with/without sve support
>>
>> [1] https://github.com/openjdk/jdk/pull/16234
>>
>> ## Regression Test
>> * test/jdk/jdk/incubator/vector/
>> * test/hotspot/jtreg/compiler/vectorapi/
>>
>> ## Performance Test
>> Previously, @XiaohongGong has shared the data: https://github.com/openjdk/jdk/pull/16234#issuecomment-1767727028
>
> 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.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18294#issuecomment-2018241520
More information about the build-dev
mailing list