RFR: 8312425: [vectorapi] AArch64: Optimize vector math operations with SLEEF [v4]
Patrick Zhang
qpzhang at openjdk.org
Wed Nov 20 07:56:31 UTC 2024
On Fri, 22 Mar 2024 15:30:35 GMT, Hamlin Li <mli at openjdk.org> wrote:
> > > Ah, it'll only be the redirect library that's compiled with -march=armv8-a+sve Forget that.
> >
> >
> > 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.
I think we should not have specified any `-march=Xxx` option here in `make/autoconf/flags-cflags.m4` under `AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP]`. It generates conflicts when a user builds JDK with relevant flags in `--with-extra-cflags=-march=Xxx`. Moreover, above `-march=armv8-a+sve` can accidentally overwrite `-mcpu=Xxx` or `-mtune=Xxx` contents if a user specified in configure cmdline, because `-march` is of higher priority for a toolchain deciding what uarch/cost-model/instructions would be used.
The configure sequence can be briefly described as below:
> 1. FLAGS_PRE_TOOLCHAIN ->
> FLAGS_SETUP_USER_SUPPLIED_FLAGS
> AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags], [extra flags to be used when compiling jdk c-files])])
> (For example, we specify **--with-extra-cflags="-march=armv8.2a+fp16"**)
>
> 2. FLAGS_SETUP_FLAGS
> -> FLAGS_SETUP_CFLAGS
> -> FLAGS_SETUP_CFLAGS_CPU_DEP
> CFLAGS="$CFLAGS **-march=armv8-a+sve"**
The later one will modify/overwrite the former one that the user is really building for. @Hamlin-Li @magicus @theRealAph
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18294#issuecomment-2487793664
More information about the build-dev
mailing list