Skip to content

Commit 4c223d1

Browse files
authored
[SYCL] Remove querying for unsupported platforms (#15415)
As discussed in #15368 this functionality should not be exposed to the users.
1 parent e076c04 commit 4c223d1

File tree

9 files changed

+39
-114
lines changed

9 files changed

+39
-114
lines changed

sycl/include/sycl/platform.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,6 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase<platform> {
194194
/// \return a vector of all available SYCL platforms.
195195
static std::vector<platform> get_platforms();
196196

197-
/// Returns all unsupported (non-SYCL) platforms in the system.
198-
///
199-
/// \return a vector of all unsupported non-SYCL platforms.
200-
static std::vector<platform> get_unsupported_platforms();
201-
202197
/// Returns the backend associated with this platform.
203198
///
204199
/// \return the backend associated with this platform

sycl/source/detail/platform_impl.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,6 @@ std::vector<platform> platform_impl::getAdapterPlatforms(AdapterPtr &Adapter,
139139
return Platforms;
140140
}
141141

142-
std::vector<platform> platform_impl::get_unsupported_platforms() {
143-
std::vector<platform> UnsupportedPlatforms;
144-
145-
std::vector<AdapterPtr> &Adapters = sycl::detail::ur::initializeUr();
146-
// Ignore UR as it has to be supported.
147-
for (auto &Adapter : Adapters) {
148-
if (Adapter->hasBackend(backend::all)) {
149-
continue; // skip UR
150-
}
151-
std::vector<platform> AdapterPlatforms =
152-
getAdapterPlatforms(Adapter, /*Supported=*/false);
153-
std::copy(AdapterPlatforms.begin(), AdapterPlatforms.end(),
154-
std::back_inserter(UnsupportedPlatforms));
155-
}
156-
157-
return UnsupportedPlatforms;
158-
}
159-
160142
// This routine has the side effect of registering each platform's last device
161143
// id into each adapter, which is used for device counting.
162144
std::vector<platform> platform_impl::get_platforms() {

sycl/source/detail/platform_impl.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ class platform_impl {
125125
/// \return a vector of all available SYCL platforms.
126126
static std::vector<platform> get_platforms();
127127

128-
/// Returns all unsupported (non-SYCL) platforms in the system.
129-
///
130-
/// \return a vector of all unsupported (non-SYCL) platforms.
131-
static std::vector<platform> get_unsupported_platforms();
132-
133128
// \return the Adapter associated with this platform.
134129
const AdapterPtr &getAdapter() const { return MAdapter; }
135130

sycl/source/platform.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ std::vector<platform> platform::get_platforms() {
5252
return detail::platform_impl::get_platforms();
5353
}
5454

55-
std::vector<platform> platform::get_unsupported_platforms() {
56-
return detail::platform_impl::get_unsupported_platforms();
57-
}
58-
5955
backend platform::get_backend() const noexcept { return impl->getBackend(); }
6056

6157
template <typename Param>

sycl/test-e2e/Plugin/sycl-ls-banned.cpp

Lines changed: 0 additions & 16 deletions
This file was deleted.

sycl/test-e2e/Plugin/sycl-ls.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: sycl-ls --verbose | awk '{print}/Unsupported Platforms:/{exit}' | grep "Device \[" | wc -l >%t.verbose.out
1+
// RUN: sycl-ls --verbose | grep "Device \[" | wc -l >%t.verbose.out
22
// RUN: sycl-ls | wc -l >%t.concise.out
33
// RUN: diff %t.verbose.out %t.concise.out
44

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3545,7 +3545,6 @@ _ZN4sycl3_V17samplerC1EP11_cl_samplerRKNS0_7contextE
35453545
_ZN4sycl3_V17samplerC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE
35463546
_ZN4sycl3_V17samplerC2EP11_cl_samplerRKNS0_7contextE
35473547
_ZN4sycl3_V18platform13get_platformsEv
3548-
_ZN4sycl3_V18platform25get_unsupported_platformsEv
35493548
_ZN4sycl3_V18platformC1EP15_cl_platform_id
35503549
_ZN4sycl3_V18platformC1ERKNS0_15device_selectorE
35513550
_ZN4sycl3_V18platformC1ERKNS0_6deviceE

sycl/test/abi/sycl_symbols_windows.dump

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4035,7 +4035,6 @@
40354035
?get_platform@context@_V1@sycl@@QEBA?AVplatform@23@XZ
40364036
?get_platform@device@_V1@sycl@@QEBA?AVplatform@23@XZ
40374037
?get_platforms@platform@_V1@sycl@@SA?AV?$vector@Vplatform@_V1@sycl@@V?$allocator@Vplatform@_V1@sycl@@@std@@@std@@XZ
4038-
?get_unsupported_platforms@platform@_V1@sycl@@SA?AV?$vector@Vplatform@_V1@sycl@@V?$allocator@Vplatform@_V1@sycl@@@std@@@std@@XZ
40394038
?get_pointer_device@_V1@sycl@@YA?AVdevice@12@PEBXAEBVcontext@12@@Z
40404039
?get_pointer_type@_V1@sycl@@YA?AW4alloc@usm@12@PEBXAEBVcontext@12@@Z
40414040
?get_precision@stream@_V1@sycl@@QEBA_KXZ

sycl/tools/sycl-ls/sycl-ls.cpp

Lines changed: 38 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
// verbose (enabled with --verbose).
1515
//
1616
// In verbose mode it also prints, which devices would be chosen by various SYCL
17-
// device selectors. If the system has unsupported platforms (for instance
18-
// CUDA's OpenCL) those will also be listed in verbose mode, under "Unsupported
19-
// Platforms".
17+
// device selectors.
2018
//
2119
#include <sycl/sycl.hpp>
2220

@@ -124,8 +122,7 @@ std::array<int, 2> GetNumberOfSubAndSubSubDevices(const device &Device) {
124122
}
125123

126124
static void printDeviceInfo(const device &Device, bool Verbose,
127-
const std::string &Prepend,
128-
bool IsUnsupported = false) {
125+
const std::string &Prepend) {
129126
auto DeviceVersion = Device.get_info<info::device::version>();
130127
auto DeviceName = Device.get_info<info::device::name>();
131128
auto DeviceVendor = Device.get_info<info::device::vendor>();
@@ -160,23 +157,19 @@ static void printDeviceInfo(const device &Device, bool Verbose,
160157
<< std::endl;
161158
}
162159

163-
// We don't expect to find info on aspects, device's sub-group size or
164-
// architecture on non supported devices.
165-
if (!IsUnsupported) {
166-
std::cout << Prepend << "Aspects :";
160+
std::cout << Prepend << "Aspects :";
167161
#define __SYCL_ASPECT(ASPECT, ID) \
168162
if (Device.has(aspect::ASPECT)) \
169163
std::cout << " " << #ASPECT;
170164
#include <sycl/info/aspects.def>
171-
std::cout << std::endl;
172-
auto sg_sizes = Device.get_info<info::device::sub_group_sizes>();
173-
std::cout << Prepend << "info::device::sub_group_sizes:";
174-
for (auto size : sg_sizes)
175-
std::cout << " " << size;
176-
std::cout << std::endl;
177-
std::cout << Prepend << "Architecture: " << getArchName(Device)
178-
<< std::endl;
179-
}
165+
std::cout << std::endl;
166+
auto sg_sizes = Device.get_info<info::device::sub_group_sizes>();
167+
std::cout << Prepend << "info::device::sub_group_sizes:";
168+
for (auto size : sg_sizes)
169+
std::cout << " " << size;
170+
std::cout << std::endl;
171+
std::cout << Prepend << "Architecture: " << getArchName(Device)
172+
<< std::endl;
180173
} else {
181174
std::cout << Prepend << ", " << DeviceName << " " << DeviceVersion << " ["
182175
<< DeviceDriverVersion << "]" << std::endl;
@@ -208,11 +201,8 @@ static int printUsageAndExit() {
208201
<< std::endl;
209202
std::cout << "\n Options:" << std::endl;
210203
std::cout
211-
<< "\t --verbose "
212-
<< "\t Verbosely prints all the discovered platforms. "
213-
<< "It also lists the device chosen by various SYCL device "
214-
"selectors. If the system contains unsupported platforms, those will "
215-
"also be listed in verbose mode, under \"Unsupported Platforms\"."
204+
<< "\t --verbose " << "\t Verbosely prints all the discovered platforms. "
205+
<< "It also lists the device chosen by various SYCL device selectors."
216206
<< std::endl;
217207
std::cout
218208
<< "\t --ignore-device-selectors "
@@ -327,38 +317,6 @@ static int unsetFilterEnvVarsAndFork() {
327317
}
328318
#endif
329319

330-
// NOTE: This function can update DeviceNums.
331-
static void printVerbosePlatformInfo(const std::vector<platform> &Platforms,
332-
std::map<backend, size_t> &DeviceNums,
333-
const bool SuppressNumberPrinting,
334-
bool IsUnsupported = false) {
335-
uint32_t PlatformNum = 0;
336-
if (!SuppressNumberPrinting)
337-
DeviceNums.clear();
338-
for (const auto &Platform : Platforms) {
339-
backend Backend = Platform.get_backend();
340-
++PlatformNum;
341-
auto PlatformVersion = Platform.get_info<info::platform::version>();
342-
auto PlatformName = Platform.get_info<info::platform::name>();
343-
auto PlatformVendor = Platform.get_info<info::platform::vendor>();
344-
std::cout << "Platform [#" << PlatformNum << "]:" << std::endl;
345-
std::cout << " Version : " << PlatformVersion << std::endl;
346-
std::cout << " Name : " << PlatformName << std::endl;
347-
std::cout << " Vendor : " << PlatformVendor << std::endl;
348-
349-
const auto &Devices = Platform.get_devices();
350-
std::cout << " Devices : " << Devices.size() << std::endl;
351-
for (const auto &Device : Devices) {
352-
if (!SuppressNumberPrinting) {
353-
std::cout << " Device [#" << DeviceNums[Backend]
354-
<< "]:" << std::endl;
355-
++DeviceNums[Backend];
356-
}
357-
printDeviceInfo(Device, true, " ", IsUnsupported);
358-
}
359-
}
360-
}
361-
362320
int main(int argc, char **argv) {
363321

364322
if (argc == 1) {
@@ -428,14 +386,31 @@ int main(int argc, char **argv) {
428386

429387
if (verbose) {
430388
std::cout << "\nPlatforms: " << Platforms.size() << std::endl;
431-
printVerbosePlatformInfo(Platforms, DeviceNums, SuppressNumberPrinting);
432-
433-
const auto &UnsupportedPlatforms = platform::get_unsupported_platforms();
434-
std::cout << "\nUnsupported Platforms: " << UnsupportedPlatforms.size()
435-
<< std::endl;
436-
printVerbosePlatformInfo(UnsupportedPlatforms, DeviceNums,
437-
SuppressNumberPrinting, true);
438-
std::cout << std::endl;
389+
uint32_t PlatformNum = 0;
390+
if (!SuppressNumberPrinting)
391+
DeviceNums.clear();
392+
for (const auto &Platform : Platforms) {
393+
backend Backend = Platform.get_backend();
394+
++PlatformNum;
395+
auto PlatformVersion = Platform.get_info<info::platform::version>();
396+
auto PlatformName = Platform.get_info<info::platform::name>();
397+
auto PlatformVendor = Platform.get_info<info::platform::vendor>();
398+
std::cout << "Platform [#" << PlatformNum << "]:" << std::endl;
399+
std::cout << " Version : " << PlatformVersion << std::endl;
400+
std::cout << " Name : " << PlatformName << std::endl;
401+
std::cout << " Vendor : " << PlatformVendor << std::endl;
402+
403+
const auto &Devices = Platform.get_devices();
404+
std::cout << " Devices : " << Devices.size() << std::endl;
405+
for (const auto &Device : Devices) {
406+
if (!SuppressNumberPrinting) {
407+
std::cout << " Device [#" << DeviceNums[Backend]
408+
<< "]:" << std::endl;
409+
++DeviceNums[Backend];
410+
}
411+
printDeviceInfo(Device, true, " ");
412+
}
413+
}
439414
} else {
440415
return EXIT_SUCCESS;
441416
}

0 commit comments

Comments
 (0)