[PATCH] D87791: [CUDA][HIP] Fix -gsplit-dwarf option

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 19:54:59 PDT 2020


yaxunl marked an inline comment as done.
yaxunl added a comment.

In D87791#2277887 <https://reviews.llvm.org/D87791#2277887>, @tra wrote:

> Does this naming scheme the same as used for `.o` files? We may want to keep them in sync.
>
> Other than that, LGTM.

.o file is different story.

For -fno-gpu-rdc, the .o files for device compilation are temporary files which are deleted after the device ISA are generated and embedded in host .o file. There is only one output .o file which is the host object file.

For -fgpu-rdc, the .o files for device compilation are also temporary files which are bundled into the clang-offload-bundle. There is only one output .o file which is a bundle.

Therefore in either case there is no need to rename the intermediate .o files since they are temporary files which have unique names.

The .dwo files are not temporary files. They are supposed to be shipped with .o files for debugging info.

Since .dwo files are not temporary files, it is not necessary to follow the -save-temps name convention. For the host object, we keep the original .dwo file name. For the device object, we add '_' and GPU arch to the stem, which is sufficient and concise.



================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:909
+  auto AddPostfix = [JA](auto &F) {
+    if (JA.getOffloadingDeviceKind() == Action::OFK_HIP)
+      F += (Twine("_") + JA.getOffloadingArch()).str();
----------------
tra wrote:
> I think the same approach would make sense for CUDA, too. 
will include OFK_CUDA.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87791/new/

https://reviews.llvm.org/D87791



More information about the cfe-commits mailing list