[PATCH] D101630: [HIP] Fix device-only compilation

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 30 07:12:05 PDT 2021


yaxunl created this revision.
yaxunl added a reviewer: tra.
yaxunl requested review of this revision.

When clang compiles a HIP program with -E, there are multiple output
files for host and different GPU archs. Clang uses clang-offload-bundler
to bundle them as one output file.

Currently clang does this for combined host/device compilation but does not do
it for device-only compilation. This causes issue when there are multiple
GPU arch's in device-only compilation. If -o is specified, the output for
different GPU arch's will overwrite each other.

This patch fixes that by bundling the output files if there are multiple
GPU arch's. This is consistent with the behavior for combined host/device compilation.
Clang will automatically unbundle it if the preprocessor expansion output
is used as input.

The same thing with -emit-llvm or -S.


https://reviews.llvm.org/D101630

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/clang-offload-bundler.c
  clang/test/Driver/hip-output-file-name.hip
  clang/test/Driver/hip-phases.hip
  clang/test/Driver/hip-rdc-device-only.hip
  clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101630.341889.patch
Type: text/x-patch
Size: 16025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210430/629645b9/attachment-0001.bin>


More information about the cfe-commits mailing list