RFR: 8353786: Migrate Vector API math library support to FFM API [v10]
Vladimir Ivanov
vlivanov at openjdk.org
Thu Apr 17 18:03:47 UTC 2025
> Migrate Vector API math library (SVML and SLEEF) linkage from native code (in JVM) to Java FFM API.
>
> Since FFM API doesn't support vector calling conventions yet, migration affects only symbol lookup for now. But it still enables significant simplifications on JVM side.
>
> The patch consists of the following parts:
> * on-demand symbol lookup in Java code replaces eager lookup from native code during JVM startup;
> * 2 new VM intrinsics for vector calls (support unary and binary shapes) (code separated from unary/binary vector operations);
> * new internal interface to query supported CPU ISA extensions (`jdk.incubator.vector.CPUFeatures`) used for CPU dispatching.
>
> `java.lang.foreign` API is used to perform symbol lookup in vector math library, then the address is cached and fed into corresponding JVM intrinsic, so C2 can turn it into a direct vector call in generated code.
>
> Once `java.lang.foreign` supports vectors & vector calling conventions, VM intrinsics can go away.
>
> Performance is on par with original implementation (tested with microbenchmarks on linux-x64 and macosx-aarch64).
>
> Testing: hs-tier1 - hs-tier6, microbenchmarks (on linux-x64 and macosx-aarch64)
>
> Thanks!
Vladimir Ivanov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 24 additional commits since the last revision:
- Merge remote-tracking branch 'origin/master' into vector.math.01.java
- RVV and SVE adjustments
- fix broken merge
- Merge branch 'master' into vector.math.01.java
- Fix debugName handling
- Merge branch 'master' into vector.math.01.java
- RVV and SVE adjustments
- Merge branch 'master' into vector.math.01.java
- Fix windows-aarch64 build failure
- features_string -> cpu_info_string
- ... and 14 more: https://git.openjdk.org/jdk/compare/bba47808...88eacc48
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/24462/files
- new: https://git.openjdk.org/jdk/pull/24462/files/e2b762ec..88eacc48
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=24462&range=09
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=24462&range=08-09
Stats: 5947 lines in 148 files changed: 5156 ins; 446 del; 345 mod
Patch: https://git.openjdk.org/jdk/pull/24462.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24462/head:pull/24462
PR: https://git.openjdk.org/jdk/pull/24462
More information about the hotspot-dev
mailing list