llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[AMDGPU] HIP error: unsupported expression in static initializer: addrspacecast

Open ElliotBLabs opened this issue 6 months ago • 3 comments

The following HIP program triggers a compiler error during compilation. The compiler fails to handle an address space cast from shared memory (addrspace(3)) to a generic pointer within a static initialiser context.

Test File: HIPProg.hip

How to reproduce:

clang++ -x hip HIPProg.hip --offload-arch=native

Actual Output:

error: unsupported expression in static initializer:
      addrspacecast (ptr addrspace(3) @_ZZ6func_1P2S1E6l_1069 to ptr)
...
7 errors generated when compiling for gfx906.

I am not sure if this is just an ungraceful error or something not allowed in the generation.

ElliotBLabs avatar May 16 '26 09:05 ElliotBLabs

tagging @mgcarrasco who is working on it

ElliotBLabs avatar May 16 '26 09:05 ElliotBLabs

I can confirm with commit https://github.com/llvm/llvm-project/commit/3e20d3d3964a3a6ac5f882842c7716e2682d622f.

mgcarrasco avatar May 18 '26 14:05 mgcarrasco

@llvm/issue-subscribers-backend-amdgpu

Author: ElliotBLabs

The following HIP program triggers a compiler error during compilation. The compiler fails to handle an address space cast from shared memory (`addrspace(3)`) to a generic pointer within a static initialiser context.

Test File: HIPProg.hip

How to reproduce:

clang++ -x hip HIPProg.hip --offload-arch=native

Actual Output:

error: unsupported expression in static initializer:
      addrspacecast (ptr addrspace(3) @<!-- -->_ZZ6func_1P2S1E6l_1069 to ptr)
...
7 errors generated when compiling for gfx906.

I am not sure if this is just an ungraceful error or something not allowed in the generation.