[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:51:42 PDT 2024


jhuber6 wrote:

> > Making the backend rely on it is difficult because of (2), but agreed.
> > >
> 
> Not for compiler-rt, we can just assume it's version locked. The resource problem is also simpler for compiler-rt. We can more easily just define a fixed register budget, and then just assume there's no stack usage

Yeah, and LDS likely isn't going to be an issue unless we start putting more things in here. Would that require some special handling for like "If callee is a compiler-rt function assume some thread count?" I know for *most* cases the default for an unknown callee is generous enough to not cause issues.

Also, the issues with machine code linking is that you'd need to somehow wrangle many different builds. This would only work as part of the build system if you put it into the Triple (like Arm Architecture does), but even that would then necessitate like 20 separate builds which would take ages. (Configuring just one of these adds like an extra 15 seconds to my build). 

The issue with the IR / LTO route is that the library gets resolved / internalized before the backend runs, so we don't know if we actually *needed* some function from the static library. I'm wondering if it would be possible to do some kind of "late" LTO that runs after everything else. That way we don't need 50 different builds and we get ISA linking that's correct.

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


More information about the llvm-commits mailing list