Failure to compile with clang++ 20 on riscv64
$ clang++ -c -stdlib=libc++ -I. hwy/per_target.cc In file included from hwy/per_target.cc:28: In file included from ./hwy/highway.h:629: ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvlmax_e8mf8' 644 | HWY_RVV_FOREACH(HWY_RVV_LANES, Lanes, setvlmax_e, _ALL) | ^ ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e8mf8' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e8mf8' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvlmax_e16mf4' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e16mf4' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e16mf4' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvlmax_e32mf2' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e32mf2' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e32mf2' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvlmax_e64m1' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e64m1' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e64m1' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvlmax_e64m2' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e64m2' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e64m2' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvlmax_e64m4' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e64m4' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e64m4' ./hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvlmax_e64m8' fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated.
Hi, due to https://github.com/llvm/llvm-project/issues/56592 clang currently still requires a flag like -march=rv64gcv1p0. HTH?
Why does it work with clang++ 19 then?
The difference is that clang 20 started advertising support for __riscv_v_intrinsic, without which we do not attempt to use RVV.
Thanks for checking. 11000 used to be correct (0.11), but we can update to 1.0.
For reference, commit 6bd4bdded4fe666dc90872fd4472b967b6e5cd55 implies that Clang 20.1.x is now required when compiling for RISC-V, see: https://github.com/llvm/llvm-project/commit/05b3d26181ade32f5988d2be4939f605a5225782
Right. Unfortunately Clang had a breaking change with VXRM for which there was no feature test. Requiring 1.0 'fails safe' in that regard. You can override this by defining HWY_BASELINE_TARGETS directly.
@andreas-schwab and @jan-wassenberg, the issue was that Clang 20 and later on RISC-V define __riscv_v_intrinsic, even when the "V" extension is not enabled. I have implemented a fix in pull request #2586 that fixes this issue that checks that __riscv_v is also defined.
That's how it is supposed to be, see the RISC-V Vector C Intrinsic Specification:
Chapter 2. Test macro The __riscv_v_intrinsic macro is the C macro to test the compiler’s support for the RISC-V "V" extension intrinsics. This macro should be defined even if the vector extension is not enabled.
That's how it is supposed to be, see the RISC-V Vector C Intrinsic Specification:
Chapter 2. Test macro The __riscv_v_intrinsic macro is the C macro to test the compiler’s support for the RISC-V "V" extension intrinsics. This macro should be defined even if the vector extension is not enabled.
@andreas-schwab Thanks for pointing this out.
I have also made some additional changes to rvv_ops-inl.h and set_macros-inl.h in pull request #2587 that along with the changes in pull request #2586 allow Google Highway to be compiled for RISC-V with dynamic dispatch enabled with Clang 20 or later.
Thanks @johnplatts ! I believe this is now fixed, closing.
I have also made some additional changes to rvv_ops-inl.h and set_macros-inl.h in pull request #2587 that along with the changes in pull request #2586 allow Google Highway to be compiled for RISC-V with dynamic dispatch enabled with Clang 20 or later.
Could the RVV runtime dispatch check be fixed then? It is currently still disabled by && 0: https://github.com/google/highway/blob/master/hwy/detect_targets.h#L752
hm, if it's just a matter of removing the && 0 sure, but when I also remove gcv from the build flags, there are build failures with float16 sseg2 when building interleaved_test.