1 // REQUIRES: x86-registered-target
2 // REQUIRES: nvptx-registered-target
4 // RUN: not %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
5 // RUN: FileCheck %s --check-prefix=OK
6 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \
7 // RUN: FileCheck %s --check-prefix=OK
8 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \
9 // RUN: FileCheck %s --check-prefix=OK
10 // Test version guess when cuda.h has not been found
11 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
12 // RUN: FileCheck %s --check-prefix=UNKNOWN_VERSION
13 // Unknown version info present in cuda.h
14 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-new/usr/local/cuda 2>&1 %s | \
15 // RUN: FileCheck %s --check-prefix=UNKNOWN_VERSION
16 // Make sure that we don't warn about CUDA version during C++ compilation.
17 // RUN: %clang --target=x86_64-linux -v -### -x c++ --cuda-gpu-arch=sm_60 \
18 // RUN: --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
19 // RUN: FileCheck %s --check-prefix=UNKNOWN_VERSION_CXX
21 // The installation at Inputs/CUDA is CUDA 7.0, which doesn't support sm_60.
22 // RUN: not %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
23 // RUN: FileCheck %s --check-prefix=ERR_SM60
25 // This should only complain about sm_60, not sm_35.
26 // RUN: not %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_35 \
27 // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
28 // RUN: FileCheck %s --check-prefix=ERR_SM60 --check-prefix=OK_SM35
30 // We should get two errors here, one for sm_60 and one for sm_61.
31 // RUN: not %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_61 \
32 // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
33 // RUN: FileCheck %s --check-prefix=ERR_SM60 --check-prefix=ERR_SM61
35 // We should still get an error if we pass -nocudainc, because this compilation
36 // would invoke ptxas, and we do a version check on that, too.
37 // RUN: not %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 -nocudainc --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
38 // RUN: FileCheck %s --check-prefix=ERR_SM60
40 // If with -nocudainc and -E, we don't touch the CUDA install, so we
41 // shouldn't get an error.
42 // RUN: %clang --target=x86_64-linux -v -### -E --cuda-device-only --cuda-gpu-arch=sm_60 -nocudainc \
43 // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
44 // RUN: FileCheck %s --check-prefix=OK
46 // --no-cuda-version-check should suppress all of these errors.
47 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 \
48 // RUN: --no-cuda-version-check %s | \
49 // RUN: FileCheck %s --check-prefix=OK
51 // We need to make sure the version check is done only for the device toolchain,
52 // therefore we should not get an error in host-only mode. We use the -S here
53 // to avoid the error being produced in case by the assembler tool, which does
55 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-host-only --cuda-path=%S/Inputs/CUDA/usr/local/cuda -S 2>&1 %s | \
56 // RUN: FileCheck %s --check-prefix=OK
57 // RUN: not %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-device-only --cuda-path=%S/Inputs/CUDA/usr/local/cuda -S 2>&1 %s | \
58 // RUN: FileCheck %s --check-prefix=ERR_SM60
60 // OK-NOT: error: GPU arch
62 // OK_SM35-NOT: error: GPU arch sm_35
64 // We should only get one error per architecture.
65 // ERR_SM20: error: GPU arch sm_20 {{.*}}
66 // ERR_SM20-NOT: error: GPU arch sm_20
68 // ERR_SM60: error: GPU arch sm_60 {{.*}}
69 // ERR_SM60-NOT: error: GPU arch sm_60
71 // ERR_SM61: error: GPU arch sm_61 {{.*}}
72 // ERR_SM61-NOT: error: GPU arch sm_61
74 // UNKNOWN_VERSION: CUDA version is newer than the latest{{.*}} supported version
75 // UNKNOWN_VERSION_CXX-NOT: unknown CUDA version
77 // Check to make sure we do not emit these warnings for OpenMP or cross-compilation.
78 // RUN: %clang --target=x86_64-linux -v -### -fopenmp -nogpulib --offload-arch=sm_60 --cuda-path=%S/Inputs/CUDA-new/usr/local/cuda 2>&1 -x c %s | \
79 // RUN: FileCheck %s --check-prefix=VERSION
80 // RUN: %clang --target=nvptx64-nvidia-cuda -v -### -nogpulib -march=sm_60 --cuda-path=%S/Inputs/CUDA-new/usr/local/cuda 2>&1 -x c %s | \
81 // RUN: FileCheck %s --check-prefix=VERSION
82 // VERSION-NOT: CUDA version is newer than the latest{{.*}} supported version