-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Pass -stdlib=libc++ for CUDA with clang trunk. #5373
base: main
Are you sure you want to change the base?
Conversation
Without this, clang defaults to libstdc++. This doesn't compile with clang trunk: /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/std_abs.h:137:7: error: __float128 is not supported on this target
cc @Artem-B |
cc @mattgodbolt |
Can you share a link to a specific example, I'm a little curious as to why no one else has mentioned anything about this for 2-3 years |
It's a fairly recent development. I guess it was introduced with a libstdc++ upgrade on godbolt machines. Looks like the early signs of this were already present couple of years ago. E.g. boostorg/math#181 (comment). It's possible that something in clang had changed recently and enabled support for float128 by default on the host side and we've propagated the macros used to detect it from the host to the GPU compilation. I'll take a look at what could be done about that on clang side. |
I'd much prefer pinning to a known good gcc version, not to change the C++ standard library. That's a far more surprising (to me) change, as it's not the default. |
Huh. I've found the reason I can't reproduce the issue locally.
Note the AFAICT, it's been added by debian: https://tracker.debian.org/media/packages/g/gcc-11/changelog-11.2.0-17
I'm still not sure why the behavior had changed on CE. The bad news is that I've found no way to disable fp128 support in clang via command line options. It appears to be hardcoded based on the target triple. Looks like AMDGPU backend had already run into the same problem and worked around it in clang: https://github.com/llvm/llvm-project/blob/3a67b912386e70073efcb2225c6354b85048b1ae/clang/lib/Basic/Targets/AMDGPU.cpp#L345 Looks like I'll need to do something similar for NVPTX back-end, too. |
I'm not sure I'm following any of this, unfortunately: I don't have enough context to know what the right thing to do here is. I only know the default C++ library should be whatever Ubuntu gives you by default.. |
The short version is that it will need to be fixed in clang and there's no way (AFAICT) to avoid the problem by disabling __float128 or by using an older libstdc++ (afaict the issue goes back to before gcc-10). Temporarily passing I still don't understand what kept clang working until recently. If we can figure it out, it may provide another workaround. |
I would also be happy taking this patch while we wait for Art to fix it
properly.
…On Mon, Aug 21, 2023 at 11:30 PM Artem Belevich ***@***.***> wrote:
The short version is that it will need to be fixed in clang and there's no
way (AFAICT) to avoid the problem by disabling __float128 or by using an
older libstdc++ (afaict the issue goes back to before gcc-10).
Temporarily passing -stdlib=libc++ may be a reasonable trade-off for the
time being.
I still don't understand what kept clang working until recently. If we can
figure it out, it may provide another workaround.
—
Reply to this email directly, view it on GitHub
<#5373 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABEZBZWVDCCUQJ73IZBITDXWRGYBANCNFSM6AAAAAA3MF65JQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@mattgodbolt : was CE at some point using stock ubuntu packages for libstdc++? Apparently Ubuntu had patched libstdc++ headers to deal with this issue http://changelogs.ubuntu.com/changelogs/pool/main/g/gcc-10/gcc-10_10.5.0-1ubuntu1~20.04/changelog :
That probably explains the "how did it work before" part. Right now it appears that CE uses DIY builds gcc and libstdc++ and they no longer have that patch. So, another possible workaround would be to have gcc+libstdc++ installed from a standard ubuntu package and point cuda clang there with |
Never knowingly, no. We've always passed |
__float128 should be fixed by llvm/llvm-project@318bff6 |
Without this, clang defaults to libstdc++. This doesn't compile with clang trunk:
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/std_abs.h:137:7: error: __float128 is not supported on this target