[clang] [openmp] [OpenMP] Respect LLVM per-target install directories (PR #83282)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 13:48:00 PST 2024


jhuber6 wrote:

> > > @jdoerfert I would like to see the device code compilation (on device runtime) and host runtime compilation fully separate. Then I can build the runtime with gcc or sanitizer without disturbing device code compilation.
> > 
> > 
> > Could you elaborate on this? One of my long-term goals is to build the OpenMP device runtime similarly to how I build the GPU C library. That is, we have a `runtimes` build that simply does `--target=amdgcn-amd-amdhsa` on C/C++ source using standard `clang`. We could maybe split this out into a separate runtime and declare the offloading runtime on the CPU to be a project instead?
> 
> I need a clean way to add `-fsantize=address` to the libomptarget host runtime and plugins compilation without disturbing the device compilation. So if you move all the device compilation to a separate runtime, it also achieves my goal I guess.

We could potentially do what I do with the `libc` target and treat it as cross compiling. So we'd have the "CPU" and "GPU" runtimes that go off of a switch depending on the architecture. CMake would look something like
```
   -DLLVM_ENABLE_RUNTIMES="openmp"                                      \
   -DRUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES=openmp             \
   -DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES=openmp               \
   -DLLVM_RUNTIME_TARGETS=default;amdgcn-amd-amdhsa;nvptx64-nvidia-cuda
```

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


More information about the cfe-commits mailing list