Skip to content

Commit

Permalink
[OpenMP] Fix file arguments for embedding bitcode in the linker wrapper
Browse files Browse the repository at this point in the history
Summary:
The linker wrapper supports embedding bitcode images instead of linked
device images to facilitate JIT in the device runtime. However, we were
incorrectly passing in the file twice when this option was set. This
patch makes sure we only use the intermediate result of the LTO pass and
don't add the final output to the full job.

In the future we will want to add both of these andle handle that
accoridngly to allow the runtime to either use the AoT compiled version
or JIT compile the bitcode version if availible.
  • Loading branch information
jhuber6 committed May 24, 2022
1 parent 9ba9371 commit 3723868
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Expand Up @@ -1012,8 +1012,14 @@ Error linkBitcodeFiles(SmallVectorImpl<std::string> &InputFiles,
if (Error Err = LTOBackend->run(AddStream))
return Err;

// If we are embedding bitcode we only need the intermediate output.
if (EmbedBitcode) {
InputFiles = NewInputFiles;
return Error::success();
}

// Is we are compiling for NVPTX we need to run the assembler first.
if (TheTriple.isNVPTX() && !EmbedBitcode) {
if (TheTriple.isNVPTX()) {
for (auto &File : Files) {
auto FileOrErr = nvptx::assemble(File, TheTriple, Arch, !WholeProgram);
if (!FileOrErr)
Expand Down

0 comments on commit 3723868

Please sign in to comment.