Skip to content

Commit 49d9b3a

Browse files
committed
sycl: add workaround for DPCPP compiler
get_devices() mistakenly ignores the passed device type and returns extra devices.
1 parent dfd7fc1 commit 49d9b3a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/sycl/sycl_engine.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ inline std::vector<cl::sycl::device> get_intel_sycl_devices(
3636
cl::sycl::info::device_type dev_type) {
3737
const int intel_vendor_id = 0x8086;
3838
auto devices = cl::sycl::device::get_devices(dev_type);
39-
devices.erase(
40-
std::remove_if(devices.begin(), devices.end(),
41-
[=](const cl::sycl::device &dev) {
42-
return dev.get_info<cl::sycl::info::device::vendor_id>()
43-
!= intel_vendor_id;
44-
}),
39+
devices.erase(std::remove_if(devices.begin(), devices.end(),
40+
[=](const cl::sycl::device &dev) {
41+
auto _vendor_id = dev.get_info<
42+
cl::sycl::info::device::vendor_id>();
43+
auto _dev_type = dev.get_info<
44+
cl::sycl::info::device::device_type>();
45+
return (_vendor_id != intel_vendor_id)
46+
|| (_dev_type != dev_type);
47+
}),
4548
devices.end());
4649
return devices;
4750
}

0 commit comments

Comments
 (0)