Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang18 build error on RVV (no error on Clang17) #1058

Closed
zqb-all opened this issue Oct 15, 2024 · 5 comments
Closed

Clang18 build error on RVV (no error on Clang17) #1058

zqb-all opened this issue Oct 15, 2024 · 5 comments

Comments

@zqb-all
Copy link

zqb-all commented Oct 15, 2024

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
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
@zqb-all
Copy link
Author

zqb-all commented Oct 15, 2024

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

@serge-sans-paille
Copy link
Contributor

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.

@serge-sans-paille
Copy link
Contributor

serge-sans-paille commented Oct 15, 2024

@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 :-/

@zqb-all
Copy link
Author

zqb-all commented Oct 16, 2024

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

@serge-sans-paille
Copy link
Contributor

Closed by #1059

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants