[PATCH] D95901: [CUDA][HIP] Fix device variable linkage

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 3 12:14:31 PST 2021


tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

In D95901#2539754 <https://reviews.llvm.org/D95901#2539754>, @yaxunl wrote:

> For -fno-gpu-rdc, two TU's can have global device variables with the same name, therefore the shadow variables need to be internalized, which is fine since -fno-gpu-rdc is not supposed to access device variables across TU's. So far users did not report issues about shadow var linkage for -fno-gpu-rdc (they reported shadow var linkage issues for -fgpu-rdc only). Let the shadow vars keep original linkage and use CUID to make them unique would be unnecessary and clutter the IR.

I've checked what NVCC does in this case and their behavior appears to match your approach. Shadows are internalized w/o RDC and become visible when it's on.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95901/new/

https://reviews.llvm.org/D95901



More information about the cfe-commits mailing list