1 // Tests the bindings generated for a CUDA offloading target for different
3 // - Number of gpu architectures;
4 // - Host/device-only compilation;
5 // - User-requested final phase - binary or assembly.
6 // It parallels cuda-phases.cu test, but verifies whether output file is temporary or not.
8 // It's hard to check whether file name is temporary in a portable
9 // way. Instead we check whether we've generated a permanent name on
10 // device side, which appends '-device-cuda-<triple>' suffix.
12 // REQUIRES: clang-driver
13 // REQUIRES: powerpc-registered-target
14 // REQUIRES: nvptx-registered-target
17 // Test single gpu architecture with complete compilation.
18 // No intermediary device files should have "-device-cuda..." in the name.
20 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings --cuda-gpu-arch=sm_30 %s 2>&1 \
21 // RUN: | FileCheck -check-prefix=BIN %s
22 // BIN: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output:
23 // BIN-NOT: cuda-bindings-device-cuda-nvptx64
24 // BIN: # "nvptx64-nvidia-cuda" - "NVPTX::Assembler",{{.*}} output:
25 // BIN-NOT: cuda-bindings-device-cuda-nvptx64
26 // BIN: # "nvptx64-nvidia-cuda" - "NVPTX::Linker",{{.*}} output:
27 // BIN-NOT: cuda-bindings-device-cuda-nvptx64
28 // BIN: # "powerpc64le-ibm-linux-gnu" - "clang",{{.*}} output:
29 // BIN-NOT: cuda-bindings-device-cuda-nvptx64
30 // BIN: # "powerpc64le-ibm-linux-gnu" - "GNU::Linker", inputs:{{.*}}, output: "a.out"
33 // Test single gpu architecture up to the assemble phase.
35 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings --cuda-gpu-arch=sm_30 %s -S 2>&1 \
36 // RUN: | FileCheck -check-prefix=ASM %s
37 // ASM-DAG: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_30.s"
38 // ASM-DAG: # "powerpc64le-ibm-linux-gnu" - "clang",{{.*}} output: "cuda-bindings.s"
41 // Test two gpu architectures with complete compilation.
43 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings --cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s 2>&1 \
44 // RUN: | FileCheck -check-prefix=BIN2 %s
45 // BIN2: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output:
46 // BIN2-NOT: cuda-bindings-device-cuda-nvptx64
47 // BIN2: # "nvptx64-nvidia-cuda" - "NVPTX::Assembler",{{.*}} output:
48 // BIN2-NOT: cuda-bindings-device-cuda-nvptx64
49 // BIN2: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output:
50 // BIN2-NOT: cuda-bindings-device-cuda-nvptx64
51 // BIN2: # "nvptx64-nvidia-cuda" - "NVPTX::Assembler",{{.*}} output:
52 // BIN2-NOT: cuda-bindings-device-cuda-nvptx64
53 // BIN2: # "nvptx64-nvidia-cuda" - "NVPTX::Linker",{{.*}} output:
54 // BIN2-NOT: cuda-bindings-device-cuda-nvptx64
55 // BIN2: # "powerpc64le-ibm-linux-gnu" - "clang",{{.*}} output:
56 // BIN2-NOT: cuda-bindings-device-cuda-nvptx64
57 // BIN2: # "powerpc64le-ibm-linux-gnu" - "GNU::Linker", inputs:{{.*}}, output: "a.out"
60 // Test two gpu architectures up to the assemble phase.
62 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings \
63 // RUN: --cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s -S 2>&1 \
64 // RUN: | FileCheck -check-prefix=ASM2 %s
65 // ASM2-DAG: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_30.s"
66 // ASM2-DAG: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_35.s"
67 // ASM2-DAG: # "powerpc64le-ibm-linux-gnu" - "clang",{{.*}} output: "cuda-bindings.s"
70 // Test one or more gpu architecture with complete compilation in host-only
73 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings \
74 // RUN: --cuda-gpu-arch=sm_30 %s --cuda-host-only 2>&1 \
75 // RUN: | FileCheck -check-prefix=HBIN %s
76 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings \
77 // RUN: --cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s --cuda-host-only 2>&1 \
78 // RUN: | FileCheck -check-prefix=HBIN %s
79 // HBIN: # "powerpc64le-ibm-linux-gnu" - "clang",{{.*}} output:
80 // HBIN-NOT: cuda-bindings-device-cuda-nvptx64
81 // HBIN: # "powerpc64le-ibm-linux-gnu" - "GNU::Linker", inputs:{{.*}}, output: "a.out"
84 // Test one or more gpu architecture up to the assemble phase in host-only
87 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings \
88 // RUN: --cuda-gpu-arch=sm_30 %s --cuda-host-only -S 2>&1 \
89 // RUN: | FileCheck -check-prefix=HASM %s
90 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings \
91 // RUN: --cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s --cuda-host-only -S 2>&1 \
92 // RUN: | FileCheck -check-prefix=HASM %s
93 // HASM: # "powerpc64le-ibm-linux-gnu" - "clang",{{.*}} output: "cuda-bindings.s"
96 // Test single gpu architecture with complete compilation in device-only
99 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings \
100 // RUN: --cuda-gpu-arch=sm_30 %s --cuda-device-only 2>&1 \
101 // RUN: | FileCheck -check-prefix=DBIN %s
102 // DBIN: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output:
103 // DBIN-NOT: cuda-bindings-device-cuda-nvptx64
104 // DBIN: # "nvptx64-nvidia-cuda" - "NVPTX::Assembler",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_30.o"
107 // Test single gpu architecture up to the assemble phase in device-only
110 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings \
111 // RUN: --cuda-gpu-arch=sm_30 %s --cuda-device-only -S 2>&1 \
112 // RUN: | FileCheck -check-prefix=DASM %s
113 // DASM: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_30.s"
116 // Test two gpu architectures with complete compilation in device-only
119 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings \
120 // RUN: --cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s --cuda-device-only 2>&1 \
121 // RUN: | FileCheck -check-prefix=DBIN2 %s
122 // DBIN2: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output:
123 // DBIN2-NOT: cuda-bindings-device-cuda-nvptx64
124 // DBIN2: # "nvptx64-nvidia-cuda" - "NVPTX::Assembler",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_30.o"
125 // DBIN2: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output:
126 // DBIN2-NOT: cuda-bindings-device-cuda-nvptx64
127 // DBIN2: # "nvptx64-nvidia-cuda" - "NVPTX::Assembler",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_35.o"
130 // Test two gpu architectures up to the assemble phase in device-only
133 // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-bindings \
134 // RUN: --cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s --cuda-device-only -S 2>&1 \
135 // RUN: | FileCheck -check-prefix=DASM2 %s
136 // DASM2: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_30.s"
137 // DASM2: # "nvptx64-nvidia-cuda" - "clang",{{.*}} output: "cuda-bindings-cuda-nvptx64-nvidia-cuda-sm_35.s"