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