According to CUDA programming guide (v7.5):
E.2.9.4: Within the body of a device or global function, only shared variables may be declared with static storage class.
Paths
| Differential D20034
[CUDA] Only __shared__ variables can be static local on device side. ClosedPublic Authored by tra on May 6 2016, 2:26 PM.
Details Summary According to CUDA programming guide (v7.5):
Diff Detail Event TimelineComment Actions 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? Comment Actions
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. This revision is now accepted and ready to land.May 6 2016, 3:48 PM Closed by commit rL268962: [CUDA] Only __shared__ variables can be static local on device side. (authored by tra). · Explain WhyMay 9 2016, 12:42 PM This revision was automatically updated to reflect the committed changes. Comment Actions This patch regresses Eigen, because it raises an error even on host+device functions.
Revision Contents
Diff 56610 include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDecl.cpp
test/CodeGenCUDA/address-spaces.cu
test/CodeGenCUDA/device-var-init.cu
|