summaryrefslogtreecommitdiffstats
path: root/clang/test/Driver/openmp-offload-gpu.c
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2018-09-27 16:12:32 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2018-09-27 16:12:32 +0000
commita981f67bcde2f7e0d8c2f1b268c0a156c9e2fef5 (patch)
treee2628ce1674e681520da37a1fbd5791183a74bf0 /clang/test/Driver/openmp-offload-gpu.c
parenta4f68bf4adcd2cc3457a4028e7f0bf7eb89dc002 (diff)
downloadbcm5719-llvm-a981f67bcde2f7e0d8c2f1b268c0a156c9e2fef5.tar.gz
bcm5719-llvm-a981f67bcde2f7e0d8c2f1b268c0a156c9e2fef5.zip
[OpenMP] Improve search for libomptarget-nvptx
When looking for the bclib Clang considered the default library path first while it preferred directories in LIBRARY_PATH when constructing the invocation of nvlink. The latter actually makes more sense because during development it allows using a non-default runtime library. So change the search for the bclib to start looking in directories given by LIBRARY_PATH. Additionally add a new option --libomptarget-nvptx-path= which will be searched first. This will be handy for testing purposes. Differential Revision: https://reviews.llvm.org/D51686 llvm-svn: 343230
Diffstat (limited to 'clang/test/Driver/openmp-offload-gpu.c')
-rw-r--r--clang/test/Driver/openmp-offload-gpu.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/Driver/openmp-offload-gpu.c b/clang/test/Driver/openmp-offload-gpu.c
index e02d500c8f2..c0a85169f80 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -30,6 +30,22 @@
/// ###########################################################################
+/// Check that -lomptarget-nvptx is passed to nvlink.
+// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHK-NVLINK %s
+/// Check that the value of --libomptarget-nvptx-path is forwarded to nvlink.
+// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp \
+// RUN: --libomptarget-nvptx-path=/path/to/libomptarget/ \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
+// RUN: | FileCheck -check-prefixes=CHK-NVLINK,CHK-LIBOMPTARGET-NVPTX-PATH %s
+
+// CHK-NVLINK: nvlink
+// CHK-LIBOMPTARGET-NVPTX-PATH-SAME: "-L/path/to/libomptarget/"
+// CHK-NVLINK-SAME: "-lomptarget-nvptx"
+
+/// ###########################################################################
+
/// Check cubin file generation and usage by nvlink
// RUN: %clang -### -no-canonical-prefixes -target powerpc64le-unknown-linux-gnu -fopenmp=libomp \
// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -save-temps %s 2>&1 \
@@ -151,6 +167,11 @@
// RUN: -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
// RUN: -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-BCLIB %s
+/// The user can override default detection using --libomptarget-nvptx-path=.
+// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda --libomptarget-nvptx-path=%S/Inputs/libomptarget \
+// RUN: -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
+// RUN: -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHK-BCLIB %s
// CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_20.bc
// CHK-BCLIB-NOT: {{error:|warning:}}
OpenPOWER on IntegriCloud