[PATCH] D131278: [CUDA] Fix output name being replaced in device-only mode

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 5 16:09:01 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3b52341116b7: [CUDA] Fix output name being replaced in device-only mode (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131278

Files:
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/test/Driver/cuda-bindings.cu


Index: clang/test/Driver/cuda-bindings.cu
===================================================================
--- clang/test/Driver/cuda-bindings.cu
+++ clang/test/Driver/cuda-bindings.cu
@@ -135,3 +135,14 @@
 // RUN: | FileCheck -check-prefix=DASM2 %s
 // DASM2: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_30.s"
 // DASM2: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_35.s"
+
+//
+// Ensure we output the user's specified name in device-only mode.
+//
+// RUN: %clang -target powerpc64le-ibm-linux-gnu -### \
+// RUN:        --cuda-gpu-arch=sm_52 --cuda-device-only -c -o foo.o %s 2>&1 \
+// RUN: | FileCheck -check-prefix=D_ONLY %s
+// RUN: %clang -target powerpc64le-ibm-linux-gnu -### --offload-new-driver \
+// RUN:        --cuda-gpu-arch=sm_52 --cuda-device-only -c -o foo.o %s 2>&1 \
+// RUN: | FileCheck -check-prefix=D_ONLY %s
+// D_ONLY: "foo.o"
Index: clang/lib/Driver/ToolChains/Cuda.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -693,8 +693,8 @@
 
 std::string CudaToolChain::getInputFilename(const InputInfo &Input) const {
   // Only object files are changed, for example assembly files keep their .s
-  // extensions. 
-  if (Input.getType() != types::TY_Object)
+  // extensions. If the user requested device-only compilation don't change it.
+  if (Input.getType() != types::TY_Object || getDriver().offloadDeviceOnly())
     return ToolChain::getInputFilename(Input);
 
   // Replace extension for object files with cubin because nvlink relies on


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131278.450443.patch
Type: text/x-patch
Size: 1673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220805/e5adf798/attachment.bin>


More information about the cfe-commits mailing list