DPC++ Runtime
Runtime libraries for oneAPI DPC++
info_desc.hpp
Go to the documentation of this file.
1 //==------- info_desc.hpp - SYCL information descriptors -------------------==//
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
10 
11 #include <sycl/aspects.hpp>
12 #include <sycl/detail/common.hpp>
13 #include <sycl/detail/pi.hpp>
14 #include <sycl/id.hpp>
15 
16 namespace sycl {
18 
19 class device;
20 class platform;
21 class kernel_id;
22 enum class memory_scope;
23 
24 // TODO: stop using OpenCL directly, use PI.
25 namespace info {
26 #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
27  struct Desc { \
28  using return_type = ReturnT; \
29  };
30 // A.1 Platform information desctiptors
31 namespace platform {
32 // TODO Despite giving this deprecation warning, we're still yet to implement
33 // info::device::aspects.
34 struct __SYCL2020_DEPRECATED("deprecated in SYCL 2020, use device::get_info() "
35  "with info::device::aspects instead") extensions;
36 #include <sycl/info/platform_traits.def>
37 } // namespace platform
38 // A.2 Context information desctiptors
39 namespace context {
40 #include <sycl/info/context_traits.def>
41 } // namespace context
42 
43 // A.3 Device information descriptors
44 enum class device_type : pi_uint64 {
46  gpu = PI_DEVICE_TYPE_GPU,
48  // TODO: figure out if we need all the below in PI
50  automatic,
51  host,
53 };
54 
56  no_partition = 0,
61 };
62 
64  not_applicable = 0,
71 };
72 
73 enum class local_mem_type : int { none, local, global };
74 
81  fma = PI_FP_FMA,
84 };
85 
86 enum class global_mem_cache_type : int { none, read_only, read_write };
87 
88 enum class execution_capability : unsigned int {
91 };
92 
93 namespace device {
94 // TODO implement the following SYCL 2020 device info descriptors:
95 // atomic_fence_order_capabilities, atomic_fence_scope_capabilities, aspects,
96 // il_version.
97 
98 struct atomic_fence_order_capabilities;
99 struct atomic_fence_scope_capabilities;
100 
101 #define __SYCL_PARAM_TRAITS_DEPRECATED(Desc, Message) \
102  struct __SYCL2020_DEPRECATED(Message) Desc;
103 #include <sycl/info/device_traits_deprecated.def>
104 #undef __SYCL_PARAM_TRAITS_DEPRECATED
105 
106 template <int Dimensions = 3> struct max_work_item_sizes;
107 #define __SYCL_PARAM_TRAITS_TEMPLATE_SPEC(DescType, Desc, ReturnT, PiCode) \
108  template <> struct Desc { \
109  using return_type = ReturnT; \
110  };
111 #define __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(DescType, Desc, ReturnT, PiCode) \
112  __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode)
113 
114 #include <sycl/info/device_traits.def>
115 } // namespace device
116 #undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED
117 #undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
118 
119 // A.4 Queue information descriptors
120 namespace queue {
121 #include <sycl/info/queue_traits.def>
122 } // namespace queue
123 
124 // A.5 Kernel information desctiptors
125 namespace kernel {
126 #include <sycl/info/kernel_traits.def>
127 } // namespace kernel
128 
129 namespace kernel_device_specific {
130 #include <sycl/info/kernel_device_specific_traits.def>
131 } // namespace kernel_device_specific
132 
133 // A.6 Event information desctiptors
138  // Since all BE values are positive, it is safe to use a negative value If you
139  // add other ext_oneapi values
140  ext_oneapi_unknown = -1
141 };
142 
143 namespace event {
144 #include <sycl/info/event_traits.def>
145 } // namespace event
146 namespace event_profiling {
147 #include <sycl/info/event_profiling_traits.def>
148 } // namespace event_profiling
149 #undef __SYCL_PARAM_TRAITS_SPEC
150 
151 // Provide an alias to the return type for each of the info parameters
152 template <typename T, T param> class param_traits {};
153 
154 template <typename T, T param> struct compatibility_param_traits {};
155 
156 #define __SYCL_PARAM_TRAITS_SPEC(param_type, param, ret_type) \
157  template <> class param_traits<param_type, param_type::param> { \
158  public: \
159  using return_type = ret_type; \
160  };
161 #undef __SYCL_PARAM_TRAITS_SPEC
162 } // namespace info
163 
164 #define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, PiCode) \
165  namespace Namespace { \
166  namespace info { \
167  namespace DescType { \
168  struct Desc { \
169  using return_type = ReturnT; \
170  }; \
171  } /*DescType*/ \
172  } /*info*/ \
173  } /*Namespace*/
174 
175 #define __SYCL_PARAM_TRAITS_TEMPLATE_SPEC(Namespace, DescType, Desc, ReturnT, \
176  PiCode) \
177  namespace Namespace { \
178  namespace info { \
179  namespace DescType { \
180  template <> struct Desc { \
181  using return_type = ReturnT; \
182  }; \
183  } /*namespace DescType */ \
184  } /*namespace info */ \
185  } /*namespace Namespace */
186 
187 namespace ext::oneapi::experimental::info::device {
188 template <int Dimensions> struct max_work_groups;
189 } // namespace ext::oneapi::experimental::info::device
190 #include <sycl/info/ext_codeplay_device_traits.def>
191 #include <sycl/info/ext_intel_device_traits.def>
192 #include <sycl/info/ext_oneapi_device_traits.def>
193 #undef __SYCL_PARAM_TRAITS_SPEC
194 #undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
195 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
196 } // namespace sycl
sycl::_V1::info::partition_affinity_domain
partition_affinity_domain
Definition: info_desc.hpp:63
sycl::_V1::__SYCL2020_DEPRECATED
signed char __SYCL2020_DEPRECATED
Definition: aliases.hpp:96
aspects.hpp
PI_DEVICE_PARTITION_EQUALLY
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_EQUALLY
Definition: pi.h:702
PI_DEVICE_AFFINITY_DOMAIN_L4_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L4_CACHE
Definition: pi.h:717
sycl::_V1::instead
std::uint8_t instead
Definition: aliases.hpp:95
sycl::_V1::info::partition_affinity_domain::next_partitionable
@ next_partitionable
sycl::_V1::errc::platform
@ platform
sycl::_V1::info::event_command_status::complete
@ complete
sycl::_V1::info::local_mem_type::global
@ global
sycl::_V1::info::param_traits
Definition: info_desc.hpp:152
sycl::_V1::info::partition_property
partition_property
Definition: info_desc.hpp:55
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
sycl::_V1::info::partition_affinity_domain::numa
@ numa
sycl::_V1::info::event_command_status
event_command_status
Definition: info_desc.hpp:134
sycl::_V1::info::partition_property::partition_by_counts
@ partition_by_counts
sycl::_V1::info::fp_config
fp_config
Definition: info_desc.hpp:75
sycl::_V1::info::partition_affinity_domain::L4_cache
@ L4_cache
sycl::_V1::info::device::max_work_item_sizes
Definition: info_desc.hpp:106
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::backend::all
@ all
sycl::_V1::info::execution_capability::exec_kernel
@ exec_kernel
PI_EVENT_RUNNING
@ PI_EVENT_RUNNING
Definition: pi.h:163
sycl::_V1::event
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Definition: event.hpp:40
sycl::_V1::info::partition_property::partition_equally
@ partition_equally
sycl::_V1::info::compatibility_param_traits
Definition: info_desc.hpp:154
PI_FP_ROUND_TO_NEAREST
static constexpr pi_device_fp_config PI_FP_ROUND_TO_NEAREST
Definition: pi.h:732
pi.hpp
sycl::_V1::ext::oneapi::experimental::info::device::max_work_groups
Definition: info_desc.hpp:188
id.hpp
sycl::_V1::info::partition_property::ext_intel_partition_by_cslice
@ ext_intel_partition_by_cslice
sycl::_V1::info::fp_config::correctly_rounded_divide_sqrt
@ correctly_rounded_divide_sqrt
sycl::_V1::info::execution_capability
execution_capability
Definition: info_desc.hpp:88
sycl::_V1::info::fp_config::denorm
@ denorm
sycl::_V1::kernel
Provides an abstraction of a SYCL kernel.
Definition: kernel.hpp:72
sycl::_V1::info::fp_config::inf_nan
@ inf_nan
sycl::_V1::info::partition_affinity_domain::L2_cache
@ L2_cache
sycl::_V1::info::local_mem_type
local_mem_type
Definition: info_desc.hpp:73
sycl::_V1::read_only
constexpr mode_tag_t< access_mode::read > read_only
Definition: access.hpp:75
PI_DEVICE_AFFINITY_DOMAIN_L3_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L3_CACHE
Definition: pi.h:719
sycl::_V1::info::fp_config::round_to_nearest
@ round_to_nearest
sycl::_V1::info::partition_property::partition_by_affinity_domain
@ partition_by_affinity_domain
sycl::_V1::info::event_command_status::ext_oneapi_unknown
@ ext_oneapi_unknown
PI_DEVICE_TYPE_GPU
@ PI_DEVICE_TYPE_GPU
A PI device that is a GPU.
Definition: pi.h:206
sycl::_V1::queue
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition: queue.hpp:89
PI_FP_DENORM
static constexpr pi_device_fp_config PI_FP_DENORM
Definition: pi.h:730
PI_DEVICE_TYPE_ACC
@ PI_DEVICE_TYPE_ACC
A PI device that is a dedicated accelerator.
Definition: pi.h:207
common.hpp
PI_EXT_INTEL_DEVICE_PARTITION_BY_CSLICE
static constexpr pi_device_partition_property PI_EXT_INTEL_DEVICE_PARTITION_BY_CSLICE
Definition: pi.h:711
PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN
Definition: pi.h:709
PI_FP_ROUND_TO_INF
static constexpr pi_device_fp_config PI_FP_ROUND_TO_INF
Definition: pi.h:734
sycl::_V1::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:49
pi_uint64
uint64_t pi_uint64
Definition: pi.h:143
sycl::_V1::info::partition_affinity_domain::not_applicable
@ not_applicable
sycl::_V1::info::partition_affinity_domain::L1_cache
@ L1_cache
sycl::_V1::access::target::device
@ device
sycl::_V1::read_write
constexpr mode_tag_t< access_mode::read_write > read_write
Definition: access.hpp:76
sycl::_V1::info::device_type
device_type
Definition: info_desc.hpp:44
sycl::_V1::info::device_type::custom
@ custom
sycl::_V1::info::device_type::host
@ host
sycl::_V1::info::event_command_status::submitted
@ submitted
PI_EVENT_COMPLETE
@ PI_EVENT_COMPLETE
Definition: pi.h:162
sycl::_V1::info::device_type::cpu
@ cpu
PI_DEVICE_TYPE_CPU
@ PI_DEVICE_TYPE_CPU
A PI device that is the host processor.
Definition: pi.h:205
PI_DEVICE_TYPE_CUSTOM
@ PI_DEVICE_TYPE_CUSTOM
A PI device that is a custom device.
Definition: pi.h:209
sycl::_V1::info::execution_capability::exec_native_kernel
@ exec_native_kernel
pi_device_fp_config
pi_bitfield pi_device_fp_config
Definition: pi.h:729
sycl::_V1::info::partition_property::no_partition
@ no_partition
sycl::_V1::memory_scope
memory_scope
Definition: memory_enums.hpp:26
PI_FP_FMA
static constexpr pi_device_fp_config PI_FP_FMA
Definition: pi.h:735
PI_DEVICE_AFFINITY_DOMAIN_NUMA
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NUMA
Definition: pi.h:715
PI_FP_INF_NAN
static constexpr pi_device_fp_config PI_FP_INF_NAN
Definition: pi.h:731
PI_DEVICE_AFFINITY_DOMAIN_L1_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L1_CACHE
Definition: pi.h:723
sycl::_V1::info::partition_affinity_domain::L3_cache
@ L3_cache
PI_DEVICE_AFFINITY_DOMAIN_L2_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L2_CACHE
Definition: pi.h:721
PI_DEVICE_PARTITION_BY_COUNTS
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_COUNTS
Definition: pi.h:704
sycl::_V1::info::device_type::accelerator
@ accelerator
sycl::_V1::ext::oneapi::experimental::matrix::use
use
Definition: matrix-unified-utils.hpp:17
PI_DEVICE_TYPE_ALL
@ PI_DEVICE_TYPE_ALL
All devices available in the PI plugin.
Definition: pi.h:204
sycl::_V1::platform
Encapsulates a SYCL platform on which kernels may be executed.
Definition: platform.hpp:45
pi_device_affinity_domain
pi_bitfield pi_device_affinity_domain
Definition: pi.h:714
sycl::_V1::info::event_command_status::running
@ running
sycl::_V1::info::fp_config::round_to_inf
@ round_to_inf
sycl::_V1::info::fp_config::round_to_zero
@ round_to_zero
pi_device_partition_property
intptr_t pi_device_partition_property
Definition: pi.h:701
PI_FP_ROUND_TO_ZERO
static constexpr pi_device_fp_config PI_FP_ROUND_TO_ZERO
Definition: pi.h:733
PI_EVENT_SUBMITTED
@ PI_EVENT_SUBMITTED
Definition: pi.h:164
pi_int32
int32_t pi_int32
Definition: pi.h:141
sycl::_V1::info::fp_config::soft_float
@ soft_float
sycl::_V1::info::global_mem_cache_type
global_mem_cache_type
Definition: info_desc.hpp:86
PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
Definition: pi.h:726
sycl::_V1::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:41