[flang-commits] [flang] [flang][cuda] Pass assumed-shape arrays of bind(c) attributes(global) kernels by base address (PR #199313)

Zhen Wang via flang-commits flang-commits at lists.llvm.org
Sat May 23 09:19:40 PDT 2026


wangzpgi wrote:

> Is that documented anywhere is the spec? Can you add an example of what is the actual C kernel?

The CUDA Fortran Programming Guide does not document this case. The reference compiler passes the data pointer when lowering `dimension(:), device` under `bind(c) attributes(global)`, and the fix matches that.

Example:
```
extern "C"
__global__ void mykernel(float *d, int n) {
    int tid = blockDim.x * blockIdx.x + threadIdx.x;
    if (tid < n) d[tid] = (float)tid;
}
```

https://github.com/llvm/llvm-project/pull/199313


More information about the flang-commits mailing list