1 | // REQUIRES: clang-driver |
2 | // REQUIRES: x86-registered-target |
3 | // REQUIRES: nvptx-registered-target |
4 | |
5 | // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \ |
6 | // RUN: FileCheck %s --check-prefix=OK |
7 | // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \ |
8 | // RUN: FileCheck %s --check-prefix=OK |
9 | // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \ |
10 | // RUN: FileCheck %s --check-prefix=OK |
11 | |
12 | // The installation at Inputs/CUDA is CUDA 7.0, which doesn't support sm_60. |
13 | // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \ |
14 | // RUN: FileCheck %s --check-prefix=ERR_SM60 |
15 | |
16 | // This should only complain about sm_60, not sm_35. |
17 | // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_35 \ |
18 | // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \ |
19 | // RUN: FileCheck %s --check-prefix=ERR_SM60 --check-prefix=OK_SM35 |
20 | |
21 | // We should get two errors here, one for sm_60 and one for sm_61. |
22 | // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_61 \ |
23 | // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \ |
24 | // RUN: FileCheck %s --check-prefix=ERR_SM60 --check-prefix=ERR_SM61 |
25 | |
26 | // We should still get an error if we pass -nocudainc, because this compilation |
27 | // would invoke ptxas, and we do a version check on that, too. |
28 | // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 -nocudainc --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \ |
29 | // RUN: FileCheck %s --check-prefix=ERR_SM60 |
30 | |
31 | // If with -nocudainc and -E, we don't touch the CUDA install, so we |
32 | // shouldn't get an error. |
33 | // RUN: %clang --target=x86_64-linux -v -### -E --cuda-device-only --cuda-gpu-arch=sm_60 -nocudainc \ |
34 | // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \ |
35 | // RUN: FileCheck %s --check-prefix=OK |
36 | |
37 | // --no-cuda-version-check should suppress all of these errors. |
38 | // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 \ |
39 | // RUN: --no-cuda-version-check %s | \ |
40 | // RUN: FileCheck %s --check-prefix=OK |
41 | |
42 | // We need to make sure the version check is done only for the device toolchain, |
43 | // therefore we should not get an error in host-only mode. We use the -S here |
44 | // to avoid the error being produced in case by the assembler tool, which does |
45 | // the same check. |
46 | // 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 | \ |
47 | // RUN: FileCheck %s --check-prefix=OK |
48 | // RUN: %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 | \ |
49 | // RUN: FileCheck %s --check-prefix=ERR_SM60 |
50 | |
51 | // OK-NOT: error: GPU arch |
52 | |
53 | // OK_SM35-NOT: error: GPU arch sm_35 |
54 | |
55 | // We should only get one error per architecture. |
56 | // ERR_SM60: error: GPU arch sm_60 {{.*}} |
57 | // ERR_SM60-NOT: error: GPU arch sm_60 |
58 | |
59 | // ERR_SM61: error: GPU arch sm_61 {{.*}} |
60 | // ERR_SM61-NOT: error: GPU arch sm_61 |
61 | |