Skip to content

Commit 5da005d

Browse files
[SYCL] Fix device selector bug introduced in intel#12288
The very last commit in that PR (intel@f9a1377) accidentally removed one condition needed to add the device into allowed devices list. Restore it here.
1 parent dc0848d commit 5da005d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sycl/source/detail/platform_impl.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,17 +266,25 @@ std::vector<int> platform_impl::filterDeviceFilter(
266266
MPlugin->call<PiApiKind::piDeviceGetInfo>(
267267
Device, PI_DEVICE_INFO_TYPE, sizeof(sycl::detail::pi::PiDeviceType),
268268
&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);
269272

270273
for (const FilterT &Filter : FilterList->get()) {
271274
backend FilterBackend = Filter.Backend.value_or(backend::all);
272275
// First, match the backend entry.
273276
if (FilterBackend != Backend && FilterBackend != backend::all)
274277
continue;
278+
info::device_type FilterDevType =
279+
Filter.DeviceType.value_or(info::device_type::all);
275280

276281
// Match the device_num entry.
277282
if (Filter.DeviceNum && DeviceNum != Filter.DeviceNum.value())
278283
continue;
279284

285+
if (FilterDevType != info::device_type::all && FilterDevType != DeviceType)
286+
continue;
287+
280288
if constexpr (is_ods_target) {
281289
// Dealing with ONEAPI_DEVICE_SELECTOR - check for negative filters.
282290
if (Blacklist[DeviceNum]) // already blacklisted.

0 commit comments

Comments
 (0)