[clang] [openmp] [OFFLOAD] Build DeviceRTL with SPIRV backend (PR #174675)
Karol Zwolak via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 18 12:40:30 PST 2026
karolzwolak wrote:
Compiling openmp code for the `spirv64-intel-unknown` target doesn't work for me in the current state.
When compiling openmp code, clang complains about:
```
fatal error: error in backend: cannot select: %50:pid(p0) = G_ADDRSPACE_CAST %48:pid(p0) (in function:
__omp_offloading_fc00_1b60028_main_l11)
```
the culprit variable is
https://github.com/llvm/llvm-project/blob/ae1bd068db293c494c4c6314da3b9d138706460d/openmp/device/src/Configuration.cpp#L30-L32
Removing the `Constant<...>` from the variable fixes the issue.
Additionally, when this patch is cherry picked on the latest main with clang 23, offload doesn't compile.
```
error: no matching constructor for initialization of 'Constant<DeviceEnvironmentTy>' (aka '__attribute__((address_space(2))) DeviceEnvironmentTy')
32 | "protected")]] Constant<DeviceEnvironmentTy> __omp_rtl_device_environment;
| ^
llvm-project/openmp/device/../../offload/include/Shared/Environment.h:27:8: note: candidate constructor ignored: cannot be used to construct an object in address space '__attribute__((address_space(2)))'
```
The build error can be fixed by providing an initializer like `__omp_rtl_device_environment = {}`, however then we go back to the first problem.
https://github.com/llvm/llvm-project/pull/174675
More information about the cfe-commits
mailing list