Artem Belevich | 98607b6 | 2015-09-23 21:49:39 +0000 | [diff] [blame] | 1 | // REQUIRES: clang-driver |
| 2 | // REQUIRES: x86-registered-target |
Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 3 | // REQUIRES: nvptx-registered-target |
Artem Belevich | 98607b6 | 2015-09-23 21:49:39 +0000 | [diff] [blame] | 4 | // |
Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 5 | // # Check that we properly detect CUDA installation. |
Artem Belevich | 98607b6 | 2015-09-23 21:49:39 +0000 | [diff] [blame] | 6 | // RUN: %clang -v --target=i386-unknown-linux \ |
Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 7 | // RUN: --sysroot=%S/no-cuda-there 2>&1 | FileCheck %s -check-prefix NOCUDA |
| 8 | // RUN: %clang -v --target=i386-unknown-linux \ |
| 9 | // RUN: --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s |
Artem Belevich | 98607b6 | 2015-09-23 21:49:39 +0000 | [diff] [blame] | 10 | // RUN: %clang -v --target=i386-unknown-linux \ |
Artem Belevich | 98607b6 | 2015-09-23 21:49:39 +0000 | [diff] [blame] | 11 | // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 | FileCheck %s |
| 12 | |
Artem Belevich | 34f481a | 2015-11-17 22:28:50 +0000 | [diff] [blame] | 13 | // Make sure we map libdevice bitcode files to proper GPUs. |
| 14 | // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_21 \ |
| 15 | // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ |
| 16 | // RUN: | FileCheck %s -check-prefix COMMON \ |
| 17 | // RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE21 |
Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 18 | // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ |
| 19 | // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ |
Artem Belevich | 34f481a | 2015-11-17 22:28:50 +0000 | [diff] [blame] | 20 | // RUN: | FileCheck %s -check-prefix COMMON -check-prefix CUDAINC \ |
| 21 | // RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE35 |
| 22 | // Verify that -nocudainc prevents adding include path to CUDA headers. |
Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 23 | // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ |
| 24 | // RUN: -nocudainc --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ |
Artem Belevich | 34f481a | 2015-11-17 22:28:50 +0000 | [diff] [blame] | 25 | // RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOCUDAINC \ |
| 26 | // RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE35 |
Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 27 | // We should not add any CUDA include paths if there's no valid CUDA installation |
| 28 | // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ |
| 29 | // RUN: --cuda-path=%S/no-cuda-there %s 2>&1 \ |
| 30 | // RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOCUDAINC |
| 31 | |
Artem Belevich | 34f481a | 2015-11-17 22:28:50 +0000 | [diff] [blame] | 32 | // Verify that no options related to bitcode linking are passes if |
| 33 | // there's no bitcode file. |
| 34 | // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_30 \ |
| 35 | // RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ |
| 36 | // RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOLIBDEVICE |
| 37 | // .. or if we explicitly passed -nocudalib |
| 38 | // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ |
| 39 | // RUN: -nocudalib --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ |
| 40 | // RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOLIBDEVICE |
Artem Belevich | 8601733 | 2015-11-17 22:28:55 +0000 | [diff] [blame^] | 41 | // Verify that we don't add include paths, link with libdevice or |
| 42 | // -include cuda_runtime without valid CUDA installation. |
| 43 | // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ |
| 44 | // RUN: --cuda-path=%S/no-cuda-there %s 2>&1 \ |
| 45 | // RUN: | FileCheck %s -check-prefix COMMON \ |
| 46 | // RUN: -check-prefix NOCUDAINC -check-prefix NOLIBDEVICE |
Artem Belevich | 34f481a | 2015-11-17 22:28:50 +0000 | [diff] [blame] | 47 | |
Artem Belevich | 98607b6 | 2015-09-23 21:49:39 +0000 | [diff] [blame] | 48 | // CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA/usr/local/cuda |
| 49 | // NOCUDA-NOT: Found CUDA installation: |
Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 50 | |
| 51 | // COMMON: "-triple" "nvptx-nvidia-cuda" |
| 52 | // COMMON-SAME: "-fcuda-is-device" |
Artem Belevich | 34f481a | 2015-11-17 22:28:50 +0000 | [diff] [blame] | 53 | // LIBDEVICE-SAME: "-mlink-cuda-bitcode" |
| 54 | // NOLIBDEVICE-NOT: "-mlink-cuda-bitcode" |
| 55 | // LIBDEVICE21-SAME: libdevice.compute_20.10.bc |
| 56 | // LIBDEVICE35-SAME: libdevice.compute_35.10.bc |
| 57 | // NOLIBDEVICE-NOT: libdevice.compute_{{.*}}.bc |
| 58 | // LIBDEVICE-SAME: "-target-feature" "+ptx42" |
| 59 | // NOLIBDEVICE-NOT: "-target-feature" "+ptx42" |
Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 60 | // CUDAINC-SAME: "-internal-isystem" "{{.*}}/Inputs/CUDA/usr/local/cuda/include" |
| 61 | // NOCUDAINC-NOT: "-internal-isystem" "{{.*}}/cuda/include" |
Artem Belevich | 8601733 | 2015-11-17 22:28:55 +0000 | [diff] [blame^] | 62 | // CUDAINC-SAME: "-include" "cuda_runtime.h" |
| 63 | // NOCUDAINC-NOT: "-include" "cuda_runtime.h" |
Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 64 | // COMMON-SAME: "-x" "cuda" |