[PATCH] D37913: [OpenMP] Enable the existing nocudalib flag for OpenMP offloading toolchain.
Gheorghe-Teodor Bercea via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 18 11:33:39 PDT 2017
gtbercea updated this revision to Diff 115692.
gtbercea added a comment.
Add test.
Repository:
rL LLVM
https://reviews.llvm.org/D37913
Files:
lib/Driver/ToolChains/Cuda.cpp
test/Driver/openmp-offload-gpu.c
Index: test/Driver/openmp-offload-gpu.c
===================================================================
--- test/Driver/openmp-offload-gpu.c
+++ test/Driver/openmp-offload-gpu.c
@@ -125,3 +125,12 @@
// RUN: | FileCheck -check-prefix=CHK-PTXAS-RELO %s
// CHK-PTXAS-RELO: ptxas{{.*}}" "-c"
+
+/// ###########################################################################
+
+/// Check that error is not thrown by toolchain when no cuda lib flag is used.
+/// Check that the flag is passed when -fopenmp-relocatable-target is used.
+// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_99 -nocudalib -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHK-FLAG-NOLIBDEVICE %s
+
+// CHK-FLAG-NOLIBDEVICE-NOT: error:{{.*}}sm_99
Index: lib/Driver/ToolChains/Cuda.cpp
===================================================================
--- lib/Driver/ToolChains/Cuda.cpp
+++ lib/Driver/ToolChains/Cuda.cpp
@@ -253,7 +253,8 @@
// Obtain architecture from the action.
CudaArch gpu_arch = StringToCudaArch(GPUArchName);
- assert(gpu_arch != CudaArch::UNKNOWN &&
+ assert((gpu_arch != CudaArch::UNKNOWN ||
+ Args.hasArg(options::OPT_nocudalib)) &&
"Device action expected to have an architecture.");
// Check that our installation's ptxas supports gpu_arch.
@@ -492,11 +493,11 @@
if (DriverArgs.hasFlag(options::OPT_fcuda_approx_transcendentals,
options::OPT_fno_cuda_approx_transcendentals, false))
CC1Args.push_back("-fcuda-approx-transcendentals");
-
- if (DriverArgs.hasArg(options::OPT_nocudalib))
- return;
}
+ if (DriverArgs.hasArg(options::OPT_nocudalib))
+ return;
+
std::string LibDeviceFile = CudaInstallation.getLibDeviceFile(GpuArch);
if (LibDeviceFile.empty()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37913.115692.patch
Type: text/x-patch
Size: 1882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170918/3cfe6425/attachment.bin>
More information about the cfe-commits
mailing list