[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 10:26:28 PDT 2022


jhuber6 added inline comments.


================
Comment at: clang/docs/ClangOffloadPackager.rst:31-32
+    uint32_t Flags;
+    StringMap<StringRef> StringData;
+    MemoryBufferRef Image;
+  };
----------------
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.


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