[llvm] [LLVM] Add `LLVM_<proj>_RUNTIME_TARGETS` to set targets per-project (PR #81557)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 08:57:54 PST 2024


jhuber6 wrote:

> @jhuber6 @JonChesterfield Can you give me a more concrete example of how you intend to build the full set of runtimes (including compiler-rt, libc and libcxx) for GPU using this mechanism? Maybe that would help me better understand the motivation.
> 
> The reason I'm asking is because I'm still unconvinced by the simplicity arguments. The reason for pushing this feature is to simplify the runtimes build compared to current implementation that requires multiple variables, but in my experience, building runtimes typically requires a number of variables regardless, so saving one variable for setting the list of runtimes makes it difficult to justify more complexity in the runtimes build for me.
> 
> For reference, here's an example from our runtimes build for Linux (which includes compiler-rt, libunwind, libcxxabi and libcxx):
> 
> https://github.com/llvm/llvm-project/blob/c098f2d1669fb1ec6a5eac81277bd16b334ec956/clang/cmake/caches/Fuchsia-stage2.cmake#L146-L191

The issue with the current support is that it does not provide a way to disable a project for one of the runtimes targets. Right now I will say that a majority of users do not want the LLVM CPU `libc`, but let's say they want the GPU `libc` and the CPU `libc++`.

Right now the suggested method would be.
```
-DLLVM_ENABLE_RUNTIMES="libc;libc++;openmp"
-DLLVM_RUNTIMES_TARGETS="default;amdgcn-amd-amdhsa"
-DRUNTIMES_amdgcn-amd-amdhsa_ENABLE_RUNTIMES='libc'
```
This would have the desired behavior of making the `libc` project compile under the AMDGPU triple. But it would still make it present under the `default` target, which is not the desired behavior. The syntax is also more difficult to understand, but we could possible just make another user facing variable that just sets that stuff automatically. So, what I wanted was the ability to "per-project" remove some of the other projects. So the above would be
```
-DLLVM_ENABLE_RUNTIMES="libc;libc++;openmp"
-DLLVM_LIBC_RUNTIMES_TARGETS="amdgcn-amd-amdhsa"
```
If there were some alternate way to specify "I want this project to only build with X runtimes" then I would also take that.

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


More information about the llvm-commits mailing list