Closed
Description
Problem Description
Hi,
As seen in https://godbolt.org/z/ehxeqG4sj, clang --stdlib=libc++
works with clang-17 and does not work with newer versions (checked with clang version 19.1.0 and nightly builds). Compilation of any file fails with:
In file included from <built-in>:2:
In file included from /opt/compiler-explorer/libs/rocm/6.1.2/include/hip/hip_runtime.h:62:
In file included from /opt/compiler-explorer/libs/rocm/6.1.2/include/hip/amd_detail/amd_hip_runtime.h:351:
/opt/compiler-explorer/libs/rocm/6.1.2/include/hip/amd_detail/amd_math_functions.h:47:8: error: no template named '__numeric_type'; did you mean '__hip::__numeric_type'?
47 | struct __numeric_type<_Float16>
| ^
/opt/compiler-explorer/clang-assertions-trunk-20241026/lib/clang/20/include/__clang_hip_cmath.h:383:29: note: '__hip::__numeric_type' declared here
383 | template <class _Tp> struct __numeric_type {
| ^
In file included from <built-in>:2:
In file included from /opt/compiler-explorer/libs/rocm/6.1.2/include/hip/hip_runtime.h:62:
In file included from /opt/compiler-explorer/libs/rocm/6.1.2/include/hip/amd_detail/amd_hip_runtime.h:351:
/opt/compiler-explorer/libs/rocm/6.1.2/include/hip/amd_detail/amd_math_functions.h:47:8: error: class template specialization of '__numeric_type' not in a namespace enclosing '__hip'
47 | struct __numeric_type<_Float16>
| ^
/opt/compiler-explorer/clang-assertions-trunk-20241026/lib/clang/20/include/__clang_hip_cmath.h:383:29: note: explicitly specialized declaration is here
383 | template <class _Tp> struct __numeric_type {
| ^
A single replacement in
clr/hipamd/include/hip/amd_detail/amd_math_functions.h
Lines 44 to 47 in 65d174c
-namespace std {
+namespace __hip {
fixes compilation (compiles the whole pytorch fine), however I think it might break something else (as I was not able to find which commit in llvm caused the issue). I'm pretty sure @yxsamliu knows the details though.
Could you fix this issue? Thanks!
ROCm Version
ROCm 6.1.1
ROCm Component
clr