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

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 11:33:56 PDT 2022


jhuber6 added inline comments.


================
Comment at: clang/docs/ClangOffloadPackager.rst:31-32
+    uint32_t Flags;
+    StringMap<StringRef> StringData;
+    MemoryBufferRef Image;
+  };
----------------
yaxunl wrote:
> jhuber6 wrote:
> > yaxunl wrote:
> > > This makes the file format depend on LLVM version and potentially standard C++ library version.
> > > 
> > > If it is consumed by the same version of LLVM, it may be fine.
> > > 
> > > However, if it is intended for a generic file format to be consumed by generic offloading language runtimes, it is better to use C-like simple data layout which does not depend on LLVM or standard C++ library.
> > That format just stores the data before it's serialized to a binary format. The binary format is basically just a few headers and a string table. See https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Object/OffloadBinary.h#L91 for the real format. I didn't want to explain it all in detail here.
> If the file format is intended to be consumed by generic offloading language runtimes or development tools, better to describe its layout like https://clang.llvm.org/docs/ClangOffloadBundler.html
> 
> Since language runtimes or development tools may not use LLVM to load the file. The documentation serves as a spec for this binary format.
> 
> Especially, it is not clear where to find the target triple and GPU arch for each image in this documentation.
Sure, I'll add some more comprehensive documentation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125165/new/

https://reviews.llvm.org/D125165



More information about the cfe-commits mailing list