@@ -266,59 +266,33 @@ std::vector<int> platform_impl::filterDeviceFilter(
266
266
MPlugin->call <PiApiKind::piDeviceGetInfo>(
267
267
Device, PI_DEVICE_INFO_TYPE, sizeof (sycl::detail::pi::PiDeviceType),
268
268
&PiDevType, nullptr );
269
- // Assumption here is that there is 1-to-1 mapping between PiDevType and
270
- // Sycl device type for GPU, CPU, and ACC.
271
- info::device_type DeviceType = pi::cast<info::device_type>(PiDevType);
272
269
273
270
for (const FilterT &Filter : FilterList->get ()) {
274
271
backend FilterBackend = Filter.Backend .value_or (backend::all);
275
- // First, match the backend entry
272
+ // First, match the backend entry.
276
273
if (FilterBackend != Backend && FilterBackend != backend::all)
277
274
continue ;
278
- info::device_type FilterDevType =
279
- Filter.DeviceType .value_or (info::device_type::all);
280
275
281
- // match the device_num entry
276
+ // Match the device_num entry.
282
277
if (Filter.DeviceNum && DeviceNum != Filter.DeviceNum .value ())
283
278
continue ;
284
279
285
- // Next, match the device_type entry
286
- if (FilterDevType == info::device_type::all) {
287
- if constexpr (is_ods_target) { // dealing with ODS filters
288
- if (!Blacklist[DeviceNum]) { // ensure it is not blacklisted
289
- if (!Filter.IsNegativeTarget ) { // is filter positive?
290
- PiDevices[InsertIDx++] = Device;
291
- original_indices.push_back (DeviceNum);
292
- } else {
293
- // Filter is negative and the device matches the filter so
294
- // blacklist the device.
295
- Blacklist[DeviceNum] = true ;
296
- }
297
- }
298
- } else { // dealing with SYCL_DEVICE_FILTER
299
- PiDevices[InsertIDx++] = Device;
300
- original_indices.push_back (DeviceNum);
301
- }
302
- break ;
303
- }
304
- if (FilterDevType == DeviceType) {
305
- if constexpr (is_ods_target) {
306
- if (!Blacklist[DeviceNum]) {
307
- if (!Filter.IsNegativeTarget ) {
308
- PiDevices[InsertIDx++] = Device;
309
- original_indices.push_back (DeviceNum);
310
- } else {
311
- // Filter is negative and the device matches the filter so
312
- // blacklist the device.
313
- Blacklist[DeviceNum] = true ;
314
- }
315
- }
316
- } else {
317
- PiDevices[InsertIDx++] = Device;
318
- original_indices.push_back (DeviceNum);
280
+ if constexpr (is_ods_target) {
281
+ // Dealing with ONEAPI_DEVICE_SELECTOR - check for negative filters.
282
+ if (Blacklist[DeviceNum]) // already blacklisted.
283
+ break ;
284
+
285
+ if (Filter.IsNegativeTarget ) {
286
+ // Filter is negative and the device matches the filter so
287
+ // blacklist the device now.
288
+ Blacklist[DeviceNum] = true ;
289
+ break ;
319
290
}
320
- break ;
321
291
}
292
+
293
+ PiDevices[InsertIDx++] = Device;
294
+ original_indices.push_back (DeviceNum);
295
+ break ;
322
296
}
323
297
DeviceNum++;
324
298
}
0 commit comments