[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
Tue Feb 13 12:09:20 PST 2024


jhuber6 wrote:

> I'm not sure I follow, why are other runtimes like `openmp` and `libunwind` even being built if they're not listed in `RUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES='libc'`? Can you post the full set of options you're using?
>

What I meant is that it required passing `LLVM_RUNTIMES_TARGETS` which would then apply it to all my builds, when I want them to all be default. The option was just like this to test.

```
-DLLVM_ENABLE_RUNTIMES='libc;libcxx;libunwind;openmp'
-DLLVM_RUNTIME_TARGETS='default;x86_64-pc-linux-gnu'
-DRUNTIMES-x86_64-pc-linux-gnu_LLVM_ENABLE_RUNTIMES=libc
```

And the issue was that it was still building `default` for `libc`.
 
> The reason I'm not a fan of the proposed solution is that it seems to be specifically tailored to libc and I'm worried that it won't generalize. Specifically, runtimes are typically layered on top of each other, that is `libunwind` is built on top of `libc`, `libcxxabi` is built on top of `libunwind`, `libcxx` is built on top of `libcxxabi`, `compiler-rt` is built on top of `libcxx`. Whereas `LLVM_LIBC_RUNTIME_TARGETS='nvptx64-nvidia-cuda;amdgcn-amd-amdhsa'` makes sense since `libc` is the bottommost layer, something like `LLVM_LIBCXXABI_RUNTIME_TARGETS='nvptx64-nvidia-cuda;amdgcn-amd-amdhsa'` likely won't ever be of any use.
>

That's easily doable if the user manually configures the override to include either `default` or the other values in `LLVM_ENABLE_RUNTIMES`. I pretty much just need a way to enable additional targets on a per-project basis. It needs to be able to prevent the default build as well. If I were doing this and wanted the others to be built on top of it, I would just do
```
-DLLVM_RUNTIME_TARGETS=default
-DLLVM_LIBC_RUNTIME_TARGETS=default;amdgcn-amd-amdhsa
```

I think the semantics there are straightforward enogh.

> In your description, you also mentioned `LLVM_ENABLE_PROJECTS='openmp;libcxx;libcxx-abi;libc'` but that's not even a supported configuration, in particular `libcxx` and `libcxxabi` only support `LLVM_ENABLE_RUNTIMES`, putting them in `LLVM_ENABLE_PROJECTS` will result in an error (that will soon be the case for all runtimes). Can you explain what the intended goal there is? I'd like to see if there's another way we can support this.

That's a typo, I meant `LLVM_ENABLE_RUNTIMES` but my brain typed the other thing.

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


More information about the llvm-commits mailing list