3
3
#include < string>
4
4
#include < vector>
5
5
6
- #include < CL /sycl.hpp>
6
+ #include < sycl /sycl.hpp>
7
7
8
8
#define TAB std::string (" " )
9
9
@@ -43,6 +43,134 @@ std::string ConvertBytesToString(size_t value) {
43
43
return std::to_string (value / BYTES_IN_GB) + " GiB" ;
44
44
}
45
45
46
+ std::ostream& operator <<(std::ostream& out, sycl::aspect sycl_aspect) {
47
+ switch (sycl_aspect) {
48
+ case sycl::aspect::cpu:
49
+ out << " cpu" ;
50
+ break ;
51
+ case sycl::aspect::gpu:
52
+ out << " gpu" ;
53
+ break ;
54
+ case sycl::aspect::accelerator:
55
+ out << " accelerator" ;
56
+ break ;
57
+ case sycl::aspect::custom:
58
+ out << " custom" ;
59
+ break ;
60
+ case sycl::aspect::emulated:
61
+ out << " emulated" ;
62
+ break ;
63
+ case sycl::aspect::host_debuggable:
64
+ out << " host_debuggable" ;
65
+ break ;
66
+ case sycl::aspect::fp16:
67
+ out << " fp16" ;
68
+ break ;
69
+ case sycl::aspect::fp64:
70
+ out << " fp64" ;
71
+ break ;
72
+ case sycl::aspect::atomic64:
73
+ out << " atomic64" ;
74
+ break ;
75
+ case sycl::aspect::image:
76
+ out << " image" ;
77
+ break ;
78
+ case sycl::aspect::online_compiler:
79
+ out << " online_compiler" ;
80
+ break ;
81
+ case sycl::aspect::online_linker:
82
+ out << " online_linker" ;
83
+ break ;
84
+ case sycl::aspect::queue_profiling:
85
+ out << " queue_profiling" ;
86
+ break ;
87
+ case sycl::aspect::usm_device_allocations:
88
+ out << " usm_device_allocations" ;
89
+ break ;
90
+ case sycl::aspect::usm_host_allocations:
91
+ out << " usm_host_allocations" ;
92
+ break ;
93
+ case sycl::aspect::usm_atomic_host_allocations:
94
+ out << " usm_atomic_host_allocations" ;
95
+ break ;
96
+ case sycl::aspect::usm_shared_allocations:
97
+ out << " usm_shared_allocations" ;
98
+ break ;
99
+ case sycl::aspect::usm_atomic_shared_allocations:
100
+ out << " usm_atomic_shared_allocations" ;
101
+ break ;
102
+ case sycl::aspect::usm_system_allocations:
103
+ out << " usm_system_allocations" ;
104
+ break ;
105
+ #if defined(SYCL_IMPLEMENTATION_INTEL)
106
+ case sycl::aspect::ext_intel_pci_address:
107
+ out << " ext_intel_pci_address" ;
108
+ break ;
109
+ case sycl::aspect::ext_intel_gpu_eu_count:
110
+ out << " ext_intel_gpu_eu_count" ;
111
+ break ;
112
+ case sycl::aspect::ext_intel_gpu_eu_simd_width:
113
+ out << " ext_intel_gpu_eu_simd_width" ;
114
+ break ;
115
+ case sycl::aspect::ext_intel_gpu_slices:
116
+ out << " ext_intel_gpu_slices" ;
117
+ break ;
118
+ case sycl::aspect::ext_intel_gpu_subslices_per_slice:
119
+ out << " ext_intel_gpu_subslices_per_slice" ;
120
+ break ;
121
+ case sycl::aspect::ext_intel_gpu_eu_count_per_subslice:
122
+ out << " ext_intel_gpu_eu_count_per_subslice" ;
123
+ break ;
124
+ case sycl::aspect::ext_intel_max_mem_bandwidth:
125
+ out << " ext_intel_max_mem_bandwidth" ;
126
+ break ;
127
+ case sycl::aspect::ext_intel_mem_channel:
128
+ out << " ext_intel_mem_channel" ;
129
+ break ;
130
+ case sycl::aspect::ext_intel_device_info_uuid:
131
+ out << " ext_intel_device_info_uuid" ;
132
+ break ;
133
+ case sycl::aspect::ext_intel_gpu_hw_threads_per_eu:
134
+ out << " ext_intel_gpu_hw_threads_per_eu" ;
135
+ break ;
136
+ case sycl::aspect::ext_intel_free_memory:
137
+ out << " ext_intel_free_memory" ;
138
+ break ;
139
+ case sycl::aspect::ext_intel_device_id:
140
+ out << " ext_intel_device_id" ;
141
+ break ;
142
+ case sycl::aspect::ext_intel_memory_clock_rate:
143
+ out << " ext_intel_memory_clock_rate" ;
144
+ break ;
145
+ case sycl::aspect::ext_intel_memory_bus_width:
146
+ out << " ext_intel_memory_bus_width" ;
147
+ break ;
148
+ #if __LIBSYCL_MAJOR_VERSION > 6
149
+ case sycl::aspect::ext_intel_legacy_image:
150
+ out << " ext_intel_legacy_image" ;
151
+ break ;
152
+ #endif
153
+ #endif
154
+ #if defined(SYCL_IMPLEMENTATION_ONEAPI)
155
+ case sycl::aspect::ext_oneapi_srgb:
156
+ out << " ext_oneapi_srgb" ;
157
+ break ;
158
+ case sycl::aspect::ext_oneapi_native_assert:
159
+ out << " ext_oneapi_native_assert" ;
160
+ break ;
161
+ case sycl::aspect::ext_oneapi_cuda_async_barrier:
162
+ out << " ext_oneapi_cuda_async_barrier" ;
163
+ break ;
164
+ case sycl::aspect::ext_oneapi_bfloat16_math_functions:
165
+ out << " ext_oneapi_bfloat16_math_functions" ;
166
+ break ;
167
+ #endif
168
+ default :
169
+ out << " <unkown-aspect: " << static_cast <std::size_t >(sycl_aspect) << " >" ;
170
+ break ;
171
+ }
172
+ return out;
173
+ }
46
174
47
175
int main (int argc, char * argv[]) {
48
176
bool list_mode = false ;
@@ -166,13 +294,14 @@ int main(int argc, char* argv[]) {
166
294
(is_avilable ? " Yes" : " No" ) << std::endl;
167
295
168
296
bool is_compiler_avilable =
169
- device.get_info <sycl::info::device::is_compiler_available>();
297
+ device.has (sycl::aspect::online_compiler);
298
+
170
299
std::cout << std::setw (TEXT_WIDTH) << std::left <<
171
300
TAB + " Compiler Available " <<
172
301
(is_compiler_avilable ? " Yes" : " No" ) << std::endl;
173
302
174
303
bool is_linker_avilable =
175
- device.get_info < sycl::info::device::is_linker_available>( );
304
+ device.has ( sycl::aspect::online_linker );
176
305
std::cout << std::setw (TEXT_WIDTH) << std::left <<
177
306
TAB + " Linker Available " <<
178
307
(is_linker_avilable ? " Yes" : " No" ) << std::endl;
@@ -197,7 +326,7 @@ int main(int argc, char* argv[]) {
197
326
max_work_item_dimensions << std::endl;
198
327
199
328
sycl::id<3 > sizes =
200
- device.get_info <sycl::info::device::max_work_item_sizes>();
329
+ device.get_info <sycl::info::device::max_work_item_sizes< 3 > >();
201
330
std::cout << std::setw (TEXT_WIDTH) << std::left <<
202
331
TAB + " Max work item sizes " <<
203
332
sizes[0 ] << " x " << sizes[1 ] << " x " << sizes[2 ] << std::endl;
@@ -232,6 +361,9 @@ int main(int argc, char* argv[]) {
232
361
std::cout << " Other" << std::endl;
233
362
}
234
363
364
+ // TODO([email protected] ): Deprecated, however, I do not
365
+ // know a drop-in replacement.
366
+ // https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_device_information_descriptors
235
367
bool preferred_interop_user_sync =
236
368
device.get_info <sycl::info::device::preferred_interop_user_sync>();
237
369
std::cout << std::setw (TEXT_WIDTH) << std::left <<
@@ -244,32 +376,48 @@ int main(int argc, char* argv[]) {
244
376
TAB + " Profiling timer resolution " <<
245
377
profiling_timer_resolution << " ns" << std::endl;
246
378
379
+ // TODO([email protected] ): Deprecated, however, I do not
380
+ // know a drop-in replacement.
381
+ // https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_device_information_descriptors
247
382
size_t printf_buffer_size =
248
383
device.get_info <sycl::info::device::printf_buffer_size>();
249
384
std::cout << std::setw (TEXT_WIDTH) << std::left <<
250
385
TAB + " printf() buffer size" << printf_buffer_size << " (" <<
251
386
ConvertBytesToString (printf_buffer_size) << " )" << std::endl;
252
387
253
- std::vector<std::string> built_in_kernels =
254
- device.get_info <sycl::info::device::built_in_kernels >();
388
+ auto built_in_kernels =
389
+ device.get_info <sycl::info::device::built_in_kernel_ids >();
255
390
std::cout << std::setw (TEXT_WIDTH) << std::left <<
256
391
TAB + " Built-in kernels " ;
257
392
for (size_t i = 0 ; i < built_in_kernels.size (); ++i) {
258
- std::cout << built_in_kernels[i] << " " ;
393
+ std::cout << built_in_kernels[i]. get_name () << " " ;
259
394
}
260
395
std::cout << std::endl;
261
396
397
+ // TODO([email protected] ): Deprecated, however, the
398
+ // suggested replacement is not 1-for-1. I added the implementation
399
+ // using aspects below. Keeping this for now.
400
+ // https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_device_information_descriptors
262
401
std::vector<std::string> device_extensions =
263
402
device.get_info <sycl::info::device::extensions>();
264
403
std::cout << std::setw (TEXT_WIDTH) << std::left <<
265
404
TAB + " Device Extensions " ;
266
- for (size_t i = 0 ; i < device_extensions.size (); ++i) {
267
- std::cout << device_extensions[i] << " " ;
405
+ for (const auto & device_extension : device_extensions) {
406
+ std::cout << device_extension << " " ;
407
+ }
408
+ std::cout << std::endl;
409
+
410
+ auto device_aspects =
411
+ device.get_info <sycl::info::device::aspects>();
412
+ std::cout << std::setw (TEXT_WIDTH) << std::left <<
413
+ TAB + " Device Aspects " ;
414
+ for (const auto & device_aspect : device_aspects) {
415
+ std::cout << device_aspect << " " ;
268
416
}
269
417
std::cout << std::endl << std::endl;
270
418
}
271
419
}
272
420
}
273
421
274
422
return 0 ;
275
- }
423
+ }
0 commit comments