HIP
HIP copied to clipboard
Name collision ("__noinline__") between GCC 12's libstdc++ and HIP
Upgrading to GCC 12.1 and its matching libstdc++ breaks HIP code which uses libstdc++'s headers 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.
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.
This issue should be closed with: https://github.com/ROCm-Developer-Tools/hipamd/commit/28009bc68faf2b4dd8fda91c99b0725e1b063a18
@yxsamliu
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.
still seems present in 5.2.1 on gcc-12 (Ubuntu 12-20220319-1ubuntu1)
as seen in https://github.com/rocm-arch/rocm-arch/issues/780 and in https://github.com/xuhuisheng/rocm-build/issues/31