DPC++ Runtime
Runtime libraries for oneAPI DPC++
device_info.hpp
Go to the documentation of this file.
1 //==-------- device_info.hpp - SYCL device info methods --------------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
13 #include <CL/sycl/detail/pi.hpp>
14 #include <CL/sycl/device.hpp>
16 #include <CL/sycl/memory_enums.hpp>
17 #include <CL/sycl/platform.hpp>
18 #include <detail/device_impl.hpp>
19 #include <detail/platform_impl.hpp>
20 #include <detail/platform_util.hpp>
21 #include <detail/plugin.hpp>
23 
24 #include <chrono>
25 #include <thread>
26 
28 namespace sycl {
29 namespace detail {
30 
31 inline std::vector<info::fp_config> read_fp_bitfield(pi_device_fp_config bits) {
32  std::vector<info::fp_config> result;
33  if (bits & PI_FP_DENORM)
34  result.push_back(info::fp_config::denorm);
35  if (bits & PI_FP_INF_NAN)
36  result.push_back(info::fp_config::inf_nan);
37  if (bits & PI_FP_ROUND_TO_NEAREST)
38  result.push_back(info::fp_config::round_to_nearest);
39  if (bits & PI_FP_ROUND_TO_ZERO)
40  result.push_back(info::fp_config::round_to_zero);
41  if (bits & PI_FP_ROUND_TO_INF)
42  result.push_back(info::fp_config::round_to_inf);
43  if (bits & PI_FP_FMA)
44  result.push_back(info::fp_config::fma);
45  if (bits & PI_FP_SOFT_FLOAT)
46  result.push_back(info::fp_config::soft_float);
48  result.push_back(info::fp_config::correctly_rounded_divide_sqrt);
49  return result;
50 }
51 
52 inline std::vector<info::partition_affinity_domain>
54  std::vector<info::partition_affinity_domain> result;
56  result.push_back(info::partition_affinity_domain::numa);
58  result.push_back(info::partition_affinity_domain::L4_cache);
60  result.push_back(info::partition_affinity_domain::L3_cache);
62  result.push_back(info::partition_affinity_domain::L2_cache);
64  result.push_back(info::partition_affinity_domain::L1_cache);
66  result.push_back(info::partition_affinity_domain::next_partitionable);
67  return result;
68 }
69 
70 inline std::vector<info::execution_capability>
72  std::vector<info::execution_capability> result;
73  if (bits & PI_EXEC_KERNEL)
74  result.push_back(info::execution_capability::exec_kernel);
75  if (bits & PI_EXEC_NATIVE_KERNEL)
76  result.push_back(info::execution_capability::exec_native_kernel);
77  return result;
78 }
79 
80 // Mapping expected SYCL return types to those returned by PI calls
81 template <typename T> struct sycl_to_pi { using type = T; };
82 template <> struct sycl_to_pi<bool> { using type = pi_bool; };
83 template <> struct sycl_to_pi<device> { using type = RT::PiDevice; };
84 template <> struct sycl_to_pi<platform> { using type = RT::PiPlatform; };
85 
86 // Mapping fp_config device info types to the values used to check fp support
87 template <info::device param> struct check_fp_support {};
88 
89 template <> struct check_fp_support<info::device::half_fp_config> {
90  static const info::device value = info::device::native_vector_width_half;
91 };
92 
93 template <> struct check_fp_support<info::device::double_fp_config> {
94  static const info::device value = info::device::native_vector_width_double;
95 };
96 
97 // Structs for emulating function template partial specialization
98 // Default template for the general case
99 // TODO: get rid of remaining uses of OpenCL directly
100 //
101 template <typename T, info::device param> struct get_device_info {
102  static T get(RT::PiDevice dev, const plugin &Plugin) {
103  typename sycl_to_pi<T>::type result;
104  Plugin.call<PiApiKind::piDeviceGetInfo>(dev,
105  pi::cast<RT::PiDeviceInfo>(param),
106  sizeof(result), &result, nullptr);
107  return T(result);
108  }
109 };
110 
111 // Specialization for platform
112 template <info::device param> struct get_device_info<platform, param> {
113  static platform get(RT::PiDevice dev, const plugin &Plugin) {
114  typename sycl_to_pi<platform>::type result;
115  Plugin.call<PiApiKind::piDeviceGetInfo>(dev,
116  pi::cast<RT::PiDeviceInfo>(param),
117  sizeof(result), &result, nullptr);
118  // TODO: Change PiDevice to device_impl.
119  // Use the Plugin from the device_impl class after plugin details
120  // are added to the class.
121  return createSyclObjFromImpl<platform>(
122  platform_impl::getOrMakePlatformImpl(result, Plugin));
123  }
124 };
125 
126 // Helper struct to allow using the specialization of get_device_info
127 // for string return type in other specializations.
128 template <info::device param> struct get_device_info_string {
129  static std::string get(RT::PiDevice dev, const plugin &Plugin) {
130  size_t resultSize = 0;
132  dev, pi::cast<RT::PiDeviceInfo>(param), 0, nullptr, &resultSize);
133  if (resultSize == 0) {
134  return std::string();
135  }
136  std::unique_ptr<char[]> result(new char[resultSize]);
137  Plugin.call<PiApiKind::piDeviceGetInfo>(dev,
138  pi::cast<RT::PiDeviceInfo>(param),
139  resultSize, result.get(), nullptr);
140 
141  return std::string(result.get());
142  }
143 };
144 
145 // Specialization for string return type, variable return size
146 template <info::device param> struct get_device_info<std::string, param> {
147  static std::string get(RT::PiDevice dev, const plugin &Plugin) {
148  return get_device_info_string<param>::get(dev, Plugin);
149  }
150 };
151 
152 // Specialization for parent device
153 template <typename T> struct get_device_info<T, info::device::parent_device> {
154  static T get(RT::PiDevice dev, const plugin &Plugin);
155 };
156 
157 // Specialization for id return type
158 template <info::device param> struct get_device_info<id<3>, param> {
159  static id<3> get(RT::PiDevice dev, const plugin &Plugin) {
160  size_t result[3];
161  Plugin.call<PiApiKind::piDeviceGetInfo>(dev,
162  pi::cast<RT::PiDeviceInfo>(param),
163  sizeof(result), &result, nullptr);
164  return id<3>(result[0], result[1], result[2]);
165  }
166 };
167 
168 // Specialization for fp_config types, checks the corresponding fp type support
169 template <info::device param>
170 struct get_device_info<std::vector<info::fp_config>, param> {
171  static std::vector<info::fp_config> get(RT::PiDevice dev,
172  const plugin &Plugin) {
173  // Check if fp type is supported
174  if (!get_device_info<
175  typename info::param_traits<
177  check_fp_support<param>::value>::get(dev, Plugin)) {
178  return {};
179  }
180  cl_device_fp_config result;
181  Plugin.call<PiApiKind::piDeviceGetInfo>(dev,
182  pi::cast<RT::PiDeviceInfo>(param),
183  sizeof(result), &result, nullptr);
184  return read_fp_bitfield(result);
185  }
186 };
187 
188 // Specialization for OpenCL version, splits the string returned by OpenCL
189 template <> struct get_device_info<std::string, info::device::version> {
190  static std::string get(RT::PiDevice dev, const plugin &Plugin) {
191  std::string result =
193 
194  // Extract OpenCL version from the returned string.
195  // For example, for the string "OpenCL 2.1 (Build 0)"
196  // return '2.1'.
197  auto dotPos = result.find('.');
198  if (dotPos == std::string::npos)
199  return result;
200 
201  auto leftPos = result.rfind(' ', dotPos);
202  if (leftPos == std::string::npos)
203  leftPos = 0;
204  else
205  leftPos++;
206 
207  auto rightPos = result.find(' ', dotPos);
208  return result.substr(leftPos, rightPos - leftPos);
209  }
210 };
211 
212 // Specialization for single_fp_config, no type support check required
213 template <>
214 struct get_device_info<std::vector<info::fp_config>,
215  info::device::single_fp_config> {
216  static std::vector<info::fp_config> get(RT::PiDevice dev,
217  const plugin &Plugin) {
218  pi_device_fp_config result;
220  dev, pi::cast<RT::PiDeviceInfo>(info::device::single_fp_config),
221  sizeof(result), &result, nullptr);
222  return read_fp_bitfield(result);
223  }
224 };
225 
226 // Specialization for queue_profiling, OpenCL returns a bitfield
227 template <> struct get_device_info<bool, info::device::queue_profiling> {
228  static bool get(RT::PiDevice dev, const plugin &Plugin) {
229  cl_command_queue_properties result;
231  dev, pi::cast<RT::PiDeviceInfo>(info::device::queue_profiling),
232  sizeof(result), &result, nullptr);
233  return (result & CL_QUEUE_PROFILING_ENABLE);
234  }
235 };
236 
237 // Specialization for atomic_memory_order_capabilities, PI returns a bitfield
238 template <>
239 struct get_device_info<std::vector<memory_order>,
240  info::device::atomic_memory_order_capabilities> {
241  static std::vector<memory_order> get(RT::PiDevice dev, const plugin &Plugin) {
244  dev,
245  pi::cast<RT::PiDeviceInfo>(
246  info::device::atomic_memory_order_capabilities),
247  sizeof(pi_memory_order_capabilities), &result, nullptr);
248  return readMemoryOrderBitfield(result);
249  }
250 };
251 
252 // Specialization for atomic_memory_scope_capabilities, PI returns a bitfield
253 template <>
254 struct get_device_info<std::vector<memory_scope>,
255  info::device::atomic_memory_scope_capabilities> {
256  static std::vector<memory_scope> get(RT::PiDevice dev, const plugin &Plugin) {
259  dev,
260  pi::cast<RT::PiDeviceInfo>(
261  info::device::atomic_memory_scope_capabilities),
262  sizeof(pi_memory_scope_capabilities), &result, nullptr);
263  return readMemoryScopeBitfield(result);
264  }
265 };
266 
267 // Specialization for bf16
268 template <> struct get_device_info<bool, info::device::ext_oneapi_bfloat16> {
269  static bool get(RT::PiDevice dev, const plugin &Plugin) {
270 
271  bool result = false;
272 
274  dev, pi::cast<RT::PiDeviceInfo>(info::device::ext_oneapi_bfloat16),
275  sizeof(result), &result, nullptr);
276  if (Err != PI_SUCCESS) {
277  return false;
278  }
279  return result;
280  }
281 };
282 
283 // Specialization for exec_capabilities, OpenCL returns a bitfield
284 template <>
285 struct get_device_info<std::vector<info::execution_capability>,
286  info::device::execution_capabilities> {
287  static std::vector<info::execution_capability> get(RT::PiDevice dev,
288  const plugin &Plugin) {
291  dev, pi::cast<RT::PiDeviceInfo>(info::device::execution_capabilities),
292  sizeof(result), &result, nullptr);
293  return read_execution_bitfield(result);
294  }
295 };
296 
297 // Specialization for built in kernel identifiers
298 template <>
299 struct get_device_info<std::vector<kernel_id>,
300  info::device::built_in_kernel_ids> {
301  static std::vector<kernel_id> get(RT::PiDevice dev, const plugin &Plugin) {
302  std::string result =
304  dev, Plugin);
305  auto names = split_string(result, ';');
306 
307  std::vector<kernel_id> ids;
308  ids.reserve(names.size());
309  for (const auto &name : names) {
310  ids.push_back(ProgramManager::getInstance().getBuiltInKernelID(name));
311  }
312  return ids;
313  }
314 };
315 
316 // Specialization for built in kernels, splits the string returned by OpenCL
317 template <>
318 struct get_device_info<std::vector<std::string>,
319  info::device::built_in_kernels> {
320  static std::vector<std::string> get(RT::PiDevice dev, const plugin &Plugin) {
321  std::string result =
323  dev, Plugin);
324  return split_string(result, ';');
325  }
326 };
327 
328 // Specialization for extensions, splits the string returned by OpenCL
329 template <>
330 struct get_device_info<std::vector<std::string>, info::device::extensions> {
331  static std::vector<std::string> get(RT::PiDevice dev, const plugin &Plugin) {
332  std::string result =
334  Plugin);
335  return split_string(result, ' ');
336  }
337 };
338 
340  switch (PP) {
341  case info::partition_property::no_partition:
342  case info::partition_property::partition_equally:
343  case info::partition_property::partition_by_counts:
344  case info::partition_property::partition_by_affinity_domain:
345  return true;
346  }
347  return false;
348 }
349 
350 // Specialization for partition properties, variable OpenCL return size
351 template <>
352 struct get_device_info<std::vector<info::partition_property>,
353  info::device::partition_properties> {
354  static std::vector<info::partition_property> get(RT::PiDevice dev,
355  const plugin &Plugin) {
356  auto info_partition =
357  pi::cast<RT::PiDeviceInfo>(info::device::partition_properties);
358 
359  size_t resultSize;
360  Plugin.call<PiApiKind::piDeviceGetInfo>(dev, info_partition, 0, nullptr,
361  &resultSize);
362 
363  size_t arrayLength = resultSize / sizeof(cl_device_partition_property);
364  if (arrayLength == 0) {
365  return {};
366  }
367  std::unique_ptr<cl_device_partition_property[]> arrayResult(
368  new cl_device_partition_property[arrayLength]);
369  Plugin.call<PiApiKind::piDeviceGetInfo>(dev, info_partition, resultSize,
370  arrayResult.get(), nullptr);
371 
372  std::vector<info::partition_property> result;
373  for (size_t i = 0; i < arrayLength; ++i) {
374  // OpenCL extensions may have partition_properties that
375  // are not yet defined for SYCL (eg. CL_DEVICE_PARTITION_BY_NAMES_INTEL)
377  static_cast<info::partition_property>(arrayResult[i]));
379  result.push_back(pp);
380  }
381  return result;
382  }
383 };
384 
385 // Specialization for partition affinity domains, OpenCL returns a bitfield
386 template <>
387 struct get_device_info<std::vector<info::partition_affinity_domain>,
388  info::device::partition_affinity_domains> {
389  static std::vector<info::partition_affinity_domain>
390  get(RT::PiDevice dev, const plugin &Plugin) {
393  dev,
394  pi::cast<RT::PiDeviceInfo>(info::device::partition_affinity_domains),
395  sizeof(result), &result, nullptr);
396  return read_domain_bitfield(result);
397  }
398 };
399 
400 // Specialization for partition type affinity domain, OpenCL can return other
401 // partition properties instead
402 template <>
404  info::device::partition_type_affinity_domain> {
406  const plugin &Plugin) {
407  size_t resultSize;
409  dev,
410  pi::cast<RT::PiDeviceInfo>(
411  info::device::partition_type_affinity_domain),
412  0, nullptr, &resultSize);
413  if (resultSize != 1) {
414  return info::partition_affinity_domain::not_applicable;
415  }
416  cl_device_partition_property result;
418  dev,
419  pi::cast<RT::PiDeviceInfo>(
420  info::device::partition_type_affinity_domain),
421  sizeof(result), &result, nullptr);
422  if (result == PI_DEVICE_AFFINITY_DOMAIN_NUMA ||
427  return info::partition_affinity_domain(result);
428  }
429 
430  return info::partition_affinity_domain::not_applicable;
431  }
432 };
433 
434 // Specialization for partition type
435 template <>
437  info::device::partition_type_property> {
438  static info::partition_property get(RT::PiDevice dev, const plugin &Plugin) {
439  size_t resultSize;
441  0, nullptr, &resultSize);
442  if (!resultSize)
443  return info::partition_property::no_partition;
444 
445  size_t arrayLength = resultSize / sizeof(cl_device_partition_property);
446 
447  std::unique_ptr<cl_device_partition_property[]> arrayResult(
448  new cl_device_partition_property[arrayLength]);
450  resultSize, arrayResult.get(),
451  nullptr);
452  if (!arrayResult[0])
453  return info::partition_property::no_partition;
454  return info::partition_property(arrayResult[0]);
455  }
456 };
457 // Specialization for supported subgroup sizes
458 template <>
459 struct get_device_info<std::vector<size_t>, info::device::sub_group_sizes> {
460  static std::vector<size_t> get(RT::PiDevice dev, const plugin &Plugin) {
461  size_t resultSize = 0;
463  dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes), 0,
464  nullptr, &resultSize);
465 
466  std::vector<size_t> result(resultSize / sizeof(size_t));
468  dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
469  resultSize, result.data(), nullptr);
470  return result;
471  }
472 };
473 
474 // Specialization for kernel to kernel pipes.
475 // Here we step away from OpenCL, since there is no appropriate cl_device_info
476 // enum for global pipes feature.
477 template <>
478 struct get_device_info<bool, info::device::kernel_kernel_pipe_support> {
479  static bool get(RT::PiDevice dev, const plugin &Plugin) {
480  // We claim, that all Intel FPGA devices support kernel to kernel pipe
481  // feature (at least at the scope of SYCL_INTEL_data_flow_pipes extension).
482  platform plt =
484  std::string platform_name = plt.get_info<info::platform::name>();
485  if (platform_name == "Intel(R) FPGA Emulation Platform for OpenCL(TM)" ||
486  platform_name == "Intel(R) FPGA SDK for OpenCL(TM)")
487  return true;
488 
489  // TODO: a better way is to query for supported SPIR-V capabilities when
490  // it's started to be possible. Also, if a device's backend supports
491  // SPIR-V 1.1 (where Pipe Storage feature was defined), than it supports
492  // the feature as well.
493  return false;
494  }
495 };
496 
497 // Specialization for max_work_item_sizes.
498 // Due to the flipping of work group dimensions before kernel launch, the max
499 // sizes should also be reversed.
500 template <> struct get_device_info<id<3>, info::device::max_work_item_sizes> {
501  static id<3> get(RT::PiDevice dev, const plugin &Plugin) {
502  size_t result[3];
504  dev, pi::cast<RT::PiDeviceInfo>(info::device::max_work_item_sizes),
505  sizeof(result), &result, nullptr);
506  return id<3>(result[2], result[1], result[0]);
507  }
508 };
509 
510 template <>
511 struct get_device_info<size_t,
512  info::device::ext_oneapi_max_global_work_groups> {
513  static size_t get(RT::PiDevice dev, const plugin &Plugin) {
514  (void)dev; // Silence unused warning
515  (void)Plugin;
516  return static_cast<size_t>((std::numeric_limits<int>::max)());
517  }
518 };
519 
520 template <>
521 struct get_device_info<id<1>, info::device::ext_oneapi_max_work_groups_1d> {
522  static id<1> get(RT::PiDevice dev, const plugin &Plugin) {
523  size_t result[3];
524  size_t Limit = get_device_info<
525  size_t, info::device::ext_oneapi_max_global_work_groups>::get(dev,
526  Plugin);
528  dev,
529  pi::cast<RT::PiDeviceInfo>(info::device::ext_oneapi_max_work_groups_3d),
530  sizeof(result), &result, nullptr);
531  return id<1>(std::min(Limit, result[0]));
532  }
533 };
534 
535 template <>
536 struct get_device_info<id<2>, info::device::ext_oneapi_max_work_groups_2d> {
537  static id<2> get(RT::PiDevice dev, const plugin &Plugin) {
538  size_t result[3];
539  size_t Limit = get_device_info<
540  size_t, info::device::ext_oneapi_max_global_work_groups>::get(dev,
541  Plugin);
543  dev,
544  pi::cast<RT::PiDeviceInfo>(info::device::ext_oneapi_max_work_groups_3d),
545  sizeof(result), &result, nullptr);
546  return id<2>(std::min(Limit, result[1]), std::min(Limit, result[0]));
547  }
548 };
549 
550 template <>
551 struct get_device_info<id<3>, info::device::ext_oneapi_max_work_groups_3d> {
552  static id<3> get(RT::PiDevice dev, const plugin &Plugin) {
553  size_t result[3];
554  size_t Limit = get_device_info<
555  size_t, info::device::ext_oneapi_max_global_work_groups>::get(dev,
556  Plugin);
558  dev,
559  pi::cast<RT::PiDeviceInfo>(info::device::ext_oneapi_max_work_groups_3d),
560  sizeof(result), &result, nullptr);
561  return id<3>(std::min(Limit, result[2]), std::min(Limit, result[1]),
562  std::min(Limit, result[0]));
563  }
564 };
565 
566 // Specialization for parent device
567 template <> struct get_device_info<device, info::device::parent_device> {
568  static device get(RT::PiDevice dev, const plugin &Plugin) {
569  typename sycl_to_pi<device>::type result;
571  dev, pi::cast<RT::PiDeviceInfo>(info::device::parent_device),
572  sizeof(result), &result, nullptr);
573  if (result == nullptr)
574  throw invalid_object_error(
575  "No parent for device because it is not a subdevice",
576  PI_ERROR_INVALID_DEVICE);
577 
578  // Get the platform of this device
579  std::shared_ptr<detail::platform_impl> Platform =
580  platform_impl::getPlatformFromPiDevice(dev, Plugin);
581  return createSyclObjFromImpl<device>(
582  Platform->getOrMakeDeviceImpl(result, Platform));
583  }
584 };
585 
586 // SYCL host device information
587 
588 // Default template is disabled, all possible instantiations are
589 // specified explicitly.
590 template <info::device param>
592 get_device_info_host() = delete;
593 
594 template <>
595 inline info::device_type get_device_info_host<info::device::device_type>() {
596  return info::device_type::host;
597 }
598 
599 template <> inline uint32_t get_device_info_host<info::device::vendor_id>() {
600  return 0x8086;
601 }
602 
603 template <>
604 inline uint32_t get_device_info_host<info::device::max_compute_units>() {
605  return std::thread::hardware_concurrency();
606 }
607 
608 template <>
609 inline uint32_t get_device_info_host<info::device::max_work_item_dimensions>() {
610  return 3;
611 }
612 
613 template <>
614 inline id<3> get_device_info_host<info::device::max_work_item_sizes>() {
615  // current value is the required minimum
616  return {1, 1, 1};
617 }
618 
619 template <>
620 inline constexpr size_t
621 get_device_info_host<info::device::ext_oneapi_max_global_work_groups>() {
622  // See handler.hpp for the maximum value :
623  return static_cast<size_t>((std::numeric_limits<int>::max)());
624 }
625 
626 template <>
627 inline id<1>
628 get_device_info_host<info::device::ext_oneapi_max_work_groups_1d>() {
629  // See handler.hpp for the maximum value :
630  static constexpr size_t Limit =
631  get_device_info_host<info::device::ext_oneapi_max_global_work_groups>();
632  return {Limit};
633 }
634 
635 template <>
636 inline id<2>
637 get_device_info_host<info::device::ext_oneapi_max_work_groups_2d>() {
638  // See handler.hpp for the maximum value :
639  static constexpr size_t Limit =
640  get_device_info_host<info::device::ext_oneapi_max_global_work_groups>();
641  return {Limit, Limit};
642 }
643 
644 template <>
645 inline id<3>
646 get_device_info_host<info::device::ext_oneapi_max_work_groups_3d>() {
647  // See handler.hpp for the maximum value :
648  static constexpr size_t Limit =
649  get_device_info_host<info::device::ext_oneapi_max_global_work_groups>();
650  return {Limit, Limit, Limit};
651 }
652 
653 template <>
654 inline size_t get_device_info_host<info::device::max_work_group_size>() {
655  // current value is the required minimum
656  return 1;
657 }
658 
659 template <>
660 inline uint32_t
661 get_device_info_host<info::device::preferred_vector_width_char>() {
662  // TODO update when appropriate
663  return 1;
664 }
665 
666 template <>
667 inline uint32_t
668 get_device_info_host<info::device::preferred_vector_width_short>() {
669  // TODO update when appropriate
670  return 1;
671 }
672 
673 template <>
674 inline uint32_t
675 get_device_info_host<info::device::preferred_vector_width_int>() {
676  // TODO update when appropriate
677  return 1;
678 }
679 
680 template <>
681 inline uint32_t
682 get_device_info_host<info::device::preferred_vector_width_long>() {
683  // TODO update when appropriate
684  return 1;
685 }
686 
687 template <>
688 inline uint32_t
689 get_device_info_host<info::device::preferred_vector_width_float>() {
690  // TODO update when appropriate
691  return 1;
692 }
693 
694 template <>
695 inline uint32_t
696 get_device_info_host<info::device::preferred_vector_width_double>() {
697  // TODO update when appropriate
698  return 1;
699 }
700 
701 template <>
702 inline uint32_t
703 get_device_info_host<info::device::preferred_vector_width_half>() {
704  // TODO update when appropriate
705  return 0;
706 }
707 
708 template <>
709 inline uint32_t get_device_info_host<info::device::native_vector_width_char>() {
710  return PlatformUtil::getNativeVectorWidth(PlatformUtil::TypeIndex::Char);
711 }
712 
713 template <>
714 inline uint32_t
715 get_device_info_host<info::device::native_vector_width_short>() {
716  return PlatformUtil::getNativeVectorWidth(PlatformUtil::TypeIndex::Short);
717 }
718 
719 template <>
720 inline uint32_t get_device_info_host<info::device::native_vector_width_int>() {
721  return PlatformUtil::getNativeVectorWidth(PlatformUtil::TypeIndex::Int);
722 }
723 
724 template <>
725 inline uint32_t get_device_info_host<info::device::native_vector_width_long>() {
726  return PlatformUtil::getNativeVectorWidth(PlatformUtil::TypeIndex::Long);
727 }
728 
729 template <>
730 inline uint32_t
731 get_device_info_host<info::device::native_vector_width_float>() {
732  return PlatformUtil::getNativeVectorWidth(PlatformUtil::TypeIndex::Float);
733 }
734 
735 template <>
736 inline uint32_t
737 get_device_info_host<info::device::native_vector_width_double>() {
738  return PlatformUtil::getNativeVectorWidth(PlatformUtil::TypeIndex::Double);
739 }
740 
741 template <>
742 inline uint32_t get_device_info_host<info::device::native_vector_width_half>() {
743  return PlatformUtil::getNativeVectorWidth(PlatformUtil::TypeIndex::Half);
744 }
745 
746 template <>
747 inline uint32_t get_device_info_host<info::device::max_clock_frequency>() {
748  return PlatformUtil::getMaxClockFrequency();
749 }
750 
751 template <> inline uint32_t get_device_info_host<info::device::address_bits>() {
752  return sizeof(void *) * 8;
753 }
754 
755 template <>
756 inline uint64_t get_device_info_host<info::device::global_mem_size>() {
757  return static_cast<uint64_t>(OSUtil::getOSMemSize());
758 }
759 
760 template <>
761 inline uint64_t get_device_info_host<info::device::max_mem_alloc_size>() {
762  // current value is the required minimum
763  const uint64_t a = get_device_info_host<info::device::global_mem_size>() / 4;
764  const uint64_t b = 128ul * 1024 * 1024;
765  return (a > b) ? a : b;
766 }
767 
768 template <> inline bool get_device_info_host<info::device::image_support>() {
769  return true;
770 }
771 
772 template <> inline bool get_device_info_host<info::device::atomic64>() {
773  return false;
774 }
775 
776 template <>
777 inline std::vector<memory_order>
778 get_device_info_host<info::device::atomic_memory_order_capabilities>() {
779  return {memory_order::relaxed, memory_order::acquire, memory_order::release,
780  memory_order::acq_rel, memory_order::seq_cst};
781 }
782 
783 template <>
784 inline std::vector<memory_scope>
785 get_device_info_host<info::device::atomic_memory_scope_capabilities>() {
786  return {memory_scope::work_item, memory_scope::sub_group,
787  memory_scope::work_group, memory_scope::device, memory_scope::system};
788 }
789 
790 template <>
791 inline bool get_device_info_host<info::device::ext_oneapi_bfloat16>() {
792  return false;
793 }
794 
795 template <>
796 inline uint32_t get_device_info_host<info::device::max_read_image_args>() {
797  // current value is the required minimum
798  return 128;
799 }
800 
801 template <>
802 inline uint32_t get_device_info_host<info::device::max_write_image_args>() {
803  // current value is the required minimum
804  return 8;
805 }
806 
807 template <>
808 inline size_t get_device_info_host<info::device::image2d_max_width>() {
809  // SYCL guarantees at least 8192. Some devices already known to provide more
810  // than that (i.e. it is 16384 for opencl:gpu), which may create issues during
811  // image object allocation on host.
812  // Using any fixed number (i.e. 16384) brings the risk of having similar
813  // issues on newer devices in future. Thus it does not make sense limiting
814  // the returned value on host. Practially speaking the returned value on host
815  // depends only on memory required for the image, which also depends on
816  // the image channel_type and the image height. Both are not known in this
817  // query, thus it becomes user's responsibility to choose proper image
818  // parameters depending on similar query to (non-host device) and amount
819  // of available/allocatable memory.
821 }
822 
823 template <>
824 inline size_t get_device_info_host<info::device::image2d_max_height>() {
825  // SYCL guarantees at least 8192. Some devices already known to provide more
826  // than that (i.e. it is 16384 for opencl:gpu), which may create issues during
827  // image object allocation on host.
828  // Using any fixed number (i.e. 16384) brings the risk of having similar
829  // issues on newer devices in future. Thus it does not make sense limiting
830  // the returned value on host. Practially speaking the returned value on host
831  // depends only on memory required for the image, which also depends on
832  // the image channel_type and the image width. Both are not known in this
833  // query, thus it becomes user's responsibility to choose proper image
834  // parameters depending on similar query to (non-host device) and amount
835  // of available/allocatable memory.
837 }
838 
839 template <>
840 inline size_t get_device_info_host<info::device::image3d_max_width>() {
841  // SYCL guarantees at least 8192. Some devices already known to provide more
842  // than that (i.e. it is 16384 for opencl:gpu), which may create issues during
843  // image object allocation on host.
844  // Using any fixed number (i.e. 16384) brings the risk of having similar
845  // issues on newer devices in future. Thus it does not make sense limiting
846  // the returned value on host. Practially speaking the returned value on host
847  // depends only on memory required for the image, which also depends on
848  // the image channel_type and the image height/depth. Both are not known
849  // in this query, thus it becomes user's responsibility to choose proper image
850  // parameters depending on similar query to (non-host device) and amount
851  // of available/allocatable memory.
853 }
854 
855 template <>
856 inline size_t get_device_info_host<info::device::image3d_max_height>() {
857  // SYCL guarantees at least 8192. Some devices already known to provide more
858  // than that (i.e. it is 16384 for opencl:gpu), which may create issues during
859  // image object allocation on host.
860  // Using any fixed number (i.e. 16384) brings the risk of having similar
861  // issues on newer devices in future. Thus it does not make sense limiting
862  // the returned value on host. Practially speaking the returned value on host
863  // depends only on memory required for the image, which also depends on
864  // the image channel_type and the image width/depth. Both are not known
865  // in this query, thus it becomes user's responsibility to choose proper image
866  // parameters depending on similar query to (non-host device) and amount
867  // of available/allocatable memory.
869 }
870 
871 template <>
872 inline size_t get_device_info_host<info::device::image3d_max_depth>() {
873  // SYCL guarantees at least 8192. Some devices already known to provide more
874  // than that (i.e. it is 16384 for opencl:gpu), which may create issues during
875  // image object allocation on host.
876  // Using any fixed number (i.e. 16384) brings the risk of having similar
877  // issues on newer devices in future. Thus it does not make sense limiting
878  // the returned value on host. Practially speaking the returned value on host
879  // depends only on memory required for the image, which also depends on
880  // the image channel_type and the image height/width, which are not known
881  // in this query, thus it becomes user's responsibility to choose proper image
882  // parameters depending on similar query to (non-host device) and amount
883  // of available/allocatable memory.
885 }
886 
887 template <>
888 inline size_t get_device_info_host<info::device::image_max_buffer_size>() {
889  // Not supported in SYCL
890  return 0;
891 }
892 
893 template <>
894 inline size_t get_device_info_host<info::device::image_max_array_size>() {
895  // current value is the required minimum
896  return 2048;
897 }
898 
899 template <> inline uint32_t get_device_info_host<info::device::max_samplers>() {
900  // current value is the required minimum
901  return 16;
902 }
903 
904 template <>
905 inline size_t get_device_info_host<info::device::max_parameter_size>() {
906  // current value is the required minimum
907  return 1024;
908 }
909 
910 template <>
911 inline uint32_t get_device_info_host<info::device::mem_base_addr_align>() {
912  return 1024;
913 }
914 
915 template <>
916 inline std::vector<info::fp_config>
917 get_device_info_host<info::device::half_fp_config>() {
918  // current value is the required minimum
919  return {};
920 }
921 
922 template <>
923 inline std::vector<info::fp_config>
924 get_device_info_host<info::device::single_fp_config>() {
925  // current value is the required minimum
926  return {info::fp_config::round_to_nearest, info::fp_config::inf_nan};
927 }
928 
929 template <>
930 inline std::vector<info::fp_config>
931 get_device_info_host<info::device::double_fp_config>() {
932  // current value is the required minimum
933  return {info::fp_config::fma, info::fp_config::round_to_nearest,
934  info::fp_config::round_to_zero, info::fp_config::round_to_inf,
935  info::fp_config::inf_nan, info::fp_config::denorm};
936 }
937 
938 template <>
940 get_device_info_host<info::device::global_mem_cache_type>() {
941  return info::global_mem_cache_type::read_write;
942 }
943 
944 template <>
945 inline uint32_t
946 get_device_info_host<info::device::global_mem_cache_line_size>() {
947  return PlatformUtil::getMemCacheLineSize();
948 }
949 
950 template <>
951 inline uint64_t get_device_info_host<info::device::global_mem_cache_size>() {
952  return PlatformUtil::getMemCacheSize();
953 }
954 
955 template <>
956 inline uint64_t get_device_info_host<info::device::max_constant_buffer_size>() {
957  // current value is the required minimum
958  return 64 * 1024;
959 }
960 
961 template <>
962 inline uint32_t get_device_info_host<info::device::max_constant_args>() {
963  // current value is the required minimum
964  return 8;
965 }
966 
967 template <>
969 get_device_info_host<info::device::local_mem_type>() {
970  return info::local_mem_type::global;
971 }
972 
973 template <>
974 inline uint64_t get_device_info_host<info::device::local_mem_size>() {
975  // current value is the required minimum
976  return 32 * 1024;
977 }
978 
979 template <>
980 inline bool get_device_info_host<info::device::error_correction_support>() {
981  return false;
982 }
983 
984 template <>
985 inline bool get_device_info_host<info::device::host_unified_memory>() {
986  return true;
987 }
988 
989 template <>
990 inline size_t get_device_info_host<info::device::profiling_timer_resolution>() {
991  typedef std::ratio_divide<std::chrono::high_resolution_clock::period,
992  std::nano>
993  ns_period;
994  return ns_period::num / ns_period::den;
995 }
996 
997 template <> inline bool get_device_info_host<info::device::is_endian_little>() {
998  union {
999  uint16_t a;
1000  uint8_t b[2];
1001  } u = {0x0100};
1002 
1003  return u.b[1];
1004 }
1005 
1006 template <> inline bool get_device_info_host<info::device::is_available>() {
1007  return true;
1008 }
1009 
1010 template <>
1011 inline bool get_device_info_host<info::device::is_compiler_available>() {
1012  return true;
1013 }
1014 
1015 template <>
1016 inline bool get_device_info_host<info::device::is_linker_available>() {
1017  return true;
1018 }
1019 
1020 template <>
1021 inline std::vector<info::execution_capability>
1022 get_device_info_host<info::device::execution_capabilities>() {
1023  return {info::execution_capability::exec_kernel};
1024 }
1025 
1026 template <> inline bool get_device_info_host<info::device::queue_profiling>() {
1027  return true;
1028 }
1029 
1030 template <>
1031 inline std::vector<kernel_id>
1032 get_device_info_host<info::device::built_in_kernel_ids>() {
1033  return {};
1034 }
1035 
1036 template <>
1037 inline std::vector<std::string>
1038 get_device_info_host<info::device::built_in_kernels>() {
1039  return {};
1040 }
1041 
1042 template <> inline platform get_device_info_host<info::device::platform>() {
1043  return platform();
1044 }
1045 
1046 template <> inline std::string get_device_info_host<info::device::name>() {
1047  return "SYCL host device";
1048 }
1049 
1050 template <> inline std::string get_device_info_host<info::device::vendor>() {
1051  return "";
1052 }
1053 
1054 template <>
1055 inline std::string get_device_info_host<info::device::driver_version>() {
1056  return "1.2";
1057 }
1058 
1059 template <> inline std::string get_device_info_host<info::device::profile>() {
1060  return "FULL PROFILE";
1061 }
1062 
1063 template <> inline std::string get_device_info_host<info::device::version>() {
1064  return "1.2";
1065 }
1066 
1067 template <>
1068 inline std::string get_device_info_host<info::device::opencl_c_version>() {
1069  return "not applicable";
1070 }
1071 
1072 template <>
1073 inline std::vector<std::string>
1074 get_device_info_host<info::device::extensions>() {
1075  // TODO update when appropriate
1076  return {};
1077 }
1078 
1079 template <>
1080 inline size_t get_device_info_host<info::device::printf_buffer_size>() {
1081  // current value is the required minimum
1082  return 1024 * 1024;
1083 }
1084 
1085 template <>
1086 inline bool get_device_info_host<info::device::preferred_interop_user_sync>() {
1087  return false;
1088 }
1089 
1090 template <> inline device get_device_info_host<info::device::parent_device>() {
1091  // TODO: implement host device partitioning
1092  throw invalid_object_error(
1093  "Partitioning to subdevices of the host device is not implemented yet",
1094  PI_ERROR_INVALID_DEVICE);
1095 }
1096 
1097 template <>
1098 inline uint32_t
1099 get_device_info_host<info::device::partition_max_sub_devices>() {
1100  // TODO update once subdevice creation is enabled
1101  return 1;
1102 }
1103 
1104 template <>
1105 inline std::vector<info::partition_property>
1106 get_device_info_host<info::device::partition_properties>() {
1107  // TODO update once subdevice creation is enabled
1108  return {};
1109 }
1110 
1111 template <>
1112 inline std::vector<info::partition_affinity_domain>
1113 get_device_info_host<info::device::partition_affinity_domains>() {
1114  // TODO update once subdevice creation is enabled
1115  return {};
1116 }
1117 
1118 template <>
1120 get_device_info_host<info::device::partition_type_property>() {
1121  return info::partition_property::no_partition;
1122 }
1123 
1124 template <>
1126 get_device_info_host<info::device::partition_type_affinity_domain>() {
1127  // TODO update once subdevice creation is enabled
1128  return info::partition_affinity_domain::not_applicable;
1129 }
1130 
1131 template <>
1132 inline uint32_t get_device_info_host<info::device::reference_count>() {
1133  // TODO update once subdevice creation is enabled
1134  return 1;
1135 }
1136 
1137 template <>
1138 inline uint32_t get_device_info_host<info::device::max_num_sub_groups>() {
1139  // TODO update once subgroups are enabled
1140  throw runtime_error("Sub-group feature is not supported on HOST device.",
1141  PI_ERROR_INVALID_DEVICE);
1142 }
1143 
1144 template <>
1145 inline std::vector<size_t>
1146 get_device_info_host<info::device::sub_group_sizes>() {
1147  // TODO update once subgroups are enabled
1148  throw runtime_error("Sub-group feature is not supported on HOST device.",
1149  PI_ERROR_INVALID_DEVICE);
1150 }
1151 
1152 template <>
1153 inline bool
1154 get_device_info_host<info::device::sub_group_independent_forward_progress>() {
1155  // TODO update once subgroups are enabled
1156  throw runtime_error("Sub-group feature is not supported on HOST device.",
1157  PI_ERROR_INVALID_DEVICE);
1158 }
1159 
1160 template <>
1161 inline bool get_device_info_host<info::device::kernel_kernel_pipe_support>() {
1162  return false;
1163 }
1164 
1165 template <>
1166 inline std::string get_device_info_host<info::device::backend_version>() {
1167  throw runtime_error(
1168  "Backend version feature is not supported on HOST device.",
1169  PI_ERROR_INVALID_DEVICE);
1170 }
1171 
1172 template <>
1173 inline bool get_device_info_host<info::device::usm_device_allocations>() {
1174  return true;
1175 }
1176 
1177 template <>
1178 inline bool get_device_info_host<info::device::usm_host_allocations>() {
1179  return true;
1180 }
1181 
1182 template <>
1183 inline bool get_device_info_host<info::device::usm_shared_allocations>() {
1184  return true;
1185 }
1186 
1187 template <>
1188 inline bool
1189 get_device_info_host<info::device::usm_restricted_shared_allocations>() {
1190  return true;
1191 }
1192 
1193 template <>
1194 inline bool get_device_info_host<info::device::usm_system_allocations>() {
1195  return true;
1196 }
1197 
1198 template <>
1199 inline bool get_device_info_host<info::device::ext_intel_mem_channel>() {
1200  return false;
1201 }
1202 
1203 uint32_t get_native_vector_width(size_t idx);
1204 
1205 // USM
1206 
1207 // Specialization for device usm query.
1208 template <> struct get_device_info<bool, info::device::usm_device_allocations> {
1209  static bool get(RT::PiDevice dev, const plugin &Plugin) {
1210  pi_usm_capabilities caps;
1212  dev, pi::cast<RT::PiDeviceInfo>(info::device::usm_device_allocations),
1213  sizeof(pi_usm_capabilities), &caps, nullptr);
1214 
1215  return (Err != PI_SUCCESS) ? false : (caps & PI_USM_ACCESS);
1216  }
1217 };
1218 
1219 // Specialization for host usm query.
1220 template <> struct get_device_info<bool, info::device::usm_host_allocations> {
1221  static bool get(RT::PiDevice dev, const plugin &Plugin) {
1222  pi_usm_capabilities caps;
1224  dev, pi::cast<RT::PiDeviceInfo>(info::device::usm_host_allocations),
1225  sizeof(pi_usm_capabilities), &caps, nullptr);
1226 
1227  return (Err != PI_SUCCESS) ? false : (caps & PI_USM_ACCESS);
1228  }
1229 };
1230 
1231 // Specialization for shared usm query.
1232 template <> struct get_device_info<bool, info::device::usm_shared_allocations> {
1233  static bool get(RT::PiDevice dev, const plugin &Plugin) {
1234  pi_usm_capabilities caps;
1236  dev, pi::cast<RT::PiDeviceInfo>(info::device::usm_shared_allocations),
1237  sizeof(pi_usm_capabilities), &caps, nullptr);
1238  return (Err != PI_SUCCESS) ? false : (caps & PI_USM_ACCESS);
1239  }
1240 };
1241 
1242 // Specialization for restricted usm query
1243 template <>
1244 struct get_device_info<bool, info::device::usm_restricted_shared_allocations> {
1245  static bool get(RT::PiDevice dev, const plugin &Plugin) {
1246  pi_usm_capabilities caps;
1248  dev,
1249  pi::cast<RT::PiDeviceInfo>(
1250  info::device::usm_restricted_shared_allocations),
1251  sizeof(pi_usm_capabilities), &caps, nullptr);
1252  // Check that we don't support any cross device sharing
1253  return (Err != PI_SUCCESS)
1254  ? false
1255  : !(caps & (PI_USM_ACCESS | PI_USM_CONCURRENT_ACCESS));
1256  }
1257 };
1258 
1259 // Specialization for system usm query
1260 template <> struct get_device_info<bool, info::device::usm_system_allocations> {
1261  static bool get(RT::PiDevice dev, const plugin &Plugin) {
1262  pi_usm_capabilities caps;
1264  dev, pi::cast<RT::PiDeviceInfo>(info::device::usm_system_allocations),
1265  sizeof(pi_usm_capabilities), &caps, nullptr);
1266  return (Err != PI_SUCCESS) ? false : (caps & PI_USM_ACCESS);
1267  }
1268 };
1269 
1270 // Specialization for memory channel query
1271 template <> struct get_device_info<bool, info::device::ext_intel_mem_channel> {
1272  static bool get(RT::PiDevice dev, const plugin &Plugin) {
1273  pi_mem_properties caps;
1275  dev, pi::cast<RT::PiDeviceInfo>(info::device::ext_intel_mem_channel),
1276  sizeof(pi_mem_properties), &caps, nullptr);
1277  return (Err != PI_SUCCESS) ? false : (caps & PI_MEM_PROPERTIES_CHANNEL);
1278  }
1279 };
1280 
1281 // Specializations for intel extensions for Level Zero low-level
1282 // detail device descriptors (not support on host).
1283 template <>
1284 inline std::string get_device_info_host<info::device::ext_intel_pci_address>() {
1285  throw runtime_error(
1286  "Obtaining the PCI address is not supported on HOST device",
1287  PI_ERROR_INVALID_DEVICE);
1288 }
1289 template <>
1290 inline uint32_t get_device_info_host<info::device::ext_intel_gpu_eu_count>() {
1291  throw runtime_error("Obtaining the EU count is not supported on HOST device",
1292  PI_ERROR_INVALID_DEVICE);
1293 }
1294 template <>
1295 inline uint32_t
1296 get_device_info_host<info::device::ext_intel_gpu_eu_simd_width>() {
1297  throw runtime_error(
1298  "Obtaining the EU SIMD width is not supported on HOST device",
1299  PI_ERROR_INVALID_DEVICE);
1300 }
1301 template <>
1302 inline uint32_t get_device_info_host<info::device::ext_intel_gpu_slices>() {
1303  throw runtime_error(
1304  "Obtaining the number of slices is not supported on HOST device",
1305  PI_ERROR_INVALID_DEVICE);
1306 }
1307 template <>
1308 inline uint32_t
1309 get_device_info_host<info::device::ext_intel_gpu_subslices_per_slice>() {
1310  throw runtime_error("Obtaining the number of subslices per slice is not "
1311  "supported on HOST device",
1312  PI_ERROR_INVALID_DEVICE);
1313 }
1314 template <>
1315 inline uint32_t
1316 get_device_info_host<info::device::ext_intel_gpu_eu_count_per_subslice>() {
1317  throw runtime_error(
1318  "Obtaining the EU count per subslice is not supported on HOST device",
1319  PI_ERROR_INVALID_DEVICE);
1320 }
1321 template <>
1322 inline uint32_t
1323 get_device_info_host<info::device::ext_intel_gpu_hw_threads_per_eu>() {
1324  throw runtime_error(
1325  "Obtaining the HW threads count per EU is not supported on HOST device",
1326  PI_ERROR_INVALID_DEVICE);
1327 }
1328 template <>
1329 inline uint64_t
1330 get_device_info_host<info::device::ext_intel_max_mem_bandwidth>() {
1331  throw runtime_error(
1332  "Obtaining the maximum memory bandwidth is not supported on HOST device",
1333  PI_ERROR_INVALID_DEVICE);
1334 }
1335 template <> inline bool get_device_info_host<info::device::ext_oneapi_srgb>() {
1336  return false;
1337 }
1338 
1339 template <>
1340 inline detail::uuid_type
1341 get_device_info_host<info::device::ext_intel_device_info_uuid>() {
1342  throw runtime_error(
1343  "Obtaining the device uuid is not supported on HOST device",
1344  PI_ERROR_INVALID_DEVICE);
1345 }
1346 
1347 } // namespace detail
1348 } // namespace sycl
1349 } // __SYCL_INLINE_NAMESPACE(cl)
cl::sycl::detail::get_device_info< std::vector< info::execution_capability >, info::device::execution_capabilities >::get
static std::vector< info::execution_capability > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:287
PI_USM_ACCESS
@ PI_USM_ACCESS
Definition: pi.h:1589
PI_DEVICE_AFFINITY_DOMAIN_L4_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L4_CACHE
Definition: pi.h:610
cl::sycl::detail::get_device_info< info::partition_property, info::device::partition_type_property >::get
static info::partition_property get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:438
cl::sycl::detail::get_device_info< id< 1 >, info::device::ext_oneapi_max_work_groups_1d >::get
static id< 1 > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:522
cl::sycl::detail::get_device_info< std::string, param >::get
static std::string get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:147
cl::sycl::detail::is_sycl_partition_property
static bool is_sycl_partition_property(info::partition_property PP)
Definition: device_info.hpp:339
_pi_usm_capabilities
_pi_usm_capabilities
Definition: pi.h:1588
cl::sycl::detail::read_domain_bitfield
std::vector< info::partition_affinity_domain > read_domain_bitfield(pi_device_affinity_domain bits)
Definition: device_info.hpp:53
cl::sycl::info::global_mem_cache_type
global_mem_cache_type
Definition: info_desc.hpp:221
pi_bool
pi_uint32 pi_bool
Definition: pi.h:96
cl::sycl::detail::get_device_info< bool, info::device::usm_host_allocations >::get
static bool get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:1221
cl::sycl::info::param_traits
Definition: info_desc.hpp:310
cl::sycl::detail::sycl_to_pi::type
T type
Definition: device_info.hpp:81
device.hpp
cl::sycl::id
A unique identifier of an item in an index space.
Definition: array.hpp:17
cl::sycl::detail::get_device_info< bool, info::device::usm_system_allocations >::get
static bool get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:1261
pi_usm_capabilities
_pi_usm_capabilities pi_usm_capabilities
Definition: pi.h:1617
cl::sycl::detail::pi::PiDevice
::pi_device PiDevice
Definition: pi.hpp:102
cl::sycl::detail::read_fp_bitfield
std::vector< info::fp_config > read_fp_bitfield(pi_device_fp_config bits)
Definition: device_info.hpp:31
_pi_result
_pi_result
Definition: pi.h:105
cl::sycl::detail::sycl_to_pi
Definition: device_info.hpp:81
cl::sycl::detail::get_device_info< id< 2 >, info::device::ext_oneapi_max_work_groups_2d >::get
static id< 2 > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:537
cl::sycl::platform::get_info
info::param_traits< info::platform, param >::return_type get_info() const
Queries this SYCL platform for info.
Definition: platform.cpp:54
cl::sycl::info::device_type
device_type
Definition: info_desc.hpp:180
os_util.hpp
cl::sycl::detail::get_device_info< std::vector< std::string >, info::device::built_in_kernels >::get
static std::vector< std::string > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:320
cl::sycl::detail::get_device_info< size_t, info::device::ext_oneapi_max_global_work_groups >::get
static size_t get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:513
cl::sycl::detail::uuid_type
std::array< unsigned char, 16 > uuid_type
Definition: type_traits.hpp:62
cl::sycl::detail::get_device_info
Definition: device_info.hpp:101
sycl
Definition: invoke_simd.hpp:68
device_impl.hpp
plugin.hpp
cl::sycl::detail::get_device_info< bool, info::device::usm_device_allocations >::get
static bool get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:1209
max
simd< _Tp, _Abi > max(const simd< _Tp, _Abi > &, const simd< _Tp, _Abi > &) noexcept
_pi_platform
A PI platform stores all known PI devices, in the CUDA plugin this is just a vector of available devi...
Definition: pi_cuda.hpp:72
cl::sycl::detail::get_device_info< info::partition_affinity_domain, info::device::partition_type_affinity_domain >::get
static info::partition_affinity_domain get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:405
PI_FP_ROUND_TO_NEAREST
static constexpr pi_device_fp_config PI_FP_ROUND_TO_NEAREST
Definition: pi.h:625
pi.hpp
cl::sycl::detail::plugin::call_nocheck
RT::PiResult call_nocheck(ArgsT... Args) const
Calls the PiApi, traces the call, and returns the result.
Definition: plugin.hpp:170
cl::sycl::detail::get_device_info< bool, info::device::kernel_kernel_pipe_support >::get
static bool get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:479
cl::sycl::detail::get_device_info< std::string, info::device::version >::get
static std::string get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:190
cl::sycl::detail::read_execution_bitfield
std::vector< info::execution_capability > read_execution_bitfield(pi_device_exec_capabilities bits)
Definition: device_info.hpp:71
cl::sycl::detail::get_device_info::get
static T get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:102
cl::sycl::detail::get_device_info< std::vector< info::fp_config >, info::device::single_fp_config >::get
static std::vector< info::fp_config > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:216
cl::sycl::info::partition_affinity_domain
partition_affinity_domain
Definition: info_desc.hpp:198
PI_DEVICE_AFFINITY_DOMAIN_L3_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L3_CACHE
Definition: pi.h:612
cl::sycl::detail::get_device_info< platform, param >::get
static platform get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:113
cl::sycl::detail::get_device_info_string::get
static std::string get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:129
PI_EXEC_KERNEL
static constexpr pi_device_exec_capabilities PI_EXEC_KERNEL
Definition: pi.h:635
platform_impl.hpp
cl::sycl::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:36
cl::sycl::detail::get_device_info< device, info::device::parent_device >::get
static device get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:568
cl::sycl::fma
detail::enable_if_t< detail::is_genfloat< T >::value, T > fma(T a, T b, T c) __NOEXC
Definition: builtins.hpp:196
PI_FP_SOFT_FLOAT
static constexpr pi_device_fp_config PI_FP_SOFT_FLOAT
Definition: pi.h:629
PI_FP_DENORM
static constexpr pi_device_fp_config PI_FP_DENORM
Definition: pi.h:623
PI_USM_CONCURRENT_ACCESS
@ PI_USM_CONCURRENT_ACCESS
Definition: pi.h:1591
cl::sycl::detail::check_fp_support
Definition: device_info.hpp:87
cl::sycl::detail::get_device_info< std::vector< info::partition_property >, info::device::partition_properties >::get
static std::vector< info::partition_property > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:354
cl::sycl::detail::plugin::call
void call(ArgsT... Args) const
Calls the API, traces the call, checks the result.
Definition: plugin.hpp:217
defines.hpp
piDeviceGetInfo
pi_result piDeviceGetInfo(pi_device device, pi_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
Returns requested info for provided native device Return PI_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT fo...
Definition: pi_esimd_emulator.cpp:591
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::detail::readMemoryOrderBitfield
std::vector< memory_order > readMemoryOrderBitfield(pi_memory_order_capabilities bits)
Definition: memory_enums.hpp:51
cl::sycl::info::partition_property
partition_property
Definition: info_desc.hpp:191
PI_FP_ROUND_TO_INF
static constexpr pi_device_fp_config PI_FP_ROUND_TO_INF
Definition: pi.h:627
PI_DEVICE_INFO_PARTITION_TYPE
@ PI_DEVICE_INFO_PARTITION_TYPE
Definition: pi.h:250
pi_memory_scope_capabilities
pi_bitfield pi_memory_scope_capabilities
Definition: pi.h:506
cl::sycl::detail::get_device_info< std::vector< memory_order >, info::device::atomic_memory_order_capabilities >::get
static std::vector< memory_order > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:241
pi_mem_properties
pi_bitfield pi_mem_properties
Definition: pi.h:540
pi_device_exec_capabilities
pi_bitfield pi_device_exec_capabilities
Definition: pi.h:487
cl::sycl::detail::get_device_info< std::vector< memory_scope >, info::device::atomic_memory_scope_capabilities >::get
static std::vector< memory_scope > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:256
cl::sycl::detail::get_device_info< std::vector< std::string >, info::device::extensions >::get
static std::vector< std::string > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:331
cl::sycl::detail::plugin
The plugin class provides a unified interface to the underlying low-level runtimes for the device-agn...
Definition: plugin.hpp:90
cl::sycl::detail::get_device_info< bool, info::device::ext_intel_mem_channel >::get
static bool get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:1272
program_manager.hpp
cl::sycl::detail::get_native_vector_width
uint32_t get_native_vector_width(size_t idx)
cl::sycl::image_channel_order::a
@ a
cl::sycl::detail::split_string
std::vector< std::string > split_string(const std::string &str, char delimeter)
Definition: common.cpp:33
std::get
constexpr tuple_element< I, tuple< Types... > >::type & get(cl::sycl::detail::tuple< Types... > &Arg) noexcept
Definition: tuple.hpp:199
platform_util.hpp
cl::sycl::detail::sycl_to_pi< bool >::type
pi_bool type
Definition: device_info.hpp:82
pi_device_fp_config
pi_bitfield pi_device_fp_config
Definition: pi.h:622
cl::sycl::detail::get_device_info< id< 3 >, param >::get
static id< 3 > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:159
PI_FP_FMA
static constexpr pi_device_fp_config PI_FP_FMA
Definition: pi.h:628
platform.hpp
cl::sycl::detail::get_device_info< bool, info::device::usm_restricted_shared_allocations >::get
static bool get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:1245
cl::sycl::detail::get_device_info< bool, info::device::ext_oneapi_bfloat16 >::get
static bool get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:269
PI_DEVICE_AFFINITY_DOMAIN_NUMA
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NUMA
Definition: pi.h:608
PI_MEM_PROPERTIES_CHANNEL
constexpr pi_mem_properties PI_MEM_PROPERTIES_CHANNEL
Definition: pi.h:541
cl::sycl::info::local_mem_type
local_mem_type
Definition: info_desc.hpp:208
cl::sycl::platform
Encapsulates a SYCL platform on which kernels may be executed.
Definition: platform.hpp:34
std
Definition: accessor.hpp:2617
cl::sycl::detail::get_device_info< std::vector< info::partition_affinity_domain >, info::device::partition_affinity_domains >::get
static std::vector< info::partition_affinity_domain > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:390
PI_FP_INF_NAN
static constexpr pi_device_fp_config PI_FP_INF_NAN
Definition: pi.h:624
PI_EXEC_NATIVE_KERNEL
static constexpr pi_device_exec_capabilities PI_EXEC_NATIVE_KERNEL
Definition: pi.h:636
cl::sycl::detail::get_device_info< id< 3 >, info::device::max_work_item_sizes >::get
static id< 3 > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:501
PI_DEVICE_AFFINITY_DOMAIN_L1_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L1_CACHE
Definition: pi.h:616
cl::sycl::detail::get_device_info< std::vector< kernel_id >, info::device::built_in_kernel_ids >::get
static std::vector< kernel_id > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:301
PI_DEVICE_AFFINITY_DOMAIN_L2_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L2_CACHE
Definition: pi.h:614
memory_enums.hpp
info_desc.hpp
PI_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
static constexpr pi_device_fp_config PI_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
Definition: pi.h:630
cl::sycl::detail::get_device_info< id< 3 >, info::device::ext_oneapi_max_work_groups_3d >::get
static id< 3 > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:552
pi_device_affinity_domain
pi_bitfield pi_device_affinity_domain
Definition: pi.h:607
cl::sycl::detail::get_device_info< std::vector< info::fp_config >, param >::get
static std::vector< info::fp_config > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:171
cl::sycl::info::device
device
Definition: info_desc.hpp:53
cl::sycl::detail::get_device_info_string
Definition: device_info.hpp:128
cl::sycl::detail::get_device_info< std::vector< size_t >, info::device::sub_group_sizes >::get
static std::vector< size_t > get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:460
cl::sycl::detail::get_device_info< bool, info::device::queue_profiling >::get
static bool get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:228
common_info.hpp
cl::sycl::detail::readMemoryScopeBitfield
std::vector< memory_scope > readMemoryScopeBitfield(pi_memory_scope_capabilities bits)
Definition: memory_enums.hpp:67
pi_memory_order_capabilities
pi_bitfield pi_memory_order_capabilities
Definition: pi.h:499
cl::sycl::detail::get_device_info_host
info::param_traits< info::device, param >::return_type get_device_info_host()=delete
cl::sycl::detail::pi::PiPlatform
::pi_platform PiPlatform
Definition: pi.hpp:101
PI_FP_ROUND_TO_ZERO
static constexpr pi_device_fp_config PI_FP_ROUND_TO_ZERO
Definition: pi.h:626
PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
Definition: pi.h:619
_pi_device
PI device mapping to a CUdevice.
Definition: pi_cuda.hpp:82
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12
cl::sycl::detail::get_device_info< bool, info::device::usm_shared_allocations >::get
static bool get(RT::PiDevice dev, const plugin &Plugin)
Definition: device_info.hpp:1233