File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -131,9 +131,19 @@ int main() {
131131 auto Platforms = sycl::platform::get_platforms ();
132132 if (Platforms.empty ())
133133 throw std::runtime_error (" No platform is found" );
134- else if (Platforms.size () != 1 )
135- throw std::runtime_error (" Expected only one platform." );
136-
134+
135+ // Verify all matched platforms are the same type (same name and version).
136+ // Multiple platform instances may exist for the same platform type
137+ // (e.g., multiple Level-Zero platforms for different GPUs).
138+ std::string FirstName = Platforms.at (0 ).get_info <sycl::info::platform::name>();
139+ std::string FirstVer = Platforms.at (0 ).get_info <sycl::info::platform::version>();
140+ for (const auto &P : Platforms) {
141+ if (P.get_info <sycl::info::platform::name>() != FirstName ||
142+ P.get_info <sycl::info::platform::version>() != FirstVer) {
143+ throw std::runtime_error (" Allowlist matched multiple platform types" );
144+ }
145+ }
146+
137147 return 0 ;
138148 }
139149
You can’t perform that action at this time.
0 commit comments