Skip to content

Commit d513074

Browse files
[SYCL] Absorb errors in plugin initialization. (#3470)
Signed-off-by: Sergey V Maslov <sergey.v.maslov@intel.com>
1 parent 26f1c0a commit d513074

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sycl/source/detail/platform_impl.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,17 @@ vector_class<platform> platform_impl::get_platforms() {
100100
for (unsigned int i = 0; i < Plugins.size(); i++) {
101101

102102
pi_uint32 NumPlatforms = 0;
103-
Plugins[i].call<PiApiKind::piPlatformsGet>(0, nullptr, &NumPlatforms);
103+
// Just return zero platforms if plugin fails to initialize.
104+
// This way platforms from other plugins get a chance to be discovered.
105+
if (Plugins[i].call_nocheck<PiApiKind::piPlatformsGet>(
106+
0, nullptr, &NumPlatforms) != PI_SUCCESS)
107+
return Platforms;
104108

105109
if (NumPlatforms) {
106110
vector_class<RT::PiPlatform> PiPlatforms(NumPlatforms);
107-
Plugins[i].call<PiApiKind::piPlatformsGet>(NumPlatforms,
108-
PiPlatforms.data(), nullptr);
111+
if (Plugins[i].call_nocheck<PiApiKind::piPlatformsGet>(
112+
NumPlatforms, PiPlatforms.data(), nullptr) != PI_SUCCESS)
113+
return Platforms;
109114

110115
for (const auto &PiPlatform : PiPlatforms) {
111116
platform Platform = detail::createSyclObjFromImpl<platform>(

0 commit comments

Comments
 (0)