-
Notifications
You must be signed in to change notification settings - Fork 53
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
[Issue]: Clang 19.1.0 with libc++ fails to build HIP code #100
Comments
Hi @AngryLoki. Internal ticket has been created to fix your issue. Thanks! |
Hi @AngryLoki, does this happen when you use the clang provided with ROCm? |
@zichguan-amd , when checking with clang from
|
I cannot repro the issue with ROCm 6.2.2, are you using the same ROCm version as the clang release tag? |
I rechecked with hip-6.2.2 (and rocm-comgr-6.2.2, rocr-runtime-6.2.2), with rocm/llvm-project from branch rocm-6.2.2, still reproduces. Steps were:
Same error
Just to repeat: the only important flag for reproduction is |
Can you include the |
Ah, sorry, my mistake. Even though I used clang from rocm branch, compiler pulled libc++ header #if !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER != 1700
// compiler follows this branch
class __promote {
// decltype-based implementation
using type = decltype((__test(_Args()) + ...));
#else
struct __numeric_type {
// ...
}
class __promote {
// ... This "simplified implementation of __promote" does not exist in libc++ 18.x, so the issue only affects systems with docker run -it --rm ubuntu:24.10 bash
apt update && apt install libc++-dev wget -y
wget https://repo.radeon.com/amdgpu-install/6.2.2/ubuntu/noble/amdgpu-install_6.2.60202-1_all.deb
apt install ./amdgpu-install_6.2.60202-1_all.deb -y && apt update && apt install amdgpu-dkms rocm -y
echo "#include <hip/hip_runtime.h>" > test.hip
/opt/rocm-6.2.2/bin/hipcc -stdlib=libc++ -c test.hip
# error: class template specialization of '__numeric_type' not in a namespace enclosing '__hip' |
Good catch! I've escalated the issue and @yxsamliu should be able to take a closer look into it. |
Thanks for your analysis. I think we can fix the issue by reverting this commit 6f439f0 This commit was done four years ago to workaround a libc++ ambiguity issue when using _Float16 with fma. However, it seems we no longer need this workaround as libc++ has fixed that issue. https://godbolt.org/z/YhsKr8sjv |
Hi @AngryLoki, fix has landed in staging: b8ba4cc. |
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:A single replacement in
clr/hipamd/include/hip/amd_detail/amd_math_functions.h
Lines 44 to 47 in 65d174c
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
The text was updated successfully, but these errors were encountered: