[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:47:13 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




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

> Note for the future -- it would be great if we could finish discussing the patch before landing it. 
>  I would still like to see the host-side test.


Sorry, will follow that rule. Yes, that patch only changes the device-side. But, for host-side, even that variable is declared as `static` as well, but there's no reference to it. clang just skip emitting it.


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