Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions sycl/source/detail/platform_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,13 @@ std::vector<platform> platform_impl::getAdapterPlatforms(AdapterPtr &Adapter,
platform Platform = detail::createSyclObjFromImpl<platform>(
getOrMakePlatformImpl(UrPlatform, Adapter));
const bool IsBanned = IsBannedPlatform(Platform);
const bool HasAnyDevices =
!Platform.get_devices(info::device_type::all).empty();
bool HasAnyDevices = false;

// Platform.get_devices() increments the device count for the platform
// and if the platform is banned (like OpenCL for AMD), it can cause
// incorrect device numbering, when used with ONEAPI_DEVICE_SELECTOR.
if (!IsBanned)
HasAnyDevices = !Platform.get_devices(info::device_type::all).empty();
Comment on lines +124 to +125
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Add braces around this if block to improve readability and prevent mistakes if additional statements are added later.

Suggested change
if (!IsBanned)
HasAnyDevices = !Platform.get_devices(info::device_type::all).empty();
if (!IsBanned) {
HasAnyDevices = !Platform.get_devices(info::device_type::all).empty();
}

Copilot uses AI. Check for mistakes.

if (!Supported) {
if (IsBanned || !HasAnyDevices) {
Expand Down
3 changes: 0 additions & 3 deletions sycl/test-e2e/Regression/device_num.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// UNSUPPORTED: any-device-is-hip
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/16805

// RUN: %{build} -o %t.out
// RUN: env PRINT_FULL_DEVICE_INFO=1 %{run-unfiltered-devices} %t.out > %t1.conf
// RUN: env ONEAPI_DEVICE_SELECTOR="*:0" env TEST_DEV_CONFIG_FILE_NAME=%t1.conf %{run-unfiltered-devices} %t.out
Expand Down