[PATCH] D124525: [OpenMP][ClangLinkerWrapper] Extending linker wrapper to embed metadata for multi-arch fat binaries

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 09:11:32 PDT 2022


yaxunl added inline comments.


================
Comment at: clang/tools/clang-linker-wrapper/OffloadWrapper.cpp:98-104
+  // struct __tgt_image_info {
+  //   int32_t version;
+  //   int32_t image_number;
+  //   int32_t number_images;
+  //   char* offload_arch;
+  //   char* target_compile_opts;
+  // };
----------------
yaxunl wrote:
> saiislam wrote:
> > yaxunl wrote:
> > > I am wondering whether we should add a few more fields to make it more generic for all offloading languages and platforms:
> > > 
> > > 
> > > ```
> > > char* target_triple;
> > > char* offloading_kind; // openmp, hip, etc
> > > char* file_type; // elf, spirv, bitcode, etc
> > > ```
> > Good idea. Though I am not sure whether file_type info is being propagated in by the linker-wrapper or not. I will check.
> the file_type is for the file embedded by OffloadWrapper, therefore OffloadWrapper knows it.
> 
> Currently it is fatbin or cubin for CUDA and code object (elf) for HIP.
> 
> In the future, it may be spirv or bitcode to allow JIT compilation of spirv or bitcode in runtime so that one binary for all GPU's. OffloadWrapper will decide what is the final file type to embed based on type of embedded binaries in input files, target triple, and compile arguments.
> the file_type is for the file embedded by OffloadWrapper, therefore OffloadWrapper knows it.
> 
> Currently it is fatbin or cubin for CUDA and code object (elf) for HIP.
> 
> In the future, it may be spirv or bitcode to allow JIT compilation of spirv or bitcode in runtime so that one binary for all GPU's. OffloadWrapper will decide what is the final file type to embed based on type of embedded binaries in input files, target triple, and compile arguments.

Sorry I mean ClangLinkerWrapper. ClangLinkerWrapper should somehow pass the file type info to OffloadWrapper.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124525



More information about the cfe-commits mailing list