[PATCH] D98193: [CUDA][HIP] Allow non-ODR use of host var in device

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 8 11:30:35 PST 2021


tra added inline comments.


================
Comment at: clang/test/SemaCUDA/device-use-host-var.cu:41
   *out = global_const_var;
+  *out = global_const_struct_var.x;
 
----------------
I do not think it should be allowed. We end up instantiating the variable on device, even though the variable should be host-only.

Right now we allow it, but end up with an `.extern .const` which will make ptxas fail:
https://godbolt.org/z/sx9845

If we do allow it, we'll need to make sure that we only use the value, but do not allow instantiating the variable.



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

https://reviews.llvm.org/D98193



More information about the cfe-commits mailing list