Skip to content

Commit 5e8ae21

Browse files
[SYCL] Don't return empty platforms (#7923)
collecting empty platforms leads to confusion for things like `platform.has(aspect)`
1 parent 1649fe4 commit 5e8ae21

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sycl/source/detail/platform_impl.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,11 @@ std::vector<platform> platform_impl::get_platforms() {
126126
// insert PiPlatform into the Plugin
127127
Plugin.getPlatformId(PiPlatform);
128128
}
129-
// The users of (deprecated) SYCL_DEVICE_ALLOWLIST expect that
130-
// platforms with no devices will not be reported.
131-
if (!SYCLConfig<SYCL_DEVICE_ALLOWLIST>::get() ||
132-
!Platform.get_devices(info::device_type::all).empty()) {
129+
130+
// The SYCL spec says that a platform has one or more devices. ( SYCL
131+
// 2020 4.6.2 ) If we have an empty platform, we don't report it back
132+
// from platform::get_platforms().
133+
if (!Platform.get_devices(info::device_type::all).empty()) {
133134
Platforms.push_back(Platform);
134135
}
135136
}

0 commit comments

Comments
 (0)