[compiler-rt] [compiler-rt] Initial support for builtins on GPU targets (PR #95304)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 07:51:13 PDT 2024


jhuber6 wrote:

> If `-DCMAKE_C_COMPILER_TARGET=amdgcn-amd-amdhsa -DCMAKE_CXX_COMPILER_TARGET=amdgcn-amd-amdhsa` is specified, will cmake only build compiler-rt builtin lib for amdgcn (not building compiler-rt builtin lib for the default host target)?
> 
> It is desirable to build compiler-rt builtin for both the default host target and amdgcn target in one build. And the build for amdgcn target can be optional and controlled by a cmake variable. You may use a similar approach in https://github.com/llvm/llvm-project/pull/71978/files to achieve that.

It should work with this configuration, (Though I just remembered I need to add some more flags to the other case). Ideally we'd just build these if the compiler can target it and don't need an extra variable. What I did here was mostly testing (direct) targeting, however it should work in various cases. Ultimately what I want is to install these to `<install>/lib/clang/<version>/lib/amdgcn-amd-amdhsa/libclang_rt.builtins.(a|.bc)` and then we link that in. Supporting complex numbers and 128 bit division is part of why I wanted to do this.

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


More information about the llvm-commits mailing list