1 | // Checks errors generated by passing a bad value for --cuda-gpu-arch. |
2 | // REQUIRES: clang-driver |
3 | // REQUIRES: x86-registered-target |
4 | // REQUIRES: nvptx-registered-target |
5 | // REQUIRES: amdgpu-registered-target |
6 | |
7 | // RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=compute_20 -c %s 2>&1 \ |
8 | // RUN: | FileCheck -check-prefix BAD %s |
9 | // RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm20 -c %s 2>&1 \ |
10 | // RUN: | FileCheck -check-prefix BAD %s |
11 | // RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_19 -c %s 2>&1 \ |
12 | // RUN: | FileCheck -check-prefix BAD %s |
13 | |
14 | // BAD: error: Unsupported CUDA gpu architecture |
15 | |
16 | // RUN: %clang -### -v --target=x86_64-linux-gnu --cuda-gpu-arch=sm_21 \ |
17 | // RUN: --cuda-path=%S/Inputs/CUDA_90/usr/local/cuda %s 2>&1 \ |
18 | // RUN: | FileCheck -check-prefix BAD_CUDA9 %s |
19 | |
20 | // BAD_CUDA9: GPU arch sm_21 is supported by CUDA versions between 7.0 and 8.0 |
21 | |
22 | // RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 -c %s 2>&1 \ |
23 | // RUN: | FileCheck -check-prefix OK %s |
24 | // RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_52 -c %s 2>&1 \ |
25 | // RUN: | FileCheck -check-prefix OK %s |
26 | // RUN: %clang -### -target x86_64-linux-gnu -c %s 2>&1 \ |
27 | // RUN: | FileCheck -check-prefix OK %s |
28 | |
29 | // We don't allow using NVPTX/AMDGCN for host compilation. |
30 | // RUN: %clang -### --cuda-host-only -target nvptx-nvidia-cuda -c %s 2>&1 \ |
31 | // RUN: | FileCheck -check-prefix HOST_NVPTX %s |
32 | // RUN: %clang -### --cuda-host-only -target amdgcn-amd-amdhsa -c %s 2>&1 \ |
33 | // RUN: | FileCheck -check-prefix HOST_AMDGCN %s |
34 | |
35 | // OK-NOT: error: Unsupported CUDA gpu architecture |
36 | // HOST_NVPTX: error: unsupported architecture 'nvptx' for host compilation. |
37 | // HOST_AMDGCN: error: unsupported architecture 'amdgcn' for host compilation. |
38 | |