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

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 10 05:44:03 PST 2021


yaxunl marked an inline comment as done.
yaxunl added inline comments.


================
Comment at: clang/test/SemaCUDA/device-use-host-var.cu:41
   *out = global_const_var;
+  *out = global_const_struct_var.x;
 
----------------
tra wrote:
> 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.
> 
will only not allow this since it results in ODR-use of the host var.


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

https://reviews.llvm.org/D98193



More information about the cfe-commits mailing list