[PATCH] D125165: [Clang] Introduce clang-offload-binary tool to bundle device files

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 7 04:59:53 PDT 2022


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, JonChesterfield, saiislam, yaxunl, tra.
Herald added subscribers: ormris, kerbowa, mgorny, jvesely.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, MaskRay.
Herald added a project: clang.

In order to do offloading compilation we need to embed files into the
host and create fatbainaries. Clang uses a special binary format to
bundle several files along with their metadata into a single binary
image. This is currently performed using the `-fembed-offload-binary`
option. However this is not very extensibile since it requires changing
the command flag every time we want to add something and makes optional
arguments difficult. This patch introduces a new tool called
`clang-offload-binary` that behaves similarly to CUDA's `fatbinary`.
This tool takes several input files with metadata and embeds it into a
single image that can then be embedded in the host.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125165

Files:
  clang/docs/ClangOffloadBinary.rst
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Action.h
  clang/include/clang/Driver/ToolChain.h
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/Action.cpp
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Clang.h
  clang/test/Driver/amdgpu-openmp-toolchain-new.c
  clang/test/Driver/cuda-openmp-driver.cu
  clang/test/Driver/cuda-phases.cu
  clang/test/Driver/linker-wrapper-image.c
  clang/test/Driver/linker-wrapper.c
  clang/test/Driver/openmp-offload-gpu-new.c
  clang/test/Driver/openmp-offload-infer.c
  clang/test/Frontend/embed-object.c
  clang/test/Frontend/embed-object.ll
  clang/test/lit.cfg.py
  clang/tools/CMakeLists.txt
  clang/tools/clang-offload-binary/CMakeLists.txt
  clang/tools/clang-offload-binary/ClangOffloadBinary.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125165.427847.patch
Type: text/x-patch
Size: 45334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220507/d5571e64/attachment-0001.bin>


More information about the cfe-commits mailing list