blob: dc4dbd1f37c979149120d91595f4a27bc8d67777 [file] [log] [blame]
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +00001///
2/// Perform several driver tests for OpenMP offloading
3///
4
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +00005// REQUIRES: clang-driver
6// REQUIRES: x86-registered-target
7// REQUIRES: powerpc-registered-target
8// REQUIRES: nvptx-registered-target
9
10/// ###########################################################################
11
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +000012/// Check -Xopenmp-target uses one of the archs provided when several archs are used.
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000013// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
14// RUN: -Xopenmp-target -march=sm_35 -Xopenmp-target -march=sm_60 %s 2>&1 \
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +000015// RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-ARCHS %s
16
17// CHK-FOPENMP-TARGET-ARCHS: ptxas{{.*}}" "--gpu-name" "sm_60"
18// CHK-FOPENMP-TARGET-ARCHS: nvlink{{.*}}" "-arch" "sm_60"
19
20/// ###########################################################################
21
22/// Check -Xopenmp-target -march=sm_35 works as expected when two triples are present.
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000023// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp \
24// RUN: -fopenmp-targets=powerpc64le-ibm-linux-gnu,nvptx64-nvidia-cuda \
25// RUN: -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_35 %s 2>&1 \
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +000026// RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-COMPILATION %s
27
28// CHK-FOPENMP-TARGET-COMPILATION: ptxas{{.*}}" "--gpu-name" "sm_35"
29// CHK-FOPENMP-TARGET-COMPILATION: nvlink{{.*}}" "-arch" "sm_35"
30
31/// ###########################################################################
32
Jonas Hahnfelda981f672018-09-27 16:12:32 +000033/// Check that -lomptarget-nvptx is passed to nvlink.
34// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp \
35// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
36// RUN: | FileCheck -check-prefix=CHK-NVLINK %s
37/// Check that the value of --libomptarget-nvptx-path is forwarded to nvlink.
38// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp \
39// RUN: --libomptarget-nvptx-path=/path/to/libomptarget/ \
40// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
41// RUN: | FileCheck -check-prefixes=CHK-NVLINK,CHK-LIBOMPTARGET-NVPTX-PATH %s
42
43// CHK-NVLINK: nvlink
44// CHK-LIBOMPTARGET-NVPTX-PATH-SAME: "-L/path/to/libomptarget/"
45// CHK-NVLINK-SAME: "-lomptarget-nvptx"
46
47/// ###########################################################################
48
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +000049/// Check cubin file generation and usage by nvlink
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000050// RUN: %clang -### -no-canonical-prefixes -target powerpc64le-unknown-linux-gnu -fopenmp=libomp \
51// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -save-temps %s 2>&1 \
52// RUN: | FileCheck -check-prefix=CHK-CUBIN-NVLINK %s
53/// Check cubin file generation and usage by nvlink when toolchain has BindArchAction
54// RUN: %clang -### -no-canonical-prefixes -target x86_64-apple-darwin17.0.0 -fopenmp=libomp \
55// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
56// RUN: | FileCheck -check-prefix=CHK-CUBIN-NVLINK %s
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +000057
Sergey Dmitrieva0d83762019-10-09 20:42:58 +000058// CHK-CUBIN-NVLINK: clang{{.*}}" {{.*}}"-fopenmp-is-device" {{.*}}"-o" "[[PTX:.*\.s]]"
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000059// CHK-CUBIN-NVLINK-NEXT: ptxas{{.*}}" "--output-file" "[[CUBIN:.*\.cubin]]" {{.*}}"[[PTX]]"
60// CHK-CUBIN-NVLINK-NEXT: nvlink{{.*}}" {{.*}}"[[CUBIN]]"
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +000061
62/// ###########################################################################
63
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000064/// Check unbundlink of assembly file, cubin file generation and usage by nvlink
65// RUN: touch %t.s
Jonas Hahnfeld4609b252017-11-21 15:06:28 +000066// RUN: %clang -### -target powerpc64le-unknown-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
67// RUN: -no-canonical-prefixes -save-temps %t.s 2>&1 \
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000068// RUN: | FileCheck -check-prefix=CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK %s
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +000069
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000070/// Use DAG to ensure that assembly file has been unbundled.
71// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK-DAG: ptxas{{.*}}" "--output-file" "[[CUBIN:.*\.cubin]]" {{.*}}"[[PTX:.*\.s]]"
72// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK-DAG: clang-offload-bundler{{.*}}" "-type=s" {{.*}}"-outputs={{.*}}[[PTX]]
73// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK-DAG-SAME: "-unbundle"
74// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK: nvlink{{.*}}" {{.*}}"[[CUBIN]]"
75
76/// ###########################################################################
77
78/// Check cubin file generation and bundling
Jonas Hahnfeld4609b252017-11-21 15:06:28 +000079// RUN: %clang -### -target powerpc64le-unknown-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
80// RUN: -no-canonical-prefixes -save-temps %s -c 2>&1 \
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000081// RUN: | FileCheck -check-prefix=CHK-PTXAS-CUBIN-BUNDLING %s
82
83// CHK-PTXAS-CUBIN-BUNDLING: clang{{.*}}" "-o" "[[PTX:.*\.s]]"
84// CHK-PTXAS-CUBIN-BUNDLING-NEXT: ptxas{{.*}}" "--output-file" "[[CUBIN:.*\.cubin]]" {{.*}}"[[PTX]]"
85// CHK-PTXAS-CUBIN-BUNDLING: clang-offload-bundler{{.*}}" "-type=o" {{.*}}"-inputs={{.*}}[[CUBIN]]
86
87/// ###########################################################################
88
89/// Check cubin file unbundling and usage by nvlink
90// RUN: touch %t.o
Jonas Hahnfeld4609b252017-11-21 15:06:28 +000091// RUN: %clang -### -target powerpc64le-unknown-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
Alexey Bataeva5178f52018-09-28 16:17:59 +000092// RUN: -no-canonical-prefixes -save-temps %t.o %S/Inputs/in.so 2>&1 \
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000093// RUN: | FileCheck -check-prefix=CHK-CUBIN-UNBUNDLING-NVLINK %s
94
95/// Use DAG to ensure that cubin file has been unbundled.
Alexey Bataeva5178f52018-09-28 16:17:59 +000096// CHK-CUBIN-UNBUNDLING-NVLINK-NOT: clang-offload-bundler{{.*}}" "-type=o"{{.*}}in.so
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +000097// CHK-CUBIN-UNBUNDLING-NVLINK-DAG: nvlink{{.*}}" {{.*}}"[[CUBIN:.*\.cubin]]"
98// CHK-CUBIN-UNBUNDLING-NVLINK-DAG: clang-offload-bundler{{.*}}" "-type=o" {{.*}}"-outputs={{.*}}[[CUBIN]]
99// CHK-CUBIN-UNBUNDLING-NVLINK-DAG-SAME: "-unbundle"
Alexey Bataeva5178f52018-09-28 16:17:59 +0000100// CHK-CUBIN-UNBUNDLING-NVLINK-NOT: clang-offload-bundler{{.*}}" "-type=o"{{.*}}in.so
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +0000101
102/// ###########################################################################
103
104/// Check cubin file generation and usage by nvlink
105// RUN: touch %t1.o
106// RUN: touch %t2.o
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +0000107// RUN: %clang -### -no-canonical-prefixes -target powerpc64le-unknown-linux-gnu -fopenmp=libomp \
108// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %t1.o %t2.o 2>&1 \
109// RUN: | FileCheck -check-prefix=CHK-TWOCUBIN %s
110/// Check cubin file generation and usage by nvlink when toolchain has BindArchAction
111// RUN: %clang -### -no-canonical-prefixes -target x86_64-apple-darwin17.0.0 -fopenmp=libomp \
112// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %t1.o %t2.o 2>&1 \
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +0000113// RUN: | FileCheck -check-prefix=CHK-TWOCUBIN %s
114
Gheorghe-Teodor Bercea5636f4b2017-09-25 21:25:38 +0000115// CHK-TWOCUBIN: nvlink{{.*}}openmp-offload-{{.*}}.cubin" "{{.*}}openmp-offload-{{.*}}.cubin"
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +0000116
117/// ###########################################################################
118
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +0000119/// Check PTXAS is passed -c flag when offloading to an NVIDIA device using OpenMP.
120// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -no-canonical-prefixes %s 2>&1 \
121// RUN: | FileCheck -check-prefix=CHK-PTXAS-DEFAULT %s
122
123// CHK-PTXAS-DEFAULT: ptxas{{.*}}" "-c"
124
125/// ###########################################################################
126
127/// PTXAS is passed -c flag by default when offloading to an NVIDIA device using OpenMP - disable it.
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +0000128// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -fnoopenmp-relocatable-target \
129// RUN: -save-temps -no-canonical-prefixes %s 2>&1 \
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +0000130// RUN: | FileCheck -check-prefix=CHK-PTXAS-NORELO %s
131
132// CHK-PTXAS-NORELO-NOT: ptxas{{.*}}" "-c"
133
134/// ###########################################################################
135
136/// PTXAS is passed -c flag by default when offloading to an NVIDIA device using OpenMP
137/// Check that the flag is passed when -fopenmp-relocatable-target is used.
Jonas Hahnfeld7c78cc52017-11-21 14:44:45 +0000138// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-relocatable-target \
139// RUN: -save-temps -no-canonical-prefixes %s 2>&1 \
Gheorghe-Teodor Bercea9c525742017-08-11 15:46:22 +0000140// RUN: | FileCheck -check-prefix=CHK-PTXAS-RELO %s
141
142// CHK-PTXAS-RELO: ptxas{{.*}}" "-c"
Gheorghe-Teodor Bercea20789a52017-09-25 21:56:32 +0000143
144/// ###########################################################################
145
146/// Check that error is not thrown by toolchain when no cuda lib flag is used.
147/// Check that the flag is passed when -fopenmp-relocatable-target is used.
148// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 \
149// RUN: -nocudalib -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
150// RUN: | FileCheck -check-prefix=CHK-FLAG-NOLIBDEVICE %s
151
152// CHK-FLAG-NOLIBDEVICE-NOT: error:{{.*}}sm_60
Gheorghe-Teodor Bercea5a3608c2017-09-26 15:36:20 +0000153
154/// ###########################################################################
155
156/// Check that error is not thrown by toolchain when no cuda lib device is found when using -S.
157/// Check that the flag is passed when -fopenmp-relocatable-target is used.
158// RUN: %clang -### -S -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 \
159// RUN: -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
160// RUN: | FileCheck -check-prefix=CHK-NOLIBDEVICE %s
161
162// CHK-NOLIBDEVICE-NOT: error:{{.*}}sm_60
Gheorghe-Teodor Bercea0d5aa842018-03-13 23:19:52 +0000163
164/// ###########################################################################
165
166/// Check that the runtime bitcode library is part of the compile line. Create a bogus
167/// bitcode library and add it to the LIBRARY_PATH.
168// RUN: env LIBRARY_PATH=%S/Inputs/libomptarget %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
169// RUN: -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
170// RUN: -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
171// RUN: | FileCheck -check-prefix=CHK-BCLIB %s
Jonas Hahnfelda981f672018-09-27 16:12:32 +0000172/// The user can override default detection using --libomptarget-nvptx-path=.
173// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda --libomptarget-nvptx-path=%S/Inputs/libomptarget \
174// RUN: -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
175// RUN: -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
176// RUN: | FileCheck -check-prefix=CHK-BCLIB %s
Gheorghe-Teodor Bercea0d5aa842018-03-13 23:19:52 +0000177
Matt Arsenaulta13746b2018-08-20 18:16:48 +0000178// CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_20.bc
Gheorghe-Teodor Bercea0d5aa842018-03-13 23:19:52 +0000179// CHK-BCLIB-NOT: {{error:|warning:}}
180
181/// ###########################################################################
182
183/// Check that the warning is thrown when the libomptarget bitcode library is not found.
184/// Libomptarget requires sm_35 or newer so an sm_20 bitcode library should never exist.
185// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
186// RUN: -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
187// RUN: -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
188// RUN: | FileCheck -check-prefix=CHK-BCLIB-WARN %s
189
190// CHK-BCLIB-WARN: No library 'libomptarget-nvptx-sm_20.bc' found in the default clang lib directory or in LIBRARY_PATH. Expect degraded performance due to no inlining of runtime functions on target devices.
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000191
192/// Check that debug info is emitted in dwarf-2
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000193// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 \
194// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000195// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 2>&1 \
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000196// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000197// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 --no-cuda-noopt-device-debug 2>&1 \
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000198// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000199// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g0 2>&1 \
200// RUN: | FileCheck -check-prefix=NO_DEBUG %s
201// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb0 -O3 --cuda-noopt-device-debug 2>&1 \
202// RUN: | FileCheck -check-prefix=NO_DEBUG %s
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000203// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-directives-only 2>&1 \
204// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000205
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000206// DEBUG_DIRECTIVES-NOT: warning: debug
Alexey Bataevb83b4e42018-07-27 19:45:14 +0000207// NO_DEBUG-NOT: warning: debug
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000208// NO_DEBUG: "-fopenmp-is-device"
209// NO_DEBUG-NOT: "-debug-info-kind=
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000210// NO_DEBUG: ptxas
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000211// DEBUG_DIRECTIVES: "-triple" "nvptx64-nvidia-cuda"
212// DEBUG_DIRECTIVES-SAME: "-debug-info-kind=line-directives-only"
213// DEBUG_DIRECTIVES-SAME: "-fopenmp-is-device"
214// DEBUG_DIRECTIVES: ptxas
215// DEBUG_DIRECTIVES: "-lineinfo"
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000216// NO_DEBUG-NOT: "-g"
217// NO_DEBUG: nvlink
218// NO_DEBUG-NOT: "-g"
219
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000220// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 \
221// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000222// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g 2>&1 \
223// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
224// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --cuda-noopt-device-debug 2>&1 \
225// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
226// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 --cuda-noopt-device-debug 2>&1 \
227// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
228// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g2 2>&1 \
229// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
230// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb2 -O0 --cuda-noopt-device-debug 2>&1 \
231// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
232// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g3 -O3 --cuda-noopt-device-debug 2>&1 \
233// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
234// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb3 -O2 --cuda-noopt-device-debug 2>&1 \
235// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000236// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-tables-only 2>&1 \
237// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
238// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \
239// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000240
Alexey Bataevb83b4e42018-07-27 19:45:14 +0000241// HAS_DEBUG-NOT: warning: debug
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000242// HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda"
Alexey Bataevc92fc3c2018-12-12 14:52:27 +0000243// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}"
Alexey Bataeve36c67b2018-04-18 16:31:09 +0000244// HAS_DEBUG-SAME: "-dwarf-version=2"
245// HAS_DEBUG-SAME: "-fopenmp-is-device"
246// HAS_DEBUG: ptxas
247// HAS_DEBUG-SAME: "-g"
248// HAS_DEBUG-SAME: "--dont-merge-basicblocks"
249// HAS_DEBUG-SAME: "--return-at-end"
250// HAS_DEBUG: nvlink
251// HAS_DEBUG-SAME: "-g"
252
Alexey Bataev80a9a612018-08-30 14:45:24 +0000253// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fopenmp-cuda-mode 2>&1 \
254// RUN: | FileCheck -check-prefix=CUDA_MODE %s
255// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fno-openmp-cuda-mode -fopenmp-cuda-mode 2>&1 \
256// RUN: | FileCheck -check-prefix=CUDA_MODE %s
257// CUDA_MODE: clang{{.*}}"-cc1"{{.*}}"-triple" "nvptx64-nvidia-cuda"
258// CUDA_MODE-SAME: "-fopenmp-cuda-mode"
259// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fno-openmp-cuda-mode 2>&1 \
260// RUN: | FileCheck -check-prefix=NO_CUDA_MODE %s
261// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fopenmp-cuda-mode -fno-openmp-cuda-mode 2>&1 \
262// RUN: | FileCheck -check-prefix=NO_CUDA_MODE %s
263// NO_CUDA_MODE-NOT: "-{{fno-|f}}openmp-cuda-mode"
264
265// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fopenmp-cuda-force-full-runtime 2>&1 \
266// RUN: | FileCheck -check-prefix=FULL_RUNTIME %s
267// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fno-openmp-cuda-force-full-runtime -fopenmp-cuda-force-full-runtime 2>&1 \
268// RUN: | FileCheck -check-prefix=FULL_RUNTIME %s
269// FULL_RUNTIME: clang{{.*}}"-cc1"{{.*}}"-triple" "nvptx64-nvidia-cuda"
270// FULL_RUNTIME-SAME: "-fopenmp-cuda-force-full-runtime"
271// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fno-openmp-cuda-force-full-runtime 2>&1 \
272// RUN: | FileCheck -check-prefix=NO_FULL_RUNTIME %s
273// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fopenmp-cuda-force-full-runtime -fno-openmp-cuda-force-full-runtime 2>&1 \
274// RUN: | FileCheck -check-prefix=NO_FULL_RUNTIME %s
275// NO_FULL_RUNTIME-NOT: "-{{fno-|f}}openmp-cuda-force-full-runtime"
Alexey Bataev8061acd2019-02-20 16:36:22 +0000276
277// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fopenmp-cuda-teams-reduction-recs-num=2048 2>&1 \
278// RUN: | FileCheck -check-prefix=CUDA_RED_RECS %s
279// CUDA_RED_RECS: clang{{.*}}"-cc1"{{.*}}"-triple" "nvptx64-nvidia-cuda"
280// CUDA_RED_RECS-SAME: "-fopenmp-cuda-teams-reduction-recs-num=2048"
Gheorghe-Teodor Berceae62c6932019-05-08 15:52:33 +0000281
282// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
283// RUN: | FileCheck -check-prefix=OPENMP_NVPTX_WRAPPERS %s
284// OPENMP_NVPTX_WRAPPERS: clang{{.*}}"-cc1"{{.*}}"-triple" "nvptx64-nvidia-cuda"
285// OPENMP_NVPTX_WRAPPERS-SAME: "-internal-isystem" "{{.*}}openmp_wrappers"