[clang] [CUDA] Add device-side kernel launch support (PR #165519)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 24 10:17:06 PST 2025
================
@@ -525,6 +564,11 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
object::Archive::create(Buffer);
if (!LibFile)
return LibFile.takeError();
+ // Skip extracting archives with fat binaries. Forward them to nvlink.
+ if (hasFatBinary(**LibFile)) {
+ ForwardArchives.emplace_back(Args.MakeArgString(*Filename));
----------------
darkbuck wrote:
I put all my findings on fatbin in https://github.com/darkbuck/fatbin-hack. It's turned out that entries in that fatbin sections cannot be used directly and need at least decompression.
In this revision, an alternative approach is taken. Instead of extracting cubin from that fatbin archive, we uses that fatbin object from that archive. It follows the same steps to extract individual object from an archive but write them as `*.o` files instead of `*.cubin` when preparing input files for `nvlink` so that `nvlink` will treat them as fatbin. The overall changes to `clang-nvlink-wrapper` seems quite small and straight-forward. @jhuber6, let me know what's your thoughts?
https://github.com/llvm/llvm-project/pull/165519
More information about the cfe-commits
mailing list