Skip to content

Commit 4615fde

Browse files
Early continue in platform_impl::filterDeviceFilter for FilterBackend check
1 parent 9e04fbf commit 4615fde

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

sycl/source/detail/platform_impl.cpp

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -273,50 +273,50 @@ std::vector<int> platform_impl::filterDeviceFilter(
273273
for (const FilterT &Filter : FilterList->get()) {
274274
backend FilterBackend = Filter.Backend.value_or(backend::all);
275275
// First, match the backend entry
276-
if (FilterBackend == Backend || FilterBackend == backend::all) {
277-
info::device_type FilterDevType =
278-
Filter.DeviceType.value_or(info::device_type::all);
279-
// Next, match the device_type entry
280-
if (FilterDevType == info::device_type::all) {
281-
// Last, match the device_num entry
282-
if (!Filter.DeviceNum || DeviceNum == Filter.DeviceNum.value()) {
283-
if constexpr (is_ods_target) { // dealing with ODS filters
284-
if (!Blacklist[DeviceNum]) { // ensure it is not blacklisted
285-
if (!Filter.IsNegativeTarget) { // is filter positive?
286-
PiDevices[InsertIDx++] = Device;
287-
original_indices.push_back(DeviceNum);
288-
} else {
289-
// Filter is negative and the device matches the filter so
290-
// blacklist the device.
291-
Blacklist[DeviceNum] = true;
292-
}
276+
if (FilterBackend != Backend && FilterBackend != backend::all)
277+
continue;
278+
info::device_type FilterDevType =
279+
Filter.DeviceType.value_or(info::device_type::all);
280+
// Next, match the device_type entry
281+
if (FilterDevType == info::device_type::all) {
282+
// Last, match the device_num entry
283+
if (!Filter.DeviceNum || DeviceNum == Filter.DeviceNum.value()) {
284+
if constexpr (is_ods_target) { // dealing with ODS filters
285+
if (!Blacklist[DeviceNum]) { // ensure it is not blacklisted
286+
if (!Filter.IsNegativeTarget) { // is filter positive?
287+
PiDevices[InsertIDx++] = Device;
288+
original_indices.push_back(DeviceNum);
289+
} else {
290+
// Filter is negative and the device matches the filter so
291+
// blacklist the device.
292+
Blacklist[DeviceNum] = true;
293293
}
294-
} else { // dealing with SYCL_DEVICE_FILTER
295-
PiDevices[InsertIDx++] = Device;
296-
original_indices.push_back(DeviceNum);
297294
}
298-
break;
295+
} else { // dealing with SYCL_DEVICE_FILTER
296+
PiDevices[InsertIDx++] = Device;
297+
original_indices.push_back(DeviceNum);
299298
}
299+
break;
300+
}
300301

301-
} else if (FilterDevType == DeviceType) {
302-
if (!Filter.DeviceNum || DeviceNum == Filter.DeviceNum.value()) {
303-
if constexpr (is_ods_target) {
304-
if (!Blacklist[DeviceNum]) {
305-
if (!Filter.IsNegativeTarget) {
306-
PiDevices[InsertIDx++] = Device;
307-
original_indices.push_back(DeviceNum);
308-
} else {
309-
// Filter is negative and the device matches the filter so
310-
// blacklist the device.
311-
Blacklist[DeviceNum] = true;
312-
}
302+
} else if (FilterDevType == DeviceType) {
303+
if (!Filter.DeviceNum || DeviceNum == Filter.DeviceNum.value()) {
304+
if constexpr (is_ods_target) {
305+
if (!Blacklist[DeviceNum]) {
306+
if (!Filter.IsNegativeTarget) {
307+
PiDevices[InsertIDx++] = Device;
308+
original_indices.push_back(DeviceNum);
309+
} else {
310+
// Filter is negative and the device matches the filter so
311+
// blacklist the device.
312+
Blacklist[DeviceNum] = true;
313313
}
314-
} else {
315-
PiDevices[InsertIDx++] = Device;
316-
original_indices.push_back(DeviceNum);
317314
}
318-
break;
315+
} else {
316+
PiDevices[InsertIDx++] = Device;
317+
original_indices.push_back(DeviceNum);
319318
}
319+
break;
320320
}
321321
}
322322
}

0 commit comments

Comments
 (0)