diff options
| author | Artem Belevich <tra@google.com> | 2015-11-17 22:28:46 +0000 |
|---|---|---|
| committer | Artem Belevich <tra@google.com> | 2015-11-17 22:28:46 +0000 |
| commit | fa11ab53c05c99329b68fa6105afe2df9b7a8f9e (patch) | |
| tree | 110999d2f926287c9174f40f9f3917497e127e6d /clang/test | |
| parent | 5e2a3ecd48de772e65c4bef2439669390f870f48 (diff) | |
| download | bcm5719-llvm-fa11ab53c05c99329b68fa6105afe2df9b7a8f9e.tar.gz bcm5719-llvm-fa11ab53c05c99329b68fa6105afe2df9b7a8f9e.zip | |
[CUDA] added include paths for both sides of CUDA compilation.
In order to compile a CUDA file clang must be able to find
include files for both both host and device.
This patch passes AuxToolchain to AddPreprocessingOptions and
uses it to add include paths for the opposite side of compilation.
We also must be able to find CUDA include files. If the driver
found CUDA installation, it adds appropriate include path
to CUDA headers. This can be disabled with '-nocudainc'.
- Added include paths for the opposite side of compilation.
- Added include paths to detected CUDA installation.
- Added -nocudainc to prevent adding CUDA include path.
- Added test cases to verify new functionality.
Differential Revision: http://reviews.llvm.org/D13170
llvm-svn: 253386
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Driver/cuda-detect.cu | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/clang/test/Driver/cuda-detect.cu b/clang/test/Driver/cuda-detect.cu index 31e8494027a..182e379df5b 100644 --- a/clang/test/Driver/cuda-detect.cu +++ b/clang/test/Driver/cuda-detect.cu @@ -1,10 +1,34 @@ // REQUIRES: clang-driver // REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target // +// # Check that we properly detect CUDA installation. // RUN: %clang -v --target=i386-unknown-linux \ -// RUN: --sysroot=/tmp/no-cuda-there 2>&1 | FileCheck %s -check-prefix NOCUDA +// RUN: --sysroot=%S/no-cuda-there 2>&1 | FileCheck %s -check-prefix NOCUDA +// RUN: %clang -v --target=i386-unknown-linux \ +// RUN: --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s // RUN: %clang -v --target=i386-unknown-linux \ // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 | FileCheck %s +// Verify that CUDA include path gets added +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ +// RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON -check-prefix CUDAINC +// Verify that -nocudainc disables CUDA include paths. +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ +// RUN: -nocudainc --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOCUDAINC +// We should not add any CUDA include paths if there's no valid CUDA installation +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ +// RUN: --cuda-path=%S/no-cuda-there %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOCUDAINC + // CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA/usr/local/cuda // NOCUDA-NOT: Found CUDA installation: + +// COMMON: "-triple" "nvptx-nvidia-cuda" +// COMMON-SAME: "-fcuda-is-device" +// CUDAINC-SAME: "-internal-isystem" "{{.*}}/Inputs/CUDA/usr/local/cuda/include" +// NOCUDAINC-NOT: "-internal-isystem" "{{.*}}/cuda/include" +// COMMON-SAME: "-x" "cuda" + |

