This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Unbreak CUDA compilation with -std=c++20
ClosedPublic

Authored by tra on Nov 19 2020, 10:15 AM.

Details

Summary

Standard libc++ headers in stdc++ mode include <new> which picks up
cuda_wrappers/new before any of the CUDA macros have been defined.

We can not include CUDA headers that early, so the work-around is to
postpone the CUDA-specific parts until after <new> is included from user
sources and all CUDA-related macros and declarations are available.

PR48228 https://bugs.llvm.org/show_bug.cgi?id=48228

Diff Detail

Event Timeline

tra created this revision.Nov 19 2020, 10:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2020, 10:15 AM
Herald added subscribers: bixia, yaxunl. · View Herald Transcript
tra requested review of this revision.Nov 19 2020, 10:15 AM
jlebar accepted this revision.Nov 19 2020, 10:22 AM

How fun. :)

This revision is now accepted and ready to land.Nov 19 2020, 10:22 AM
This revision was landed with ongoing or failed builds.Nov 19 2020, 10:36 AM
This revision was automatically updated to reflect the committed changes.
tra reopened this revision.Dec 4 2020, 11:33 AM

Reopening the tracker for a better fix.

This revision is now accepted and ready to land.Dec 4 2020, 11:33 AM
tra updated this revision to Diff 309595.Dec 4 2020, 11:34 AM

Better fix for the early inclusion of <new>

tra requested review of this revision.Dec 4 2020, 11:37 AM

@jlebar PTAL. The previous fix did not quite fix the problem. __device__ operator new/delete was still not defined, but the issue was not reported due to deferred diags if the functions were not used.

jlebar accepted this revision.Dec 4 2020, 11:43 AM
This revision is now accepted and ready to land.Dec 4 2020, 11:43 AM
tra updated this revision to Diff 309598.Dec 4 2020, 11:46 AM

Removed forgotten pop_macro(DEVICE)

tra edited the summary of this revision. (Show Details)Dec 4 2020, 12:03 PM
This revision was landed with ongoing or failed builds.Dec 4 2020, 12:04 PM
This revision was automatically updated to reflect the committed changes.