diff --git a/sycl/include/sycl/platform.hpp b/sycl/include/sycl/platform.hpp index cc9980468048..0d10080e0014 100644 --- a/sycl/include/sycl/platform.hpp +++ b/sycl/include/sycl/platform.hpp @@ -194,11 +194,6 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase { /// \return a vector of all available SYCL platforms. static std::vector get_platforms(); - /// Returns all unsupported (non-SYCL) platforms in the system. - /// - /// \return a vector of all unsupported non-SYCL platforms. - static std::vector get_unsupported_platforms(); - /// Returns the backend associated with this platform. /// /// \return the backend associated with this platform diff --git a/sycl/source/detail/platform_impl.cpp b/sycl/source/detail/platform_impl.cpp index fea1abbf3a01..8cc068dfba7f 100644 --- a/sycl/source/detail/platform_impl.cpp +++ b/sycl/source/detail/platform_impl.cpp @@ -96,33 +96,27 @@ static bool IsBannedPlatform(platform Platform) { IsMatchingOpenCL(Platform, "AMD Accelerated Parallel Processing"); } -// Get the vector of platforms supported by a given UR plugin -// replace uses of this with a helper in plugin object, the plugin -// objects will own the ur adapter handles and they'll need to pass them to -// urPlatformsGet - so urPlatformsGet will need to be wrapped with a helper -std::vector platform_impl::getPluginPlatforms(PluginPtr &Plugin, - bool Supported) { - std::vector Platforms; +// This routine has the side effect of registering each platform's last device +// id into each plugin, which is used for device counting. +std::vector platform_impl::get_platforms() { - auto UrPlatforms = Plugin->getUrPlatforms(); + // Get the vector of platforms supported by a given UR plugin + // replace uses of this with with a helper in plugin object, the plugin + // objects will own the ur adapter handles and they'll need to pass them to + // urPlatformsGet - so urPlatformsGet will need to be wrapped with a helper + auto getPluginPlatforms = [](PluginPtr &Plugin) { + std::vector Platforms; - if (UrPlatforms.empty()) { - return Platforms; - } + auto UrPlatforms = Plugin->getUrPlatforms(); - for (const auto &UrPlatform : UrPlatforms) { - platform Platform = detail::createSyclObjFromImpl( - getOrMakePlatformImpl(UrPlatform, Plugin)); - const bool IsBanned = IsBannedPlatform(Platform); - const bool HasAnyDevices = - !Platform.get_devices(info::device_type::all).empty(); + if (UrPlatforms.empty()) { + return Platforms; + } - if (!Supported) { - if (IsBanned || !HasAnyDevices) { - Platforms.push_back(Platform); - } - } else { - if (IsBanned) { + for (const auto &UrPlatform : UrPlatforms) { + platform Platform = detail::createSyclObjFromImpl( + getOrMakePlatformImpl(UrPlatform, Plugin)); + if (IsBannedPlatform(Platform)) { continue; // bail as early as possible, otherwise banned platforms may // mess up device counting } @@ -130,35 +124,12 @@ std::vector platform_impl::getPluginPlatforms(PluginPtr &Plugin, // The SYCL spec says that a platform has one or more devices. ( SYCL // 2020 4.6.2 ) If we have an empty platform, we don't report it back // from platform::get_platforms(). - if (HasAnyDevices) { + if (!Platform.get_devices(info::device_type::all).empty()) { Platforms.push_back(Platform); } } - } - return Platforms; -} - -std::vector platform_impl::get_unsupported_platforms() { - std::vector UnsupportedPlatforms; - - std::vector &Plugins = sycl::detail::ur::initializeUr(); - // Ignore UR as it has to be supported. - for (auto &Plugin : Plugins) { - if (Plugin->hasBackend(backend::all)) { - continue; // skip UR - } - std::vector PluginPlatforms = - getPluginPlatforms(Plugin, /*Supported=*/false); - std::copy(PluginPlatforms.begin(), PluginPlatforms.end(), - std::back_inserter(UnsupportedPlatforms)); - } - - return UnsupportedPlatforms; -} - -// This routine has the side effect of registering each platform's last device -// id into each plugin, which is used for device counting. -std::vector platform_impl::get_platforms() { + return Platforms; + }; // See which platform we want to be served by which plugin. // There should be just one plugin serving each backend. diff --git a/sycl/source/detail/platform_impl.hpp b/sycl/source/detail/platform_impl.hpp index 41be819e0e13..55b211c592a9 100644 --- a/sycl/source/detail/platform_impl.hpp +++ b/sycl/source/detail/platform_impl.hpp @@ -124,11 +124,6 @@ class platform_impl { /// \return a vector of all available SYCL platforms. static std::vector get_platforms(); - /// Returns all unsupported (non-SYCL) platforms in the system. - /// - /// \return a vector of all unsupported (non-SYCL) platforms. - static std::vector get_unsupported_platforms(); - // \return the Plugin associated with this platform. const PluginPtr &getPlugin() const { return MPlugin; } @@ -207,10 +202,6 @@ class platform_impl { private: std::shared_ptr getDeviceImplHelper(ur_device_handle_t UrDevice); - // Helper to get the vector of platforms supported by a given UR plugin - static std::vector getPluginPlatforms(PluginPtr &Plugin, - bool Supported = true); - // Helper to filter reportable devices in the platform template std::vector diff --git a/sycl/source/platform.cpp b/sycl/source/platform.cpp index b9ec5073fb7e..0a1690961d07 100644 --- a/sycl/source/platform.cpp +++ b/sycl/source/platform.cpp @@ -52,10 +52,6 @@ std::vector platform::get_platforms() { return detail::platform_impl::get_platforms(); } -std::vector platform::get_unsupported_platforms() { - return detail::platform_impl::get_unsupported_platforms(); -} - backend platform::get_backend() const noexcept { return impl->getBackend(); } template diff --git a/sycl/test-e2e/Plugin/sycl-ls-banned.cpp b/sycl/test-e2e/Plugin/sycl-ls-banned.cpp deleted file mode 100644 index 5528164c4262..000000000000 --- a/sycl/test-e2e/Plugin/sycl-ls-banned.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// REQUIRES: cuda - -// RUN: sycl-ls --verbose >%t.cuda.out -// RUN: FileCheck %s --input-file %t.cuda.out - -//==---- sycl-ls-banned.cpp - Check sycl-ls output of banned platforms. --==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// CHECK: Unsupported Platforms: -// CHECK-NEXT: Platform [#1]: -// CHECK-NEXT: Version : OpenCL diff --git a/sycl/test-e2e/Plugin/sycl-ls.cpp b/sycl/test-e2e/Plugin/sycl-ls.cpp index 89f340600baa..1632d7f1e5cd 100644 --- a/sycl/test-e2e/Plugin/sycl-ls.cpp +++ b/sycl/test-e2e/Plugin/sycl-ls.cpp @@ -1,4 +1,4 @@ -// RUN: sycl-ls --verbose | awk '{print}/Unsupported Platforms:/{exit}' | grep "Device \[" | wc -l >%t.verbose.out +// RUN: sycl-ls --verbose | grep "Device \[" | wc -l >%t.verbose.out // RUN: sycl-ls | wc -l >%t.concise.out // RUN: diff %t.verbose.out %t.concise.out diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index ec6ec2096403..bf5542036a2e 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3545,7 +3545,6 @@ _ZN4sycl3_V17samplerC1EP11_cl_samplerRKNS0_7contextE _ZN4sycl3_V17samplerC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE _ZN4sycl3_V17samplerC2EP11_cl_samplerRKNS0_7contextE _ZN4sycl3_V18platform13get_platformsEv -_ZN4sycl3_V18platform25get_unsupported_platformsEv _ZN4sycl3_V18platformC1EP15_cl_platform_id _ZN4sycl3_V18platformC1ERKNS0_15device_selectorE _ZN4sycl3_V18platformC1ERKNS0_6deviceE diff --git a/sycl/test/abi/sycl_symbols_windows.dump b/sycl/test/abi/sycl_symbols_windows.dump index 55ce460c6455..17a1e6b9fc16 100644 --- a/sycl/test/abi/sycl_symbols_windows.dump +++ b/sycl/test/abi/sycl_symbols_windows.dump @@ -4035,7 +4035,6 @@ ?get_platform@context@_V1@sycl@@QEBA?AVplatform@23@XZ ?get_platform@device@_V1@sycl@@QEBA?AVplatform@23@XZ ?get_platforms@platform@_V1@sycl@@SA?AV?$vector@Vplatform@_V1@sycl@@V?$allocator@Vplatform@_V1@sycl@@@std@@@std@@XZ -?get_unsupported_platforms@platform@_V1@sycl@@SA?AV?$vector@Vplatform@_V1@sycl@@V?$allocator@Vplatform@_V1@sycl@@@std@@@std@@XZ ?get_pointer_device@_V1@sycl@@YA?AVdevice@12@PEBXAEBVcontext@12@@Z ?get_pointer_type@_V1@sycl@@YA?AW4alloc@usm@12@PEBXAEBVcontext@12@@Z ?get_precision@stream@_V1@sycl@@QEBA_KXZ diff --git a/sycl/tools/sycl-ls/sycl-ls.cpp b/sycl/tools/sycl-ls/sycl-ls.cpp index c062c26b96fb..d965c1aeb193 100644 --- a/sycl/tools/sycl-ls/sycl-ls.cpp +++ b/sycl/tools/sycl-ls/sycl-ls.cpp @@ -14,9 +14,7 @@ // verbose (enabled with --verbose). // // In verbose mode it also prints, which devices would be chosen by various SYCL -// device selectors. If the system has unsupported platforms (for instance -// CUDA's OpenCL) those will also be listed in verbose mode, under "Unsupported -// Platforms". +// device selectors. // #include @@ -124,8 +122,7 @@ std::array GetNumberOfSubAndSubSubDevices(const device &Device) { } static void printDeviceInfo(const device &Device, bool Verbose, - const std::string &Prepend, - bool IsUnsupported = false) { + const std::string &Prepend) { auto DeviceVersion = Device.get_info(); auto DeviceName = Device.get_info(); auto DeviceVendor = Device.get_info(); @@ -160,23 +157,19 @@ static void printDeviceInfo(const device &Device, bool Verbose, << std::endl; } - // We don't expect to find info on aspects, device's sub-group size or - // architecture on non supported devices. - if (!IsUnsupported) { - std::cout << Prepend << "Aspects :"; + std::cout << Prepend << "Aspects :"; #define __SYCL_ASPECT(ASPECT, ID) \ if (Device.has(aspect::ASPECT)) \ std::cout << " " << #ASPECT; #include - std::cout << std::endl; - auto sg_sizes = Device.get_info(); - std::cout << Prepend << "info::device::sub_group_sizes:"; - for (auto size : sg_sizes) - std::cout << " " << size; - std::cout << std::endl; - std::cout << Prepend << "Architecture: " << getArchName(Device) - << std::endl; - } + std::cout << std::endl; + auto sg_sizes = Device.get_info(); + std::cout << Prepend << "info::device::sub_group_sizes:"; + for (auto size : sg_sizes) + std::cout << " " << size; + std::cout << std::endl; + std::cout << Prepend << "Architecture: " << getArchName(Device) + << std::endl; } else { std::cout << Prepend << ", " << DeviceName << " " << DeviceVersion << " [" << DeviceDriverVersion << "]" << std::endl; @@ -208,11 +201,8 @@ static int printUsageAndExit() { << std::endl; std::cout << "\n Options:" << std::endl; std::cout - << "\t --verbose " - << "\t Verbosely prints all the discovered platforms. " - << "It also lists the device chosen by various SYCL device " - "selectors. If the system contains unsupported platforms, those will " - "also be listed in verbose mode, under \"Unsupported Platforms\"." + << "\t --verbose " << "\t Verbosely prints all the discovered platforms. " + << "It also lists the device chosen by various SYCL device selectors." << std::endl; std::cout << "\t --ignore-device-selectors " @@ -327,38 +317,6 @@ static int unsetFilterEnvVarsAndFork() { } #endif -// NOTE: This function can update DeviceNums. -static void printVerbosePlatformInfo(const std::vector &Platforms, - std::map &DeviceNums, - const bool SuppressNumberPrinting, - bool IsUnsupported = false) { - uint32_t PlatformNum = 0; - if (!SuppressNumberPrinting) - DeviceNums.clear(); - for (const auto &Platform : Platforms) { - backend Backend = Platform.get_backend(); - ++PlatformNum; - auto PlatformVersion = Platform.get_info(); - auto PlatformName = Platform.get_info(); - auto PlatformVendor = Platform.get_info(); - std::cout << "Platform [#" << PlatformNum << "]:" << std::endl; - std::cout << " Version : " << PlatformVersion << std::endl; - std::cout << " Name : " << PlatformName << std::endl; - std::cout << " Vendor : " << PlatformVendor << std::endl; - - const auto &Devices = Platform.get_devices(); - std::cout << " Devices : " << Devices.size() << std::endl; - for (const auto &Device : Devices) { - if (!SuppressNumberPrinting) { - std::cout << " Device [#" << DeviceNums[Backend] - << "]:" << std::endl; - ++DeviceNums[Backend]; - } - printDeviceInfo(Device, true, " ", IsUnsupported); - } - } -} - int main(int argc, char **argv) { if (argc == 1) { @@ -428,14 +386,31 @@ int main(int argc, char **argv) { if (verbose) { std::cout << "\nPlatforms: " << Platforms.size() << std::endl; - printVerbosePlatformInfo(Platforms, DeviceNums, SuppressNumberPrinting); - - const auto &UnsupportedPlatforms = platform::get_unsupported_platforms(); - std::cout << "\nUnsupported Platforms: " << UnsupportedPlatforms.size() - << std::endl; - printVerbosePlatformInfo(UnsupportedPlatforms, DeviceNums, - SuppressNumberPrinting, true); - std::cout << std::endl; + uint32_t PlatformNum = 0; + if (!SuppressNumberPrinting) + DeviceNums.clear(); + for (const auto &Platform : Platforms) { + backend Backend = Platform.get_backend(); + ++PlatformNum; + auto PlatformVersion = Platform.get_info(); + auto PlatformName = Platform.get_info(); + auto PlatformVendor = Platform.get_info(); + std::cout << "Platform [#" << PlatformNum << "]:" << std::endl; + std::cout << " Version : " << PlatformVersion << std::endl; + std::cout << " Name : " << PlatformName << std::endl; + std::cout << " Vendor : " << PlatformVendor << std::endl; + + const auto &Devices = Platform.get_devices(); + std::cout << " Devices : " << Devices.size() << std::endl; + for (const auto &Device : Devices) { + if (!SuppressNumberPrinting) { + std::cout << " Device [#" << DeviceNums[Backend] + << "]:" << std::endl; + ++DeviceNums[Backend]; + } + printDeviceInfo(Device, true, " "); + } + } } else { return EXIT_SUCCESS; }