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

Name collision ("__noinline__") between GCC 12's libstdc++ and HIP #2678

Closed
FilipVaverka opened this issue May 14, 2022 · 4 comments
Closed

Comments

@FilipVaverka
Copy link

Upgrading to GCC 12.1 and its matching libstdc++ breaks HIP code which uses libstdc++'s headers such as "".
The origin of the issue seems to be in that libstdc++ started to use GCC attributes in two underscore form (such as "__attribute__((__noinline__))", in eg. shared_ptr implementation), which are also redefined by HIP. This causes invalid substitutions in cases such as:

#include <hip/hip_runtime.h> // defines #define __noinline__ __attribute__((noinline))
#include <memory> // uses "__attribute__((__noinline__))" -> __attribute__((__attribute__((noinline))))

Similar issue emerged with boost (here #2355) before, but I'm not sure if libstdc++ would implement similar fix. Otherwise I don't see any good solution except workarounds such as #undef __noinline__ when not needed or including libstdc++ headers first.

@yxsamliu
Copy link
Contributor

yxsamliu commented May 16, 2022

Thanks for reporting. We introduced __noinilne__ as a keyword for HIP in clang (https://reviews.llvm.org/D124866) and will remove the __noinline__ macro from HIP headers. This should fix the issue.

@acxz
Copy link

acxz commented Jul 10, 2022

This issue should be closed with: ROCm/hipamd@28009bc

@yxsamliu

@jwakely
Copy link

jwakely commented Jul 26, 2022

Similar issue emerged with boost (here #2355) before, but I'm not sure if libstdc++ would implement similar fix.

No, absolutely not. That is not an option for libstdc++ because it would break this valid C++ program:

#define noinline some garbage )[ tokens 
#include <memory>

Fixing it in HIP was the right thing to do.

@FCLC
Copy link

FCLC commented Jul 26, 2022

still seems present in 5.2.1 on gcc-12 (Ubuntu 12-20220319-1ubuntu1)

log.txt

as seen in rocm-arch/rocm-arch#780 and in xuhuisheng/rocm-build#31

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

6 participants