[llvm] [offload][lit] Enable ctor_dtor.cpp on Intel GPUs (PR #194389)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 07:53:27 PDT 2026


jhuber6 wrote:

> I couldn't find any examples of how to write a program for it, I made the below nonsense program based on the errors it threw and it seemed to work based on `LIBOMPTARGET_DEBUG` output, if you have an example that actually does something I can do a real test.
> 
> ```
> #include <gpuintrin.h>
> #include <stdint.h>
> 
> extern "C" __gpu_kernel void _start(uint32_t *out) {
> }
> 
> extern "C" __gpu_kernel void _begin(uint32_t *out) {
> }
> 
> extern "C" __gpu_kernel void _end(uint32_t *out) {
> }
> ```

Those definitions are supposed to come from https://github.com/llvm/llvm-project/blob/main/libc/startup/gpu/start.cpp. Their function should be pretty straightforward, but the largest barrier would probably be verifying RPC works. A typical compilation would be like
```console
$ clang main.c --target=amdgcn-amd-amdhsa -mcpu=native ./lib/amdgcn-amd-amdhsa/libc.a ./lib/amdgcn-amd-amdhsa/crt1.o -flto -o image
$ llvm-gpu-loader image
Hello World!
```

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


More information about the llvm-commits mailing list