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/detail/defines_elementary.hpp> // for __SYCL2020_DEPRECATED
12 #include <sycl/detail/pi.h> // for PI_DEVICE_AFFINITY_DOMAIN_L...
13 
14 // FIXME: .def files included to this file use all sorts of SYCL objects like
15 // id, range, traits, etc. We have to include some headers before including .def
16 // files.
17 #include <sycl/aspects.hpp>
21 
22 #include <sycl/range.hpp>
23 
24 namespace sycl {
25 inline namespace _V1 {
26 
27 class device;
28 class platform;
29 class kernel_id;
30 enum class memory_scope;
31 enum class memory_order;
32 
33 // TODO: stop using OpenCL directly, use PI.
34 namespace info {
35 #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
36  struct Desc { \
37  using return_type = ReturnT; \
38  };
39 // A.1 Platform information desctiptors
40 namespace platform {
41 // TODO Despite giving this deprecation warning, we're still yet to implement
42 // info::device::aspects.
43 struct __SYCL2020_DEPRECATED("deprecated in SYCL 2020, use device::get_info() "
44  "with info::device::aspects instead") extensions;
45 #include <sycl/info/platform_traits.def>
46 } // namespace platform
47 // A.2 Context information desctiptors
48 namespace context {
49 #include <sycl/info/context_traits.def>
50 } // namespace context
51 
52 // A.3 Device information descriptors
53 enum class device_type : pi_uint64 {
55  gpu = PI_DEVICE_TYPE_GPU,
57  // TODO: figure out if we need all the below in PI
59  automatic,
60  host,
62 };
63 
65  no_partition = 0,
70 };
71 
73  not_applicable = 0,
80 };
81 
82 enum class local_mem_type : int { none, local, global };
83 
87  round_to_nearest = PI_FP_ROUND_TO_NEAREST,
90  fma = PI_FP_FMA,
93 };
94 
95 enum class global_mem_cache_type : int { none, read_only, read_write };
96 
97 enum class execution_capability : unsigned int {
100 };
101 
102 namespace device {
103 // TODO implement the following SYCL 2020 device info descriptors:
104 // atomic_fence_order_capabilities, atomic_fence_scope_capabilities, aspects,
105 // il_version.
106 
107 struct atomic_fence_order_capabilities;
108 struct atomic_fence_scope_capabilities;
109 
110 #define __SYCL_PARAM_TRAITS_DEPRECATED(Desc, Message) \
111  struct __SYCL2020_DEPRECATED(Message) Desc;
112 #include <sycl/info/device_traits_deprecated.def>
113 #undef __SYCL_PARAM_TRAITS_DEPRECATED
114 
115 template <int Dimensions = 3> struct max_work_item_sizes;
116 #define __SYCL_PARAM_TRAITS_TEMPLATE_SPEC(DescType, Desc, ReturnT, PiCode) \
117  template <> struct Desc { \
118  using return_type = ReturnT; \
119  };
120 #define __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(DescType, Desc, ReturnT, PiCode) \
121  __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode)
122 
123 #include <sycl/info/device_traits.def>
124 } // namespace device
125 #undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED
126 #undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
127 
128 // A.4 Queue information descriptors
129 namespace queue {
130 #include <sycl/info/queue_traits.def>
131 } // namespace queue
132 
133 // A.5 Kernel information desctiptors
134 namespace kernel {
135 #include <sycl/info/kernel_traits.def>
136 } // namespace kernel
137 
138 namespace kernel_device_specific {
139 #include <sycl/info/kernel_device_specific_traits.def>
140 } // namespace kernel_device_specific
141 
142 // A.6 Event information desctiptors
147  // Since all BE values are positive, it is safe to use a negative value If you
148  // add other ext_oneapi values
149  ext_oneapi_unknown = -1
150 };
151 
152 namespace event {
153 #include <sycl/info/event_traits.def>
154 } // namespace event
155 namespace event_profiling {
156 #include <sycl/info/event_profiling_traits.def>
157 } // namespace event_profiling
158 #undef __SYCL_PARAM_TRAITS_SPEC
159 
160 // Provide an alias to the return type for each of the info parameters
161 template <typename T, T param> class param_traits {};
162 
163 template <typename T, T param> struct compatibility_param_traits {};
164 
165 #define __SYCL_PARAM_TRAITS_SPEC(param_type, param, ret_type) \
166  template <> class param_traits<param_type, param_type::param> { \
167  public: \
168  using return_type = ret_type; \
169  };
170 #undef __SYCL_PARAM_TRAITS_SPEC
171 } // namespace info
172 
173 #define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, PiCode) \
174  namespace Namespace { \
175  namespace info { \
176  namespace DescType { \
177  struct Desc { \
178  using return_type = ReturnT; \
179  }; \
180  } /*DescType*/ \
181  } /*info*/ \
182  } /*Namespace*/
183 
184 #define __SYCL_PARAM_TRAITS_TEMPLATE_SPEC(Namespace, DescType, Desc, ReturnT, \
185  PiCode) \
186  namespace Namespace { \
187  namespace info { \
188  namespace DescType { \
189  template <> struct Desc { \
190  using return_type = ReturnT; \
191  }; \
192  } /*namespace DescType */ \
193  } /*namespace info */ \
194  } /*namespace Namespace */
195 
196 namespace ext::oneapi::experimental {
197 
198 enum class graph_support_level { unsupported = 0, native = 1, emulated = 2 };
199 
200 namespace info::device {
201 template <int Dimensions> struct max_work_groups;
202 } // namespace info::device
203 } // namespace ext::oneapi::experimental
204 #include <sycl/info/ext_codeplay_device_traits.def>
205 #include <sycl/info/ext_intel_device_traits.def>
206 #include <sycl/info/ext_oneapi_device_traits.def>
207 #undef __SYCL_PARAM_TRAITS_SPEC
208 #undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
209 } // namespace _V1
210 } // namespace sycl
sycl::_V1::info::partition_affinity_domain
partition_affinity_domain
Definition: info_desc.hpp:72
sycl::_V1::__SYCL2020_DEPRECATED
signed char __SYCL2020_DEPRECATED
Definition: aliases.hpp:94
aspects.hpp
PI_DEVICE_PARTITION_EQUALLY
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_EQUALLY
Definition: pi.h:789
PI_DEVICE_AFFINITY_DOMAIN_L4_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L4_CACHE
Definition: pi.h:804
sycl::_V1::instead
std::uint8_t instead
Definition: aliases.hpp:93
sycl::_V1::info::partition_affinity_domain::next_partitionable
@ next_partitionable
pi.h
sycl::_V1::errc::platform
@ platform
sycl::_V1::info::event_command_status::complete
@ complete
sycl::_V1::info::param_traits
Definition: info_desc.hpp:161
sycl::_V1::info::partition_property
partition_property
Definition: info_desc.hpp:64
type_traits.hpp
device_architecture.hpp
sycl::_V1::info::partition_affinity_domain::numa
@ numa
sycl::_V1::info::event_command_status
event_command_status
Definition: info_desc.hpp:143
sycl::_V1::info::partition_property::partition_by_counts
@ partition_by_counts
sycl::_V1::info::fp_config
fp_config
Definition: info_desc.hpp:84
sycl::_V1::info::partition_affinity_domain::L4_cache
@ L4_cache
sycl::_V1::all
std::enable_if_t< detail::is_vigeninteger_v< T >, int > all(T x)
Definition: builtins_legacy_marray_vec.hpp:1108
sycl::_V1::info::device::max_work_item_sizes
Definition: info_desc.hpp:115
sycl
Definition: access.hpp:18
sycl::_V1::info::execution_capability::exec_kernel
@ exec_kernel
PI_EVENT_RUNNING
@ PI_EVENT_RUNNING
Definition: pi.h:215
sycl::_V1::event
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Definition: event.hpp:44
sycl::_V1::info::partition_property::partition_equally
@ partition_equally
sycl::_V1::info::compatibility_param_traits
Definition: info_desc.hpp:163
PI_FP_ROUND_TO_NEAREST
static constexpr pi_device_fp_config PI_FP_ROUND_TO_NEAREST
Definition: pi.h:819
sycl::_V1::ext::oneapi::experimental::info::device::max_work_groups
Definition: info_desc.hpp:201
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:97
sycl::_V1::info::fp_config::denorm
@ denorm
sycl::_V1::kernel
Provides an abstraction of a SYCL kernel.
Definition: kernel.hpp:74
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:82
sycl::_V1::read_only
constexpr mode_tag_t< access_mode::read > read_only
Definition: access.hpp:84
sycl::_V1::ext::oneapi::experimental::graph_support_level
graph_support_level
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:806
defines_elementary.hpp
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:258
query-types.hpp
sycl::_V1::queue
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition: queue.hpp:119
range.hpp
PI_FP_DENORM
static constexpr pi_device_fp_config PI_FP_DENORM
Definition: pi.h:817
PI_DEVICE_TYPE_ACC
@ PI_DEVICE_TYPE_ACC
A PI device that is a dedicated accelerator.
Definition: pi.h:259
PI_EXT_INTEL_DEVICE_PARTITION_BY_CSLICE
static constexpr pi_device_partition_property PI_EXT_INTEL_DEVICE_PARTITION_BY_CSLICE
Definition: pi.h:798
sycl::_V1::ext::oneapi::experimental::graph_support_level::unsupported
@ unsupported
PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN
Definition: pi.h:796
PI_FP_ROUND_TO_INF
static constexpr pi_device_fp_config PI_FP_ROUND_TO_INF
Definition: pi.h:821
sycl::_V1::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:59
pi_uint64
uint64_t pi_uint64
Definition: pi.h:195
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:85
sycl::_V1::info::device_type
device_type
Definition: info_desc.hpp:53
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:214
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:257
__simd_abi
Definition: simd.hpp:718
PI_DEVICE_TYPE_CUSTOM
@ PI_DEVICE_TYPE_CUSTOM
A PI device that is a custom device.
Definition: pi.h:261
sycl::_V1::info::execution_capability::exec_native_kernel
@ exec_native_kernel
pi_device_fp_config
pi_bitfield pi_device_fp_config
Definition: pi.h:816
sycl::_V1::info::partition_property::no_partition
@ no_partition
sycl::_V1::memory_scope
memory_scope
Definition: memory_enums.hpp:29
PI_FP_FMA
static constexpr pi_device_fp_config PI_FP_FMA
Definition: pi.h:822
PI_DEVICE_AFFINITY_DOMAIN_NUMA
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NUMA
Definition: pi.h:802
PI_FP_INF_NAN
static constexpr pi_device_fp_config PI_FP_INF_NAN
Definition: pi.h:818
PI_DEVICE_AFFINITY_DOMAIN_L1_CACHE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L1_CACHE
Definition: pi.h:810
sycl::_V1::ext::oneapi::experimental::graph_support_level::emulated
@ emulated
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:808
PI_DEVICE_PARTITION_BY_COUNTS
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_COUNTS
Definition: pi.h:791
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:256
sycl::_V1::platform
Encapsulates a SYCL platform on which kernels may be executed.
Definition: platform.hpp:63
sycl::_V1::memory_order
memory_order
Definition: memory_enums.hpp:19
pi_device_affinity_domain
pi_bitfield pi_device_affinity_domain
Definition: pi.h:801
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:788
PI_FP_ROUND_TO_ZERO
static constexpr pi_device_fp_config PI_FP_ROUND_TO_ZERO
Definition: pi.h:820
PI_EVENT_SUBMITTED
@ PI_EVENT_SUBMITTED
Definition: pi.h:216
pi_int32
int32_t pi_int32
Definition: pi.h:193
sycl::_V1::info::fp_config::soft_float
@ soft_float
sycl::_V1::info::global_mem_cache_type
global_mem_cache_type
Definition: info_desc.hpp:95
PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
Definition: pi.h:813
sycl::_V1::fma
std::enable_if_t< detail::is_svgenfloat_v< T >, T > fma(T a, T b, T c)
Definition: builtins_legacy_scalar.hpp:199
sycl::_V1::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:51