Debian Codegraph @

clang/test/OpenMP/nvptx_parallel_num_threads_strict_messages.cpp

raw
1 // RUN: %clang_cc1 -DF1 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host-ppc.bc
2 // RUN: %clang_cc1 -DF1 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-ppc.bc -o /dev/null
3 // RUN: %clang_cc1 -DF2 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host-ppc.bc
4 // RUN: %clang_cc1 -DF2 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-ppc.bc -o /dev/null
5 // RUN: %clang_cc1 -DF3 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host-ppc.bc
6 // RUN: %clang_cc1 -DF3 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-ppc.bc -o /dev/null
7
8 #ifndef TARGET
9 // expected-no-diagnostics
10 #endif
11
12 #ifdef F3
13 template<typename tx>
14 tx ftemplate(int n) {
15 tx a = 0;
16
17 #ifdef TARGET
18 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
19 #endif
20 #pragma omp parallel num_threads(strict: tx(20)) severity(fatal) message("msg")
21 {
22 }
23
24 short b = 1;
25 #ifdef TARGET
26 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
27 #endif
28 #pragma omp parallel num_threads(strict: b) severity(warning) message("msg")
29 {
30 a += b;
31 }
32
33 return a;
34 }
35 #endif
36
37 #ifdef F2
38 static
39 int fstatic(int n) {
40
41 #ifdef TARGET
42 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
43 #endif
44 #pragma omp target parallel num_threads(strict: n) message("msg")
45 {
46 }
47
48 #ifdef TARGET
49 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
50 #endif
51 #pragma omp target parallel num_threads(strict: 32+n) severity(warning)
52 {
53 }
54
55 return n+1;
56 }
57 #endif
58
59 #ifdef F1
60 struct S1 {
61 double a;
62
63 int r1(int n){
64 int b = 1;
65
66 #ifdef TARGET
67 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
68 #endif
69 #pragma omp parallel num_threads(strict: n-b) severity(warning) message("msg")
70 {
71 this->a = (double)b + 1.5;
72 }
73
74 #ifdef TARGET
75 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
76 #endif
77 #pragma omp parallel num_threads(strict: 1024) severity(fatal)
78 {
79 this->a = 2.5;
80 }
81
82 return (int)a;
83 }
84 };
85 #endif
86
87 int bar(int n){
88 int a = 0;
89
90 #ifdef F1
91 #pragma omp target
92 {
93 S1 S;
94 a += S.r1(n);
95 }
96 #endif
97
98 #ifdef F2
99 a += fstatic(n);
100 #endif
101
102 #ifdef F3
103 #pragma omp target
104 a += ftemplate<int>(n);
105 #endif
106
107 return a;
108 }