@@ -54,128 +54,245 @@ int funcIndirectlyUsingCPU(int a, int b) { return funcUsingCPU(a, b, 1); }
5454SYCL_EXT_ONEAPI_FUNCTION_PROPERTY ((device_has<aspect::fp64>))
5555int funcUsingCPUHasFP64(int a) { return funcIndirectlyUsingCPU (a, 1 ); }
5656
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+
57198int main () {
58199 queue Q;
59200 Q.submit ([&](handler &CGH) {
60201 CGH.single_task ([=]() { int a = funcUsingFP16HasFP64 (1 ); });
61202 });
62203 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));
66206 });
67207 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));
70209 });
71210 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) );
74213 });
75214 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) );
78217 });
79218 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));
84221 });
85222 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));
89225 });
90226 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));
94229 });
95230 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));
101233 });
102234 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) );
105237 });
106238 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) );
109241 });
110242 Q.submit ([&](handler &CGH) {
111243 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));
114245 });
115246 Q.submit ([&](handler &CGH) {
116247 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));
119249 });
120250 Q.submit ([&](handler &CGH) {
121- CGH.single_task (properties{}, [=]() { int a = funcUsingCPUHasFP64 ( 1 ); } );
251+ CGH.single_task (K_funcUsingCPUHasFP64< decltype (props_emp)>(props_emp) );
122252 });
123253 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));
127256 });
128257 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));
131259 });
132260 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) );
135263 });
136264 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) );
139267 });
140268 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));
145271 });
146272 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));
150275 });
151276 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));
155279 });
156280 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));
162283 });
163284 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));
166286 });
167287 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));
170289 });
171290 Q.submit ([&](handler &CGH) {
172291 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));
175293 });
176294 Q.submit ([&](handler &CGH) {
177295 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));
180297 });
181298}
0 commit comments