[PATCH] D55663: [CUDA] Make all host-side shadows of device-side variables undefined.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 13 11:43:32 PST 2018


tra created this revision.
tra added reviewers: jlebar, yaxunl.
Herald added subscribers: bixia, sanjoy.

The host-side code can't (and should not) access the values that may
only exist on the device side. E.g. address of a __device__ function
does not exist on the host side as we don't generate the code for it there

This is similar to what nvcc does and allows us to compile code which has device-side variables with initializers that only exist on device side:

  __device__ void func() {}
  __device__ funcptr_t Funcs[] = {func};


https://reviews.llvm.org/D55663

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenCUDA/device-var-init.cu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55663.178102.patch
Type: text/x-patch
Size: 17726 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181213/eb69562e/attachment.bin>


More information about the cfe-commits mailing list