[PATCH] D88734: [HIP] Align device binary

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 2 05:54:48 PDT 2020


yaxunl created this revision.
yaxunl added reviewers: tra, ashi1.
yaxunl requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

To facilitate faster loading of device binaries and share them among processes,
HIP runtime favors their alignment being 4096 bytes. HIP runtime can load
unaligned device binaries, however, aligning them at 4096 bytes results in
faster loading and less shared memory usage.

This patch adds an option -bundle-align to clang-offload-bundler which allows
bundles to be aligned at specified alignment. By default it is 1, which is NFC
compared to existing format.

This patch then aligns embedded fat binary and device binary inside fat binary
at 4096 bytes.

It has been verified this change does not cause significant overall file size increase
for typical HIP applications (less than 1%).


https://reviews.llvm.org/D88734

Files:
  clang/lib/CodeGen/CGCUDANV.cpp
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/test/CodeGenCUDA/device-stub.cu
  clang/test/Driver/clang-offload-bundler.c
  clang/test/Driver/hip-toolchain-no-rdc.hip
  clang/test/Driver/hip-toolchain-rdc.hip
  clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88734.295804.patch
Type: text/x-patch
Size: 8119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201002/16b25112/attachment-0001.bin>


More information about the cfe-commits mailing list