[PATCH] D20034: [CUDA] Only __shared__ variables can be static local on device side.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Fri May 6 15:31:47 PDT 2016


tra added a comment.

In http://reviews.llvm.org/D20034#423945, @jlebar wrote:

> What are we supposed to do if we encounter a static __shared__ variable in an HD function?  Presumably that also should be an error if we invoke the HD function from the device?


nvcc produces an error only of such HD function is used from a __host__ function:

  error: a function scope variable cannot be declared with "shared" inside a host function

Considering that each block gets its own instance of that shared variable, there's no way to access it from host in principle so the error makes sense. I'll add it in a separate patch.


http://reviews.llvm.org/D20034





More information about the cfe-commits mailing list