[compiler-rt] [compiler-rt] Initial support for builtins on GPU targets (PR #95304)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 12:35:19 PDT 2024
jhuber6 wrote:
> There are three things here.
>
> One is the very complicated logic in compiler-rt cmake for deciding what to build.
>
> Two is the long-standing machine code linking puzzle for amdgpu.
>
> Three is that amdgpu really could do with a compiler-rt builtins to factor parts of the compiler backend / intrinsics into.
>
Making the backend rely on it is difficult because of (2), but agreed.
> We can postpone 2 by noting that builtins.a is an archive and archives can have object or bitcode in. 1 is just really careful programming.
>
> I'd like there to be a target-builtins for the two amdgpu and nvptx targets, provided it serves a similar role to on the other targets, and doesn't import a load of gpu-offload-centric design decisions like unexpectedly wrapping everything in x64 elf files or deciding archive files don't mean what they do everywhere else.
>
The short-term plan here is to make this `compiler_rt.builtins.a` and have the `lld` job that the `ROCMToolChain` in clang creates implicitly link against it if it exists. That should use all the regular LT
> At the lowest level, a gpu triple is just a bare metal embedded target. Compiler-rt builtins is the lowest level, it can and should use that model.
Yep, the compilation method here is pretty much just "I want to build `compiler-rt` for this target" Which in this case just adds a few extra flags to make it work for now.
https://github.com/llvm/llvm-project/pull/95304
More information about the llvm-commits
mailing list