@@ -54,128 +54,245 @@ int funcIndirectlyUsingCPU(int a, int b) { return funcUsingCPU(a, b, 1); }
54
54
SYCL_EXT_ONEAPI_FUNCTION_PROPERTY ((device_has<aspect::fp64>))
55
55
int funcUsingCPUHasFP64(int a) { return funcIndirectlyUsingCPU (a, 1 ); }
56
56
57
+ constexpr auto props_64 = properties{device_has<aspect::fp64>};
58
+ constexpr auto props_16 = properties{device_has<aspect::fp16>};
59
+ constexpr auto props_1664 = properties{device_has<aspect::fp16, aspect::fp64>};
60
+ constexpr auto props_6416 = properties{device_has<aspect::fp64, aspect::fp16>};
61
+ constexpr auto props_gpu = properties{device_has<aspect::gpu>};
62
+ constexpr auto props_gpu1664 =
63
+ properties{device_has<aspect::gpu, aspect::fp16, aspect::fp64>};
64
+ constexpr auto props_1664gpu =
65
+ properties{device_has<aspect::fp16, aspect::fp64, aspect::gpu>};
66
+ constexpr auto props_emp = properties{};
67
+ constexpr auto props_cpu = properties{device_has<aspect::cpu>};
68
+ constexpr auto props_cpu64 = properties{device_has<aspect::cpu, aspect::fp64>};
69
+ constexpr auto props_64cpu = properties{device_has<aspect::fp64, aspect::cpu>};
70
+ constexpr auto props_gpucpu64 =
71
+ properties{device_has<aspect::gpu, aspect::cpu, aspect::fp64>};
72
+ constexpr auto props_cpu64gpu =
73
+ properties{device_has<aspect::cpu, aspect::fp64, aspect::gpu>};
74
+
75
+ template <typename T> struct K_funcIndirectlyUsingFP16 {
76
+ T *Props;
77
+ K_funcIndirectlyUsingFP16 (T Props_param) { Props = &Props_param; };
78
+ void operator ()() const { int a = funcIndirectlyUsingFP16 (1 , 2 ); }
79
+ auto get (properties_tag) { return *Props; }
80
+ };
81
+
82
+ template <typename T> struct K_funcIndirectlyUsingFP16_Warn16 {
83
+ T *Props;
84
+ K_funcIndirectlyUsingFP16_Warn16 (T Props_param) { Props = &Props_param; };
85
+ // expected-warning-re@+1 {{function '{{.*}}' uses aspect 'fp16' not listed in its 'device_has' property}}
86
+ void operator ()() const { int a = funcIndirectlyUsingFP16 (1 , 2 ); }
87
+ auto get (properties_tag) { return *Props; }
88
+ };
89
+
90
+ template <typename T> struct K_funcUsingFP16AndFP64 {
91
+ T *Props;
92
+ K_funcUsingFP16AndFP64 (T Props_param) { Props = &Props_param; };
93
+ void operator ()() const { int a = funcUsingFP16AndFP64 (1 , 2 ); }
94
+ auto get (properties_tag) { return *Props; }
95
+ };
96
+
97
+ template <typename T> struct K_funcUsingFP16AndFP64_Warn16 {
98
+ T *Props;
99
+ K_funcUsingFP16AndFP64_Warn16 (T Props_param) { Props = &Props_param; };
100
+ // expected-warning-re@+1 {{function '{{.*}}' uses aspect 'fp16' not listed in its 'device_has' property}}
101
+ void operator ()() const { int a = funcUsingFP16AndFP64 (1 , 2 ); }
102
+ auto get (properties_tag) { return *Props; }
103
+ };
104
+
105
+ template <typename T> struct K_funcUsingFP16AndFP64_Warn64 {
106
+ T *Props;
107
+ K_funcUsingFP16AndFP64_Warn64 (T Props_param) { Props = &Props_param; };
108
+ // expected-warning-re@+1 {{function '{{.*}}' uses aspect 'fp64' not listed in its 'device_has' property}}
109
+ void operator ()() const { int a = funcUsingFP16AndFP64 (1 , 2 ); }
110
+ auto get (properties_tag) { return *Props; }
111
+ };
112
+
113
+ template <typename T> struct K_funcUsingFP16AndFP64_Warn1664 {
114
+ T *Props;
115
+ K_funcUsingFP16AndFP64_Warn1664 (T Props_param) { Props = &Props_param; };
116
+ // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'fp16' not listed in its 'device_has' property}}
117
+ // expected-warning-re@+1 {{function '{{.*}}' uses aspect 'fp64' not listed in its 'device_has' property}}
118
+ void operator ()() const { int a = funcUsingFP16AndFP64 (1 , 2 ); }
119
+ auto get (properties_tag) { return *Props; }
120
+ };
121
+
122
+ template <typename T> struct K_funcUsingFP16AndFP64_False {
123
+ T *Props;
124
+ K_funcUsingFP16AndFP64_False (T Props_param) { Props = &Props_param; };
125
+ void operator ()() const {
126
+ if constexpr (false ) {
127
+ int a = funcUsingFP16AndFP64 (1 , 2 );
128
+ }
129
+ }
130
+ auto get (properties_tag) { return *Props; }
131
+ };
132
+
133
+ template <typename T> struct K_funcUsingCPUHasFP64 {
134
+ T *Props;
135
+ K_funcUsingCPUHasFP64 (T Props_param) { Props = &Props_param; };
136
+ void operator ()() const { int a = funcUsingCPUHasFP64 (1 ); }
137
+ auto get (properties_tag) { return *Props; }
138
+ };
139
+
140
+ template <typename T> struct K_funcIndirectlyUsingCPU {
141
+ T *Props;
142
+ K_funcIndirectlyUsingCPU (T Props_param) { Props = &Props_param; };
143
+ void operator ()() const { int a = funcIndirectlyUsingCPU (1 , 2 ); }
144
+ auto get (properties_tag) { return *Props; }
145
+ };
146
+
147
+ template <typename T> struct K_funcIndirectlyUsingCPU_WarnCPU {
148
+ T *Props;
149
+ K_funcIndirectlyUsingCPU_WarnCPU (T Props_param) { Props = &Props_param; };
150
+ // expected-warning-re@+1 {{function '{{.*}}' uses aspect 'cpu' not listed in its 'device_has' property}}
151
+ void operator ()() const { int a = funcIndirectlyUsingCPU (1 , 2 ); }
152
+ auto get (properties_tag) { return *Props; }
153
+ };
154
+
155
+ template <typename T> struct K_funcUsingCPUAndFP64 {
156
+ T *Props;
157
+ K_funcUsingCPUAndFP64 (T Props_param) { Props = &Props_param; };
158
+ void operator ()() const { int a = funcUsingCPUAndFP64 (1 , 2 ); }
159
+ auto get (properties_tag) { return *Props; }
160
+ };
161
+
162
+ template <typename T> struct K_funcUsingCPUAndFP64_WarnCPU {
163
+ T *Props;
164
+ K_funcUsingCPUAndFP64_WarnCPU (T Props_param) { Props = &Props_param; };
165
+ // expected-warning-re@+1 {{function '{{.*}}' uses aspect 'cpu' not listed in its 'device_has' property}}
166
+ void operator ()() const { int a = funcUsingCPUAndFP64 (1 , 2 ); }
167
+ auto get (properties_tag) { return *Props; }
168
+ };
169
+
170
+ template <typename T> struct K_funcUsingCPUAndFP64_Warn64 {
171
+ T *Props;
172
+ K_funcUsingCPUAndFP64_Warn64 (T Props_param) { Props = &Props_param; };
173
+ // expected-warning-re@+1 {{function '{{.*}}' uses aspect 'fp64' not listed in its 'device_has' property}}
174
+ void operator ()() const { int a = funcUsingCPUAndFP64 (1 , 2 ); }
175
+ auto get (properties_tag) { return *Props; }
176
+ };
177
+
178
+ template <typename T> struct K_funcUsingCPUAndFP64_Warn64CPU {
179
+ T *Props;
180
+ K_funcUsingCPUAndFP64_Warn64CPU (T Props_param) { Props = &Props_param; };
181
+ // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'cpu' not listed in its 'device_has' property}}
182
+ // expected-warning-re@+1 {{function '{{.*}}' uses aspect 'fp64' not listed in its 'device_has' property}}
183
+ void operator ()() const { int a = funcUsingCPUAndFP64 (1 , 2 ); }
184
+ auto get (properties_tag) { return *Props; }
185
+ };
186
+
187
+ template <typename T> struct K_funcUsingCPUAndFP64_False {
188
+ T *Props;
189
+ K_funcUsingCPUAndFP64_False (T Props_param) { Props = &Props_param; };
190
+ void operator ()() const {
191
+ if constexpr (false ) {
192
+ int a = funcUsingCPUAndFP64 (1 , 2 );
193
+ }
194
+ }
195
+ auto get (properties_tag) { return *Props; }
196
+ };
197
+
57
198
int main () {
58
199
queue Q;
59
200
Q.submit ([&](handler &CGH) {
60
201
CGH.single_task ([=]() { int a = funcUsingFP16HasFP64 (1 ); });
61
202
});
62
203
Q.submit ([&](handler &CGH) {
63
- // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'fp16' not listed in its 'device_has' property}}
64
- CGH.single_task (properties{device_has<aspect::fp64>},
65
- [=]() { int a = funcIndirectlyUsingFP16 (1 , 2 ); });
204
+ CGH.single_task (
205
+ K_funcIndirectlyUsingFP16_Warn16<decltype (props_64)>(props_64));
66
206
});
67
207
Q.submit ([&](handler &CGH) {
68
- CGH.single_task (properties{device_has<aspect::fp16>},
69
- [=]() { int a = funcIndirectlyUsingFP16 (1 , 2 ); });
208
+ CGH.single_task (K_funcIndirectlyUsingFP16<decltype (props_16)>(props_16));
70
209
});
71
210
Q.submit ([&](handler &CGH) {
72
- CGH.single_task (properties{device_has<aspect::fp16, aspect::fp64>},
73
- [=]() { int a = funcIndirectlyUsingFP16 ( 1 , 2 ); } );
211
+ CGH.single_task (
212
+ K_funcIndirectlyUsingFP16< decltype (props_1664)>(props_1664) );
74
213
});
75
214
Q.submit ([&](handler &CGH) {
76
- CGH.single_task (properties{device_has<aspect::fp64, aspect::fp16>},
77
- [=]() { int a = funcIndirectlyUsingFP16 ( 1 , 2 ); } );
215
+ CGH.single_task (
216
+ K_funcIndirectlyUsingFP16< decltype (props_6416)>(props_6416) );
78
217
});
79
218
Q.submit ([&](handler &CGH) {
80
- // expected-warning-re@+3 {{function '{{.*}}' uses aspect 'fp16' not listed in its 'device_has' property}}
81
- // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'fp64' not listed in its 'device_has' property}}
82
- CGH.single_task (properties{device_has<aspect::gpu>},
83
- [=]() { int a = funcUsingFP16AndFP64 (1 , 2 ); });
219
+ CGH.single_task (
220
+ K_funcUsingFP16AndFP64_Warn1664<decltype (props_gpu)>(props_gpu));
84
221
});
85
222
Q.submit ([&](handler &CGH) {
86
- // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'fp64' not listed in its 'device_has' property}}
87
- CGH.single_task (properties{device_has<aspect::fp16>},
88
- [=]() { int a = funcUsingFP16AndFP64 (1 , 2 ); });
223
+ CGH.single_task (
224
+ K_funcUsingFP16AndFP64_Warn64<decltype (props_16)>(props_16));
89
225
});
90
226
Q.submit ([&](handler &CGH) {
91
- // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'fp16' not listed in its 'device_has' property}}
92
- CGH.single_task (properties{device_has<aspect::fp64>},
93
- [=]() { int a = funcUsingFP16AndFP64 (1 , 2 ); });
227
+ CGH.single_task (
228
+ K_funcUsingFP16AndFP64_Warn16<decltype (props_64)>(props_64));
94
229
});
95
230
Q.submit ([&](handler &CGH) {
96
- CGH.single_task (properties{device_has<aspect::gpu>}, [=]() {
97
- if constexpr (false ) {
98
- int a = funcUsingFP16AndFP64 (1 , 2 );
99
- }
100
- });
231
+ CGH.single_task (
232
+ K_funcUsingFP16AndFP64_False<decltype (props_gpu)>(props_gpu));
101
233
});
102
234
Q.submit ([&](handler &CGH) {
103
- CGH.single_task (properties{device_has<aspect::fp16, aspect::fp64>},
104
- [=]() { int a = funcUsingFP16AndFP64 ( 1 , 2 ); } );
235
+ CGH.single_task (
236
+ K_funcUsingFP16AndFP64_Warn16< decltype (props_1664)>(props_1664) );
105
237
});
106
238
Q.submit ([&](handler &CGH) {
107
- CGH.single_task (properties{device_has<aspect::fp64, aspect::fp16>},
108
- [=]() { int a = funcUsingFP16AndFP64 ( 1 , 2 ); } );
239
+ CGH.single_task (
240
+ K_funcUsingFP16AndFP64_Warn16< decltype (props_6416)>(props_6416) );
109
241
});
110
242
Q.submit ([&](handler &CGH) {
111
243
CGH.single_task (
112
- properties{device_has<aspect::gpu, aspect::fp16, aspect::fp64>},
113
- [=]() { int a = funcUsingFP16AndFP64 (1 , 2 ); });
244
+ K_funcUsingFP16AndFP64_Warn16<decltype (props_gpu1664)>(props_gpu1664));
114
245
});
115
246
Q.submit ([&](handler &CGH) {
116
247
CGH.single_task (
117
- properties{device_has<aspect::fp16, aspect::fp64, aspect::gpu>},
118
- [=]() { int a = funcUsingFP16AndFP64 (1 , 2 ); });
248
+ K_funcUsingFP16AndFP64_Warn16<decltype (props_1664gpu)>(props_1664gpu));
119
249
});
120
250
Q.submit ([&](handler &CGH) {
121
- CGH.single_task (properties{}, [=]() { int a = funcUsingCPUHasFP64 ( 1 ); } );
251
+ CGH.single_task (K_funcUsingCPUHasFP64< decltype (props_emp)>(props_emp) );
122
252
});
123
253
Q.submit ([&](handler &CGH) {
124
- // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'cpu' not listed in its 'device_has' property}}
125
- CGH.single_task (properties{device_has<aspect::fp64>},
126
- [=]() { int a = funcIndirectlyUsingCPU (1 , 2 ); });
254
+ CGH.single_task (
255
+ K_funcIndirectlyUsingCPU_WarnCPU<decltype (props_64)>(props_64));
127
256
});
128
257
Q.submit ([&](handler &CGH) {
129
- CGH.single_task (properties{device_has<aspect::cpu>},
130
- [=]() { int a = funcIndirectlyUsingCPU (1 , 2 ); });
258
+ CGH.single_task (K_funcIndirectlyUsingCPU<decltype (props_cpu)>(props_cpu));
131
259
});
132
260
Q.submit ([&](handler &CGH) {
133
- CGH.single_task (properties{device_has<aspect::cpu, aspect::fp64>},
134
- [=]() { int a = funcIndirectlyUsingCPU ( 1 , 2 ); } );
261
+ CGH.single_task (
262
+ K_funcIndirectlyUsingCPU< decltype (props_cpu64)>(props_cpu64) );
135
263
});
136
264
Q.submit ([&](handler &CGH) {
137
- CGH.single_task (properties{device_has<aspect::fp64, aspect::cpu>},
138
- [=]() { int a = funcIndirectlyUsingCPU ( 1 , 2 ); } );
265
+ CGH.single_task (
266
+ K_funcIndirectlyUsingCPU< decltype (props_64cpu)>(props_64cpu) );
139
267
});
140
268
Q.submit ([&](handler &CGH) {
141
- // expected-warning-re@+3 {{function '{{.*}}' uses aspect 'cpu' not listed in its 'device_has' property}}
142
- // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'fp64' not listed in its 'device_has' property}}
143
- CGH.single_task (properties{device_has<aspect::gpu>},
144
- [=]() { int a = funcUsingCPUAndFP64 (1 , 2 ); });
269
+ CGH.single_task (
270
+ K_funcUsingCPUAndFP64_Warn64CPU<decltype (props_gpu)>(props_gpu));
145
271
});
146
272
Q.submit ([&](handler &CGH) {
147
- // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'fp64' not listed in its 'device_has' property}}
148
- CGH.single_task (properties{device_has<aspect::cpu>},
149
- [=]() { int a = funcUsingCPUAndFP64 (1 , 2 ); });
273
+ CGH.single_task (
274
+ K_funcUsingCPUAndFP64_Warn64<decltype (props_cpu)>(props_cpu));
150
275
});
151
276
Q.submit ([&](handler &CGH) {
152
- // expected-warning-re@+2 {{function '{{.*}}' uses aspect 'cpu' not listed in its 'device_has' property}}
153
- CGH.single_task (properties{device_has<aspect::fp64>},
154
- [=]() { int a = funcUsingCPUAndFP64 (1 , 2 ); });
277
+ CGH.single_task (
278
+ K_funcUsingCPUAndFP64_WarnCPU<decltype (props_64)>(props_64));
155
279
});
156
280
Q.submit ([&](handler &CGH) {
157
- CGH.single_task (properties{device_has<aspect::gpu>}, [=]() {
158
- if constexpr (false ) {
159
- int a = funcUsingCPUAndFP64 (1 , 2 );
160
- }
161
- });
281
+ CGH.single_task (
282
+ K_funcUsingCPUAndFP64_False<decltype (props_gpu)>(props_gpu));
162
283
});
163
284
Q.submit ([&](handler &CGH) {
164
- CGH.single_task (properties{device_has<aspect::cpu, aspect::fp64>},
165
- [=]() { int a = funcUsingCPUAndFP64 (1 , 2 ); });
285
+ CGH.single_task (K_funcUsingCPUAndFP64<decltype (props_cpu64)>(props_cpu64));
166
286
});
167
287
Q.submit ([&](handler &CGH) {
168
- CGH.single_task (properties{device_has<aspect::fp64, aspect::cpu>},
169
- [=]() { int a = funcUsingCPUAndFP64 (1 , 2 ); });
288
+ CGH.single_task (K_funcUsingCPUAndFP64<decltype (props_64cpu)>(props_64cpu));
170
289
});
171
290
Q.submit ([&](handler &CGH) {
172
291
CGH.single_task (
173
- properties{device_has<aspect::gpu, aspect::cpu, aspect::fp64>},
174
- [=]() { int a = funcUsingCPUAndFP64 (1 , 2 ); });
292
+ K_funcUsingCPUAndFP64<decltype (props_gpucpu64)>(props_gpucpu64));
175
293
});
176
294
Q.submit ([&](handler &CGH) {
177
295
CGH.single_task (
178
- properties{device_has<aspect::cpu, aspect::fp64, aspect::gpu>},
179
- [=]() { int a = funcUsingCPUAndFP64 (1 , 2 ); });
296
+ K_funcUsingCPUAndFP64<decltype (props_cpu64gpu)>(props_cpu64gpu));
180
297
});
181
298
}
0 commit comments