[PATCH] D62603: [CUDA][HIP] Skip setting `externally_initialized` for static device variables.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 11:57:55 PDT 2019


hliao added a comment.

In D62603#1521503 <https://reviews.llvm.org/D62603#1521503>, @tra wrote:

> In D62603#1521484 <https://reviews.llvm.org/D62603#1521484>, @hliao wrote:
>
> > thanks, but that `static __device__` variable won't have shadow in host anymore.
>
>
> Why not? Your change only changes whether `externally_initialized` is applied to the variable during device-side compilation. It does not change what happens on the host side. 
>  AFAICT, it will still be generated on the host side and the host side should still be able to take its address.
>  NVCC also allows that: https://godbolt.org/z/t78RvM


BTW, that code posted looks quite weird to me, how the code could make sense by return a pointer of device variable? or a pointer of shadow host variable?


Repository:
  rC Clang

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

https://reviews.llvm.org/D62603





More information about the cfe-commits mailing list