This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Temporarily undefine __noinline__ when including bits/shared_ptr_base.h
ClosedPublic

Authored by tra on Apr 27 2023, 11:12 AM.

Details

Summary

This avoid CUDA compilation errors caused by CUDA headers defining noinline
and conflicting with noinline use in libstdc++.

Diff Detail

Event Timeline

tra created this revision.Apr 27 2023, 11:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2023, 11:12 AM
tra updated this revision to Diff 517656.Apr 27 2023, 11:15 AM

Removed warning.

tra published this revision for review.Apr 27 2023, 11:16 AM
tra added reviewers: jlebar, phawkins.
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2023, 11:16 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tra added a reviewer: yaxunl.Apr 27 2023, 3:13 PM
tra added a comment.Apr 27 2023, 3:16 PM

Fun tidbit: https://github.com/NVIDIA/thrust/issues/1703#issuecomment-1526604000

Indeed, I believe the nvcc frontend has special handling for that attribute expansion. clang would need to emulate that "special" handling

Right. The attribute((attribute((noinline)))) void foo(); gets magically transformed into __attribute((noinline)) void foo() by the time it makes it to the final host compilation. 😭

And the magic seems to work only for attribute((attribute((noinline)))). Any other variants I tried error out.

So, it's been a known issue in the CUDA headers, deliberately worked around in NVCC. And now the bug lives on and keeps giving...

jlebar accepted this revision.Apr 27 2023, 3:38 PM

wow.

This revision is now accepted and ready to land.Apr 27 2023, 3:38 PM
yaxunl accepted this revision.Apr 28 2023, 7:38 AM

LGTM.

This issue does not affect HIP as HIP headers have removed __noinline__ as a macro since https://reviews.llvm.org/D124866 and __attribute__((__noinline__)) is equivalent to __attribute__((noinline)) for HIP.

This revision was landed with ongoing or failed builds.May 1 2023, 4:27 PM
This revision was automatically updated to reflect the committed changes.