|
14 | 14 | // verbose (enabled with --verbose). |
15 | 15 | // |
16 | 16 | // 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. |
20 | 18 | // |
21 | 19 | #include <sycl/sycl.hpp> |
22 | 20 |
|
@@ -124,8 +122,7 @@ std::array<int, 2> GetNumberOfSubAndSubSubDevices(const device &Device) { |
124 | 122 | } |
125 | 123 |
|
126 | 124 | static void printDeviceInfo(const device &Device, bool Verbose, |
127 | | - const std::string &Prepend, |
128 | | - bool IsUnsupported = false) { |
| 125 | + const std::string &Prepend) { |
129 | 126 | auto DeviceVersion = Device.get_info<info::device::version>(); |
130 | 127 | auto DeviceName = Device.get_info<info::device::name>(); |
131 | 128 | auto DeviceVendor = Device.get_info<info::device::vendor>(); |
@@ -160,23 +157,19 @@ static void printDeviceInfo(const device &Device, bool Verbose, |
160 | 157 | << std::endl; |
161 | 158 | } |
162 | 159 |
|
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 :"; |
167 | 161 | #define __SYCL_ASPECT(ASPECT, ID) \ |
168 | 162 | if (Device.has(aspect::ASPECT)) \ |
169 | 163 | std::cout << " " << #ASPECT; |
170 | 164 | #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; |
180 | 173 | } else { |
181 | 174 | std::cout << Prepend << ", " << DeviceName << " " << DeviceVersion << " [" |
182 | 175 | << DeviceDriverVersion << "]" << std::endl; |
@@ -208,11 +201,8 @@ static int printUsageAndExit() { |
208 | 201 | << std::endl; |
209 | 202 | std::cout << "\n Options:" << std::endl; |
210 | 203 | 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." |
216 | 206 | << std::endl; |
217 | 207 | std::cout |
218 | 208 | << "\t --ignore-device-selectors " |
@@ -327,38 +317,6 @@ static int unsetFilterEnvVarsAndFork() { |
327 | 317 | } |
328 | 318 | #endif |
329 | 319 |
|
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 | | - |
362 | 320 | int main(int argc, char **argv) { |
363 | 321 |
|
364 | 322 | if (argc == 1) { |
@@ -428,14 +386,31 @@ int main(int argc, char **argv) { |
428 | 386 |
|
429 | 387 | if (verbose) { |
430 | 388 | 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 | + } |
439 | 414 | } else { |
440 | 415 | return EXIT_SUCCESS; |
441 | 416 | } |
|
0 commit comments