From a981f67bcde2f7e0d8c2f1b268c0a156c9e2fef5 Mon Sep 17 00:00:00 2001 From: Jonas Hahnfeld Date: Thu, 27 Sep 2018 16:12:32 +0000 Subject: [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 --- clang/test/Driver/openmp-offload-gpu.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'clang/test/Driver/openmp-offload-gpu.c') 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:}} -- cgit v1.2.3