llvm / llvm/llvm-project

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

Open
#198,078 3 comments 0 reactions 3 assignees Claimed by @kzhuravl View on GitHub
backend:AMDGPU new issue
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

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](https://gist.github.com/ElliotBLabs/a75fbab5585b18d6ea5dd10c18f18333)

**How to reproduce:**
```bash
clang++ -x hip HIPProg.hip --offload-arch=native
```

**Actual Output:**
```text
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.