xtensor-stack / xsimd

C++ wrappers for SIMD intrinsics and parallelized, optimized mathematical functions (SSE, AVX, AVX512, NEON, SVE))
https://xsimd.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.15k stars 253 forks source link

GCC14 build error on RVV (no error on Clang17) #1046

Closed jongsung7707 closed 2 weeks ago

jongsung7707 commented 3 weeks ago

Hello,

I tried to build tests using RVV by setting BUILD_TESTS=on, but failed when I used GCC14. I built GCC toolchain from https://github.com/riscv-collab/riscv-gnu-toolchain.

I can fix the "error: 'riscv_rvv_vector_bits' requires an integer constant" but I can't understand the below error. Could you help how to fix this?

error: explicit specialization in non-namespace scope 'struct xsimd::types::detail::rvv_type_info<signed char, 4096>'

Log:

In file included from /home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_all_registers.hpp:46,
                 from /home/jongsung/github/xsimd/include/xsimd/memory/../config/xsimd_arch.hpp:19,
                 from /home/jongsung/github/xsimd/include/xsimd/memory/xsimd_aligned_allocator.hpp:27,
                 from /home/jongsung/github/xsimd/include/xsimd/xsimd.hpp:57,
                 from /home/jongsung/github/xsimd/test/test_api.cpp:12:
/home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:89:77: error: 'riscv_rvv_vector_bits' requires an integer constant
   89 |         using fixed_type = type __attribute__((riscv_rvv_vector_bits(width)));            \
      |                                                                             ^
/home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:106:5: note: in expansion of macro 'XSIMD_RVV_MAKE_TYPE'
  106 |     XSIMD_RVV_MAKE_TYPE(int8_t, i, 8, vmul)    \
      |     ^~~~~~~~~~~~~~~~~~~
/home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:117:13: note: in expansion of macro 'XSIMD_RVV_MAKE_TYPES'
  117 |             XSIMD_RVV_MAKE_TYPES(8)
      |             ^~~~~~~~~~~~~~~~~~~~
In file included from /home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_all_registers.hpp:46,
                 from /home/jongsung/github/xsimd/include/xsimd/memory/../config/xsimd_arch.hpp:19,
                 from /home/jongsung/github/xsimd/include/xsimd/memory/xsimd_aligned_allocator.hpp:27,
                 from /home/jongsung/github/xsimd/include/xsimd/xsimd.hpp:57,
                 from /home/jongsung/github/xsimd/test/test_api.cpp:12:
/home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:89:77: error: 'riscv_rvv_vector_bits' requires an integer constant
   89 |         using fixed_type = type __attribute__((riscv_rvv_vector_bits(width)));            \
      |                                                                             ^
/home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:106:5: note: in expansion of macro 'XSIMD_RVV_MAKE_TYPE'
  106 |     XSIMD_RVV_MAKE_TYPE(int8_t, i, 8, vmul)    \
      |     ^~~~~~~~~~~~~~~~~~~
/home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:117:13: note: in expansion of macro 'XSIMD_RVV_MAKE_TYPES'
  117 |             XSIMD_RVV_MAKE_TYPES(8)
      |             ^~~~~~~~~~~~~~~~~~~~
/home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:96:19: error: explicit specialization in non-namespace scope 'struct xsimd::types::detail::rvv_type_info<signed char, 4096>'
   96 |         template <>                                                                       \
      |                   ^
/home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:106:5: note: in expansion of macro 'XSIMD_RVV_MAKE_TYPE'
  106 |     XSIMD_RVV_MAKE_TYPE(int8_t, i, 8, vmul)    \
      |     ^~~~~~~~~~~~~~~~~~~
/home/jongsung/github/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:117:13: note: in expansion of macro 'XSIMD_RVV_MAKE_TYPES'
  117 |             XSIMD_RVV_MAKE_TYPES(8)
      |             ^~~~~~~~~~~~~~~~~~~~
serge-sans-paille commented 3 weeks ago

@luhenry any guess?

serge-sans-paille commented 3 weeks ago

It looks like GCC doesn't support constexpr as attribute parameter... I can reproduce on godbolt: https://godbolt.org/z/e56ffeTdh

serge-sans-paille commented 3 weeks ago

Bug opened on gcc for the constexpr part: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116484

jongsung7707 commented 2 weeks ago

This issue seems not to be fixed soon and I think it's better to close(or any other state) the issue now.