On Thu, 23 Nov 2023 08:57:23 GMT, Xiaohong Gong <xg...@openjdk.org> wrote:
>> Currently the vector floating-point math APIs like >> `VectorOperators.SIN/COS/TAN...` are not intrinsified on AArch64 platform, >> which causes large performance gap on AArch64. Note that those APIs are >> optimized by C2 compiler on X86 platforms by calling Intel's SVML code [1]. >> To close the gap, we would like to optimize these APIs for AArch64 by >> calling a third-party vector library called libsleef [2], which are >> available in mainstream Linux distros (e.g. [3] [4]). >> >> SLEEF supports multiple accuracies. To match Vector API's requirement and >> implement the math ops on AArch64, we 1) call 1.0 ULP accuracy with FMA >> instructions used stubs in libsleef for most of the operations by default, >> and 2) add the vector calling convention to apply with the runtime calls to >> stub code in libsleef. Note that for those APIs that libsleef does not >> support 1.0 ULP, we choose 0.5 ULP instead. >> >> To help loading the expected libsleef library, this patch also adds an >> experimental JVM option (i.e. `-XX:UseSleefLib`) for AArch64 platforms. >> People can use it to denote the libsleef path/name explicitly. By default, >> it points to the system installed library. If the library does not exist or >> the dynamic loading of it in runtime fails, the math vector ops will >> fall-back to use the default scalar version without error. But a warning is >> printed out if people specifies a nonexistent library explicitly. >> >> Note that this is a part of the original proposed patch in panama-dev [5], >> just with some initial review comments addressed. And now we'd like to get >> some wider feedbacks from more hotspot experts. >> >> [1] https://github.com/openjdk/jdk/pull/3638 >> [2] https://sleef.org/ >> [3] https://packages.fedoraproject.org/pkgs/sleef/sleef/ >> [4] https://packages.debian.org/bookworm/libsleef3 >> [5] https://mail.openjdk.org/pipermail/panama-dev/2022-December/018172.html > > Xiaohong Gong has updated the pull request incrementally with one additional > commit since the last revision: > > Address review comments in build system make/autoconf/lib-vmath.m4 line 58: > 56: test -e ${with_libsleef}/include/sleef.h; then > 57: LIBSLEEF_FOUND=yes > 58: LIBVMATH_LIBS="-L${with_libsleef}/lib" Suggestion: LIBVMATH_LIBS="-L${with_libsleef}/lib -lsleef" make/autoconf/lib-vmath.m4 line 70: > 68: if test "x$SYSROOT" = "x" && > 69: test "x${LIBSLEEF_FOUND}" = "xno"; then > 70: PKG_CHECK_MODULES([LIBSLEEF], [sleef], [LIBSLEEF_FOUND=yes], > [LIBSLEEF_FOUND=no]) Suggestion: PKG_CHECK_MODULES([SLEEF], [sleef], [LIBSLEEF_FOUND=yes], [LIBSLEEF_FOUND=no]) Otherwise `PKG_CHECK_MODULES` will set the variables LIBSLEEF_CFLAGS and LIBSLEEF_LIBS. make/autoconf/lib-vmath.m4 line 74: > 72: if test "x${LIBSLEEF_FOUND}" = "xno"; then > 73: AC_CHECK_HEADERS([sleef.h], > 74: [LIBSLEEF_FOUND=yes], Suggestion: [ LIBSLEEF_FOUND=yes SLEEF_LIBS=-lsleef ], make/autoconf/lib-vmath.m4 line 89: > 87: if test "x${LIBSLEEF_FOUND}" = "xyes"; then > 88: ENABLE_LIBSLEEF=true > 89: LIBVMATH_LIBS="${LIBVMATH_LIBS} -lsleef" Remove this line. It would just add `-lsleef` twice if you go via `PKG_CHECK_MODULES`. You need to set -lsleef at the correct places. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16234#discussion_r1403436252 PR Review Comment: https://git.openjdk.org/jdk/pull/16234#discussion_r1403433087 PR Review Comment: https://git.openjdk.org/jdk/pull/16234#discussion_r1403438730 PR Review Comment: https://git.openjdk.org/jdk/pull/16234#discussion_r1403437474