xtensor-stack/xsimd

Clang18 build error on RVV (no error on Clang17)

zqb-all opened this issue · 5 comments

When build with clang-18, error message:

Consolidate compiler generated dependencies of target test_xsimd
[  2%] Building CXX object test/CMakeFiles/test_xsimd.dir/main.cpp.o
[  5%] Building CXX object test/CMakeFiles/test_xsimd.dir/test_api.cpp.o
In file included from /home/mark/workspace/xsimd/test/test_api.cpp:12:
In file included from /home/mark/workspace/xsimd/include/xsimd/xsimd.hpp:57:
In file included from /home/mark/workspace/xsimd/include/xsimd/memory/xsimd_aligned_allocator.hpp:27:
In file included from /home/mark/workspace/xsimd/include/xsimd/memory/../config/xsimd_arch.hpp:19:
In file included from /home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_all_registers.hpp:46:
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:117:13: error: no matching function for call to '__riscv_vreinterpret_u8m8'
  117 |             XSIMD_RVV_MAKE_TYPES(8)
      |             ^~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:106:5: note: expanded from macro 'XSIMD_RVV_MAKE_TYPES'
  106 |     XSIMD_RVV_MAKE_TYPE(int8_t, i, 8, vmul)    \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:101:20: note: expanded from macro 'XSIMD_RVV_MAKE_TYPE'
  101 |             return XSIMD_RVV_JOINT5(__riscv_vreinterpret_, u, 8, m, vmul)(words);         \
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:50:41: note: expanded from macro 'XSIMD_RVV_JOINT5'
   50 | #define XSIMD_RVV_JOINT5(a, b, c, d, e) XSIMD_RVV_JOINT(XSIMD_RVV_JOINT(a, b, c), d, e)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:49:34: note: expanded from macro 'XSIMD_RVV_JOINT'
   49 | #define XSIMD_RVV_JOINT(a, b, c) XSIMD_RVV_JOINT_(a, b, c)
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:48:35: note: expanded from macro 'XSIMD_RVV_JOINT_'
   48 | #define XSIMD_RVV_JOINT_(a, b, c) a##b##c
      |                                   ^~~~~~~
<scratch space>:141:1: note: expanded from here
  141 | __riscv_vreinterpret_u8m8
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:117:13: note: candidate function not viable: no known conversion from 'const __rvv_uint8m8_t' to '__rvv_uint16m8_t' for 1st argument
  117 |             XSIMD_RVV_MAKE_TYPES(8)
      |             ^~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:106:5: note: expanded from macro 'XSIMD_RVV_MAKE_TYPES'
  106 |     XSIMD_RVV_MAKE_TYPE(int8_t, i, 8, vmul)    \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:101:20: note: expanded from macro 'XSIMD_RVV_MAKE_TYPE'
  101 |             return XSIMD_RVV_JOINT5(__riscv_vreinterpret_, u, 8, m, vmul)(words);         \
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:50:41: note: expanded from macro 'XSIMD_RVV_JOINT5'
   50 | #define XSIMD_RVV_JOINT5(a, b, c, d, e) XSIMD_RVV_JOINT(XSIMD_RVV_JOINT(a, b, c), d, e)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:49:34: note: expanded from macro 'XSIMD_RVV_JOINT'
   49 | #define XSIMD_RVV_JOINT(a, b, c) XSIMD_RVV_JOINT_(a, b, c)
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/mark/workspace/xsimd/include/xsimd/memory/../config/../types/xsimd_rvv_register.hpp:48:35: note: expanded from macro 'XSIMD_RVV_JOINT_'
   48 | #define XSIMD_RVV_JOINT_(a, b, c) a##b##c
      |                                   ^~~~~~~
<scratch space>:141:1: note: expanded from here
  141 | __riscv_vreinterpret_u8m8
      | ^~~~~~~~~~~~~~~~~~~~~~~~~

A simpler example to repeat the problem

#include <riscv_vector.h>
vuint8m8_t func(vuint8m8_t src) { 
  return __riscv_vreinterpret_u8m8(src);
}

build log

 clang -march=rv64gcv_zvl256b -mrvv-vector-bits=256 ./test.cpp -c
./test.cpp:3:10: error: no matching function for call to '__riscv_vreinterpret_u8m8'
    3 |   return __riscv_vreinterpret_u8m8(src);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
./test.cpp:3:10: note: candidate function not viable: no known conversion from 'vuint8m8_t' (aka '__rvv_uint8m8_t') to '__rvv_uint16m8_t' for 1st argument
    3 |   return __riscv_vreinterpret_u8m8(src);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
./test.cpp:3:10: note: candidate function not viable: no known conversion from 'vuint8m8_t' (aka '__rvv_uint8m8_t') to '__rvv_uint32m8_t' for 1st argument
    3 |   return __riscv_vreinterpret_u8m8(src);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
./test.cpp:3:10: note: candidate function not viable: no known conversion from 'vuint8m8_t' (aka '__rvv_uint8m8_t') to '__rvv_uint64m8_t' for 1st argument
    3 |   return __riscv_vreinterpret_u8m8(src);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
./test.cpp:3:10: note: candidate function not viable: no known conversion from 'vuint8m8_t' (aka '__rvv_uint8m8_t') to '__rvv_int8m8_t' for 1st argument
    3 |   return __riscv_vreinterpret_u8m8(src);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

godbolt:

clang17(no error): https://godbolt.org/z/jEGhrfbKc

clang18 (error): https://godbolt.org/z/Ecrr14Tcn

The obvious fix to the godbolt issue is to pass the expected parameter type, as in https://godbolt.org/z/41z94oP4c . I'll check what's the issue in xsimd, thanks for providing such a detailed reproducer.

@zqb-all can you check if #1059 fixes your issue?

EDIT: forget about it: I've added proper CI for it and it's still failing :-/

Thanks for your quick and helpful response, it looks like CI has passed. I also tested it locally and there were no compilation issues.