This is an archive of the discontinued LLVM Phabricator instance.

[CUDA][HIP] Add pre-defined macro `__CLANG_RDC__`
ClosedPublic

Authored by yaxunl on Nov 30 2021, 12:01 PM.

Details

Summary

nvcc defines __CUDACC_RDC__ for both host and
device compilation when -rdc=true is specified
(https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#nvcc-identification-macro)

This patch defines __CLANG_RDC__ when -fgpu-rdc
is specified for CUDA/HIP.

Diff Detail

Event Timeline

yaxunl requested review of this revision.Nov 30 2021, 12:01 PM
yaxunl created this revision.

I am not sure whether we want to define a similar macro for cuda-clang.

Maybe __CLANG_RDC__ is better?

tra added a comment.Nov 30 2021, 12:06 PM

I am not sure whether we want to define a similar macro for cuda-clang.

Maybe __CLANG_RDC__ is better?

I think it would make sense. For CUDA compatibility we can the define CUDACC_RDC in the wrapper headers.

yaxunl updated this revision to Diff 392205.Dec 6 2021, 3:23 PM
yaxunl retitled this revision from [HIP] Add pre-defined macro `__HIPCC_RDC__` to [CUDA][HIP] Add pre-defined macro `__CLANG_RDC__`.
yaxunl edited the summary of this revision. (Show Details)
tra accepted this revision.Dec 6 2021, 3:42 PM
This revision is now accepted and ready to land.Dec 6 2021, 3:42 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptDec 7 2021, 3:10 PM