[PATCH] D52377: [HIP] Support early finalization of device code
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 21 13:27:45 PDT 2018
yaxunl created this revision.
yaxunl added a reviewer: tra.
This patch introduced a driver option `--hip-early-finalize`. When enabled,
clang will assume the device code in each translation unit does not call
external functions except those in the device library, therefore it is possible
to compile the device code in each translation unit to self-contained kernels
and embed them in the host object, so that the host object behaves like
usual host object which can be linked by lld.
The benefits of this feature is: 1. allow users to create static libraries which
can be linked by host linker; 2. amortized device code linking time.
This patch modifies HIP action builder to insert actions for linking device
code and generating HIP fatbin, and pass HIP fatbin to host backend action.
It extracts code for constructing command for generating HIP fatbin as
a function so that it can be reused by early finalization. It also modifies
codegen of HIP host constructor functions to embed the device fatbin
when it is available.
https://reviews.llvm.org/D52377
Files:
include/clang/Driver/Options.td
include/clang/Driver/Types.def
lib/CodeGen/CGCUDANV.cpp
lib/Driver/Driver.cpp
lib/Driver/ToolChains/Clang.cpp
lib/Driver/ToolChains/CommonArgs.cpp
lib/Driver/ToolChains/HIP.cpp
lib/Driver/ToolChains/HIP.h
test/CodeGenCUDA/device-stub.cu
test/Driver/cuda-phases.cu
test/Driver/hip-early-finalize.hip
test/Driver/hip-toolchain.hip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52377.166540.patch
Type: text/x-patch
Size: 31108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180921/dc7994a6/attachment-0001.bin>
More information about the cfe-commits
mailing list