Public bug reported:
/usr/include/hip/amd_detail/host_defines.h (shipped by libamdhip64-dev
from src:rocm-hipamd) unconditionally does
#define __noinline__
in the non-HIP compilation branch (the `#else` at ~line 253 in the 7.2.4
tree). Any host-side C++ TU that includes a HIP header and then transitively
pulls in libstdc++-16's <format> hits
/usr/include/c++/16/format:4550
[[__gnu__::__noinline__]]
handle _M_handle_unrecognized() const;
The preprocessor substitutes __noinline__ with the empty macro body,
producing
[[__gnu__::]]
which is a syntax error. clang emits "expected identifier" and the TU
fails.
The attribute site was added in libstdc++-16.2.0-1ubuntu1; the previous
minor version libstdc++-16.1.0-2ubuntu1 did not use __noinline__ in
<format>, which is why builds against the same libamdhip64-dev succeeded
until the libstdc++ minor bump.
Reproducer:
$ cat > /tmp/t.cpp <<'EOF'
#include <hip/hip_runtime.h>
#include <chrono>
int main() {}
EOF
$ clang++-22 -std=gnu++20 -c /tmp/t.cpp
/usr/include/c++/16/format:4550:30: error: expected identifier
[[__gnu__::__noinline__]]
^
Real-world impact: pytorch-rocm 2.12.1+dfsg-2ubuntu1~git202608181215
FTBFS on stonking/amd64 --
https://launchpadlibrarian.net/873798268/buildlog_ubuntu-stonking-amd64.pytorch-rocm_2.12.1+dfsg-2ubuntu1~git202608181215.fea158986_BUILDING.txt.gz
Fix:
Drop the empty `#define __noinline__` from the non-HIP branch of
hipamd/include/hip/amd_detail/host_defines.h. clang and gcc already
recognise __noinline__ natively as an attribute keyword; no stub is
needed. The paired `#define __forceinline__ inline` on the following line
should stay in place until the same symptom is observed on __forceinline__.
--- a/hipamd/include/hip/amd_detail/host_defines.h
+++ b/hipamd/include/hip/amd_detail/host_defines.h
@@
#define __global__
-#define __noinline__
#define __forceinline__ inline
#define __shared__
Regression potential:
Very low. The change only touches the non-HIP compilation branch. Any
downstream code that has been relying on __noinline__ being an empty
macro in host C++ was already stripping a real attribute (and thus
silently disabling function-level inlining decisions), which is not
intentional behaviour anyone should be depending on. In HIP-mode
compilation (__HIP__ defined) the surrounding `#if` branch is
unchanged and __noinline__ continues to expand to
__attribute__((noinline)) as before.
** Affects: rocm-hipamd (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2166160
Title:
libamdhip64-dev: host_defines.h #define __noinline__ breaks
libstdc++-16 <format>
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rocm-hipamd/+bug/2166160/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs