Skip to content

Commit 8d86eac

Browse files
committed
Fix multiple plaftorm issue in Config/allowlist.cpp test
1 parent 75dab49 commit 8d86eac

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

sycl/test-e2e/Config/allowlist.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)