[PATCH] D124525: [OpenMP][ClangLinkerWrapper] Extending linker wrapper to embed metadata for multi-arch fat binaries
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 27 08:06:55 PDT 2022
jhuber6 added inline comments.
================
Comment at: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp:1161
- LinkedImages.push_back(*ImageOrErr);
+ LinkedImages.emplace_back(TheArch, *ImageOrErr);
}
----------------
I'm doing something similar in D123810, I just used the existing `DeviceFile` because I needed the `Arch` and `Kind` fields to dispatch the appropriate wrapping job for CUDA / HIP.
================
Comment at: clang/tools/clang-linker-wrapper/OffloadWrapper.cpp:246
IRBuilder<> Builder(BasicBlock::Create(C, "entry", Func));
+ // Create calls to __tgt_register_image_info for each image
+ auto *NullPtr = llvm::ConstantPointerNull::get(Builder.getInt8PtrTy());
----------------
I'm wondering if it would be better to create a new `__tgt_bin_desc` and call a new `__tgt_register_lib` with it here so we don't need multiple calls here. Inside that new runtime function we could just widen or shrink the existing structs as needed. That way each device image would have this metadata associated with it and the target plugin can handle it as-needed.
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