@@ -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.
299300static 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