Issue |
147373
|
Summary |
clang does not treat __managed__ variables like nvcc
|
Labels |
clang
|
Assignees |
|
Reporter |
cbuchner1
|
Hi,
I am having difficulty declaring__managed__ variables with clang++. I am trying this with clang-20 and CUDA toolkit 12.1 which is supposed to be supported.
The declaration (in global scope)
__managed__ int val;
leads to clang++-20 (also clang++-17) output the warning
test.cu:1:1: warning: 'managed' attribute ignored [-Wignored-attributes]
1 | __managed__ int val;
The variable val will not be accessible from __device__ functions and __global__ kernels and it leads to compilation errors.
Here is a short reproducer
`__managed__ int val;
#include <cstdio>
__device__ void test_devicefunc()
{
printf("devicefunc val=%d\n", val);
}
__global__ void test_kernel()
{
printf("kernel val=%d\n", val);
test_devicefunc();
}
int main(int argc, char *argv[])
{
val = 100;
test_kernel<<<1, 1>>>();
cudaDeviceSynchronize();
return 0;
}`
The same code compiles fine with nvcc and creates the output
kernel val=100
devicefunc val=100
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs