1 // RUN: %libomptarget-compile-generic -fopenmp-extensions
2 // RUN: %libomptarget-run-generic | %fcheck-generic -strict-whitespace
7 #define CHECK_PRESENCE(Var1, Var2, Var3) \
8 printf(" presence of %s, %s, %s: %d, %d, %d\n", #Var1, #Var2, #Var3, \
9 omp_target_is_present(&Var1, omp_get_default_device()), \
10 omp_target_is_present(&Var2, omp_get_default_device()), \
11 omp_target_is_present(&Var3, omp_get_default_device()))
15 // CHECK: presence of m, r, d: 0, 0, 0
16 CHECK_PRESENCE(m
, r
, d
);
18 // -----------------------------------------------------------------------
19 // CHECK-NEXT: check:{{.*}}
20 printf("check: dyn>0, hold=0, dec/reset dyn=0\n");
22 // CHECK-NEXT: structured{{.*}}
23 printf(" structured dec of dyn\n");
24 #pragma omp target data map(tofrom : m) map(alloc : r, d)
26 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
27 CHECK_PRESENCE(m
, r
, d
);
28 #pragma omp target data map(tofrom : m) map(alloc : r, d)
30 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
31 CHECK_PRESENCE(m
, r
, d
);
33 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
34 CHECK_PRESENCE(m
, r
, d
);
36 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
37 CHECK_PRESENCE(m
, r
, d
);
39 // CHECK-NEXT: dynamic{{.*}}
40 printf(" dynamic dec/reset of dyn\n");
41 #pragma omp target data map(tofrom : m) map(alloc : r, d)
43 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
44 CHECK_PRESENCE(m
, r
, d
);
45 #pragma omp target data map(tofrom : m) map(alloc : r, d)
47 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
48 CHECK_PRESENCE(m
, r
, d
);
49 #pragma omp target exit data map(from : m) map(release : r)
50 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
51 CHECK_PRESENCE(m
, r
, d
);
52 #pragma omp target exit data map(from : m) map(release : r) map(delete : d)
53 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
54 CHECK_PRESENCE(m
, r
, d
);
56 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
57 CHECK_PRESENCE(m
, r
, d
);
58 #pragma omp target exit data map(from : m) map(release : r) map(delete : d)
59 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
60 CHECK_PRESENCE(m
, r
, d
);
62 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
63 CHECK_PRESENCE(m
, r
, d
);
65 // -----------------------------------------------------------------------
66 // CHECK: check:{{.*}}
67 printf("check: dyn=0, hold>0, dec/reset dyn=0, dec hold=0\n");
69 // Structured dec of dyn would require dyn>0.
71 // CHECK-NEXT: dynamic{{.*}}
72 printf(" dynamic dec/reset of dyn\n");
73 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
75 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
76 CHECK_PRESENCE(m
, r
, d
);
77 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
79 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
80 CHECK_PRESENCE(m
, r
, d
);
81 #pragma omp target exit data map(from : m) map(release : r)
82 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
83 CHECK_PRESENCE(m
, r
, d
);
84 #pragma omp target exit data map(from : m) map(release : r) map(delete : d)
85 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
86 CHECK_PRESENCE(m
, r
, d
);
88 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
89 CHECK_PRESENCE(m
, r
, d
);
90 #pragma omp target exit data map(from : m) map(release : r) map(delete : d)
91 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
92 CHECK_PRESENCE(m
, r
, d
);
94 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
95 CHECK_PRESENCE(m
, r
, d
);
97 // -----------------------------------------------------------------------
98 // CHECK: check:{{.*}}
99 printf("check: dyn>0, hold>0, dec/reset dyn=0, dec hold=0\n");
101 // CHECK-NEXT: structured{{.*}}
102 printf(" structured dec of dyn\n");
103 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
105 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
106 CHECK_PRESENCE(m
, r
, d
);
107 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
109 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
110 CHECK_PRESENCE(m
, r
, d
);
111 #pragma omp target data map(tofrom : m) map(alloc : r, d)
113 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
114 CHECK_PRESENCE(m
, r
, d
);
115 #pragma omp target data map(tofrom : m) map(alloc : r, d)
117 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
118 CHECK_PRESENCE(m
, r
, d
);
120 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
121 CHECK_PRESENCE(m
, r
, d
);
123 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
124 CHECK_PRESENCE(m
, r
, d
);
126 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
127 CHECK_PRESENCE(m
, r
, d
);
129 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
130 CHECK_PRESENCE(m
, r
, d
);
132 // CHECK-NEXT: dynamic{{.*}}
133 printf(" dynamic dec/reset of dyn\n");
134 #pragma omp target enter data map(to : m) map(alloc : r, d)
135 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
136 CHECK_PRESENCE(m
, r
, d
);
137 #pragma omp target enter data map(to : m) map(alloc : r, d)
138 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
139 CHECK_PRESENCE(m
, r
, d
);
140 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
142 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
143 CHECK_PRESENCE(m
, r
, d
);
144 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
146 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
147 CHECK_PRESENCE(m
, r
, d
);
148 #pragma omp target exit data map(from : m) map(release : r)
149 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
150 CHECK_PRESENCE(m
, r
, d
);
151 #pragma omp target exit data map(from : m) map(release : r) map(delete : d)
152 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
153 CHECK_PRESENCE(m
, r
, d
);
155 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
156 CHECK_PRESENCE(m
, r
, d
);
157 #pragma omp target exit data map(from : m) map(release : r) map(delete : d)
158 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
159 CHECK_PRESENCE(m
, r
, d
);
161 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
162 CHECK_PRESENCE(m
, r
, d
);
164 // -----------------------------------------------------------------------
165 // CHECK: check:{{.*}}
166 printf("check: dyn>0, hold>0, dec hold=0, dec/reset dyn=0\n");
168 // CHECK-NEXT: structured{{.*}}
169 printf(" structured dec of dyn\n");
170 #pragma omp target data map(tofrom : m) map(alloc : r, d)
172 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
173 CHECK_PRESENCE(m
, r
, d
);
174 #pragma omp target data map(tofrom : m) map(alloc : r, d)
176 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
177 CHECK_PRESENCE(m
, r
, d
);
178 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
180 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
181 CHECK_PRESENCE(m
, r
, d
);
182 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
184 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
185 CHECK_PRESENCE(m
, r
, d
);
187 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
188 CHECK_PRESENCE(m
, r
, d
);
190 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
191 CHECK_PRESENCE(m
, r
, d
);
193 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
194 CHECK_PRESENCE(m
, r
, d
);
196 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
197 CHECK_PRESENCE(m
, r
, d
);
199 // CHECK-NEXT: dynamic{{.*}}
200 printf(" dynamic dec/reset of dyn\n");
201 #pragma omp target enter data map(to : m) map(alloc : r, d)
202 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
203 CHECK_PRESENCE(m
, r
, d
);
204 #pragma omp target enter data map(to : m) map(alloc : r, d)
205 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
206 CHECK_PRESENCE(m
, r
, d
);
207 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
209 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
210 CHECK_PRESENCE(m
, r
, d
);
211 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
213 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
214 CHECK_PRESENCE(m
, r
, d
);
216 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
217 CHECK_PRESENCE(m
, r
, d
);
219 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
220 CHECK_PRESENCE(m
, r
, d
);
221 #pragma omp target exit data map(from : m) map(release : r)
222 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
223 CHECK_PRESENCE(m
, r
, d
);
224 #pragma omp target exit data map(from : m) map(release : r) map(delete : d)
225 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
226 CHECK_PRESENCE(m
, r
, d
);