File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,19 @@ bool ods_target_list::backendCompatible(backend Backend) {
277
277
});
278
278
}
279
279
280
+ bool ods_target_list::containsHost () {
281
+ for (const auto &Filter : TargetList) {
282
+ if (Filter.Backend == backend::host || Filter.Backend == backend::all)
283
+ if (Filter.DeviceType == info::device_type::host ||
284
+ Filter.DeviceType == info::device_type::all || !Filter.DeviceType )
285
+ // SYCL RT never creates more than one HOST device.
286
+ // All device numbers other than 0 are rejected.
287
+ if (!Filter.DeviceNum || Filter.DeviceNum == 0 )
288
+ return true ;
289
+ }
290
+ return false ;
291
+ }
292
+
280
293
// ---------------------------------------
281
294
// SYCL_DEVICE_FILTER support
282
295
Original file line number Diff line number Diff line change @@ -151,7 +151,10 @@ std::vector<platform> platform_impl::get_platforms() {
151
151
// SYCL_DEVICE_FILTER
152
152
detail::device_filter_list *FilterList =
153
153
detail::SYCLConfig<detail::SYCL_DEVICE_FILTER>::get ();
154
- if (!FilterList || FilterList->backendCompatible (backend::host))
154
+ detail::ods_target_list *OdsTargetList =
155
+ detail::SYCLConfig<detail::ONEAPI_DEVICE_SELECTOR>::get ();
156
+ if ((!FilterList || FilterList->backendCompatible (backend::host)) &&
157
+ (!OdsTargetList || OdsTargetList->backendCompatible (backend::host)))
155
158
Platforms.emplace_back (
156
159
createSyclObjFromImpl<platform>(platform_impl::getHostPlatformImpl ()));
157
160
@@ -474,7 +477,8 @@ platform_impl::get_devices(info::device_type DeviceType) const {
474
477
DeviceType == info::device_type::all)) {
475
478
// If SYCL_DEVICE_FILTER is set, check if filter contains host.
476
479
device_filter_list *FilterList = SYCLConfig<SYCL_DEVICE_FILTER>::get ();
477
- if (!FilterList || FilterList->containsHost ()) {
480
+ if ((!FilterList || FilterList->containsHost ()) &&
481
+ (!OdsTargetList || OdsTargetList->containsHost ())) {
478
482
Res.push_back (
479
483
createSyclObjFromImpl<device>(device_impl::getHostDeviceImpl ()));
480
484
}
Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ std::vector<device> device::get_devices(info::device_type deviceType) {
66
66
includeHost = false ;
67
67
else
68
68
includeHost = FilterList->containsHost ();
69
+ } else if (OdsTargetList) {
70
+ if (deviceType != info::device_type::host &&
71
+ deviceType != info::device_type::all)
72
+ includeHost = false ;
73
+ else
74
+ includeHost = OdsTargetList->containsHost ();
69
75
} else {
70
76
includeHost = detail::match_types (deviceType, info::device_type::host);
71
77
}
You can’t perform that action at this time.
0 commit comments