RFR: 8341880: RISC-V: riscv_vector.h native build fails with gcc13 after JDK-8320500

Fei Yang fyang at openjdk.org
Thu Oct 10 13:18:12 UTC 2024


On Thu, 10 Oct 2024 07:37:43 GMT, SendaoYan <syan at openjdk.org> wrote:

> Hi all,
> The file `src/jdk.incubator.vector/linux/native/libsleef/lib/vector_math_rvv.c` introduced by [JDK-8341880](https://bugs.openjdk.org/browse/JDK-8341880) native build fails by fedora OS shipped gcc13.
> Gcc13 doesn't have `__riscv_v_intrinsic` macro by default, and do have `__riscv_v_intrinsic` macro with option: `-march=rv64gcv`. So I think the CFLAGS should not set `-march=rv64gcv`, because gcc13 doesn't have `riscv_vector.h`.
> 
> ![image](https://github.com/user-attachments/assets/3bf8557d-d156-48a1-a762-44c1fa50a31c)
> 
> 
> gcc version infomation:
> 
> /usr/bin/gcc -v
> Using built-in specs.
> COLLECT_GCC=/usr/bin/gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/riscv64-redhat-linux/13/lto-wrapper
> Target: riscv64-redhat-linux
> Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-13.2.1-20230728/obj-riscv64-redhat-linux/isl-install --enable-gnu-indirect-function --with-arch=rv64gc --with-abi=lp64d --with-multilib-list=lp64d --build=riscv64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
> Thread model: posix
> Supported LTO compression algorithms: zlib zstd
> gcc version 13.2.1 20230728 (Red Hat 13.2.1-1) (GCC)
> 
> 
> Additonal testing:
> 
> - [x] riscv64 native release debug-level build with gcc13
> - [ ] riscv64 native fastdebug debug-level build with gcc13
> - [ ] riscv64 native release debug-level build with gcc14
> - [ ] riscv64 native fastdebug debug-level build with gcc14

FYI: I witnessed some different kinds of compile errors about libsleef while building with GCC version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) shipped with Ubuntu 24.04.1 LTS riscv64. Seems that GCC-13 doesn't have a good support for these RVV intrinsics as it does not recognize quite a few of them. If libsleef claims GCC-14+, maybe it's more reasonable to simply check the GCC version instead requiring 14+ when configuring openjdk? 


cc1: all warnings being treated as errors
gmake[3]: *** [Lib.gmk:48: /home/ubuntu/jdk/build/linux-riscv64-server-release/support/native/jdk.incubator.vector/libsleef/vector_math_rvv.o] Error 1
gmake[2]: *** [make/Main.gmk:191: jdk.incubator.vector-libs] Error 2
gmake[2]: *** Waiting for unfinished jobs....

ERROR: Build failed for target 'images' in configuration 'linux-riscv64-server-release' (exit code 2)

=== Output from failing command(s) repeated here ===
* For target support_native_jdk.incubator.vector_libsleef_vector_math_rvv.o:
In file included from /home/ubuntu/jdk/src/jdk.incubator.vector/linux/native/libsleef/lib/vector_math_rvv.c:41:
/home/ubuntu/jdk/src/jdk.incubator.vector/linux/native/libsleef/lib/../generated/sleefinline_rvvm1.h:1146:28: error: unknown type name ‘vfloat64m1x4_t’
 1146 | static SLEEF_ALWAYS_INLINE vfloat64m1x4_t __riscv_vcreate_v_f64m1x4(vfloat64m1_t x, vfloat64m1_t y, vfloat64m1_t z, vfloat64m1_t w) {
      |                            ^~~~~~~~~~~~~~
/home/ubuntu/jdk/src/jdk.incubator.vector/linux/native/libsleef/lib/../generated/sleefinline_rvvm1.h: In function ‘__riscv_vcreate_v_f64m1x4’:
/home/ubuntu/jdk/src/jdk.incubator.vector/linux/native/libsleef/lib/../generated/sleefinline_rvvm1.h:1147:5: error: unknown type name ‘vfloat64m1x4_t’; did you mean ‘vfloat64m4_t’?
 1147 |     vfloat64m1x4_t unused;
      |     ^~~~~~~~~~~~~~
      |     vfloat64m4_t
/home/ubuntu/jdk/src/jdk.incubator.vector/linux/native/libsleef/lib/../generated/sleefinline_rvvm1.h:1148:12: error: implicit declaration of function ‘__riscv_vset’; did you mean ‘__riscv_vlenb’? [-Werror=implicit-function-declaration]
 1148 |     return __riscv_vset(__riscv_vset(__riscv_vset(__riscv_vset(unused, 0, x), 1, y), 2, z), 3, w);
      |            ^~~~~~~~~~~~
      |            __riscv_vlenb
/home/ubuntu/jdk/src/jdk.incubator.vector/linux/native/libsleef/lib/../generated/sleefinline_rvvm1.h: At top level:
/home/ubuntu/jdk/src/jdk.incubator.vector/linux/native/libsleef/lib/../generated/sleefinline_rvvm1.h:1150:28: error: unknown type name ‘vfloat64m2x4_t’
   ... (rest of output omitted)

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

PR Comment: https://git.openjdk.org/jdk/pull/21442#issuecomment-2405067043


More information about the build-dev mailing list