Skip to content

Commit c81f196

Browse files
committed
simplified cast
Signed-off-by: Byoungro So <[email protected]>
1 parent fbf6ca4 commit c81f196

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

sycl/source/detail/platform_impl.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ static void filterAllowList(vector_class<RT::PiDevice> &PiDevices,
293293

294294
// Filter out the devices that are not compatible with SYCL_DEVICE_FILTER.
295295
// All three entries (backend:device_type:device_num) are optional.
296-
// The missing entries are constructed using '*', which means 'any' | 'all'.
296+
// The missing entries are constructed using '*', which means 'any' | 'all'
297+
// by the device_filter constructor.
297298
// This function matches devices in the order of backend, device_type, and
298299
// device_num.
299300
static void filterDeviceFilter(vector_class<RT::PiDevice> &PiDevices,
@@ -307,16 +308,12 @@ static void filterDeviceFilter(vector_class<RT::PiDevice> &PiDevices,
307308
int DeviceNum = 0;
308309
for (RT::PiDevice Device : PiDevices) {
309310
RT::PiDeviceType PiDevType;
310-
info::device_type DeviceType = info::device_type::all;
311311
Plugin.call<PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_TYPE,
312312
sizeof(RT::PiDeviceType),
313313
&PiDevType, nullptr);
314-
if (PiDevType == PI_DEVICE_TYPE_ACC)
315-
DeviceType = info::device_type::accelerator;
316-
else if (PiDevType == PI_DEVICE_TYPE_CPU)
317-
DeviceType = info::device_type::cpu;
318-
else if (PiDevType == PI_DEVICE_TYPE_GPU)
319-
DeviceType = info::device_type::gpu;
314+
// Assumption here is that there is 1-to-1 mapping between PiDevType and
315+
// Sycl device type for GPU, CPU, and ACC.
316+
info::device_type DeviceType = pi::cast<info::device_type>(PiDevType);
320317

321318
for (const device_filter &Filter : FilterList->get()) {
322319
backend FilterBackend = Filter.Backend;

0 commit comments

Comments
 (0)