[PATCH] D123812: [CUDA] Add wrapper code generation for registering CUDA images

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 12:28:39 PDT 2022


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, JonChesterfield, tra, yaxunl.
Herald added a subscriber: carlosgalvezp.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch adds the necessary code generation to create the wrapper code
that registers all the globals in CUDA. We create the necessary
functions and iterate through the list of
`__start_cuda_offloading_entries` to find which globals must be
registered. This is very similar to the code generation done currently
in Clang for non-rdc builds, but here we are registering a fully linked
fatbinary and finding the globals via the above sections.

With this we should be able to fully support basic RDC / LTO building of CUDA
code.

It's also worth noting that this does not include the necessary PTX to JIT the
image, so to use this support the offloading architecture must match the
system's architecture.

Depends on D123810 <https://reviews.llvm.org/D123810>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123812

Files:
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  clang/tools/clang-linker-wrapper/OffloadWrapper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123812.422938.patch
Type: text/x-patch
Size: 14853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220414/edd54e88/attachment-0001.bin>


More information about the cfe-commits mailing list