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::info::device {
197 template <int Dimensions> struct max_work_groups;
198 } // namespace ext::oneapi::experimental::info::device
199 #include <sycl/info/ext_codeplay_device_traits.def>
200 #include <sycl/info/ext_intel_device_traits.def>
201 #include <sycl/info/ext_oneapi_device_traits.def>
202 #undef __SYCL_PARAM_TRAITS_SPEC
203 #undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
204 } // namespace _V1
205 } // namespace sycl
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:51
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:64
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Definition: event.hpp:44
Objects of the class identify kernel is some kernel_bundle related APIs.
Provides an abstraction of a SYCL kernel.
Definition: kernel.hpp:77
Encapsulates a SYCL platform on which kernels may be executed.
Definition: platform.hpp:99
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition: queue.hpp:111
constexpr mode_tag_t< access_mode::read > read_only
Definition: access.hpp:84
signed char __SYCL2020_DEPRECATED
Definition: aliases.hpp:94
constexpr mode_tag_t< access_mode::read_write > read_write
Definition: access.hpp:85
std::uint8_t instead
Definition: aliases.hpp:93
Definition: access.hpp:18
int32_t pi_int32
Definition: pi.h:212
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
Definition: pi.h:878
static constexpr pi_device_partition_property PI_EXT_INTEL_DEVICE_PARTITION_BY_CSLICE
Definition: pi.h:863
static constexpr pi_device_fp_config PI_FP_DENORM
Definition: pi.h:882
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L2_CACHE
Definition: pi.h:873
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L3_CACHE
Definition: pi.h:871
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_COUNTS
Definition: pi.h:856
@ PI_DEVICE_TYPE_ACC
A PI device that is a dedicated accelerator.
Definition: pi.h:278
@ PI_DEVICE_TYPE_ALL
All devices available in the PI plugin.
Definition: pi.h:275
@ PI_DEVICE_TYPE_GPU
A PI device that is a GPU.
Definition: pi.h:277
@ PI_DEVICE_TYPE_CUSTOM
A PI device that is a custom device.
Definition: pi.h:280
@ PI_DEVICE_TYPE_CPU
A PI device that is the host processor.
Definition: pi.h:276
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_EQUALLY
Definition: pi.h:854
uint64_t pi_uint64
Definition: pi.h:214
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L4_CACHE
Definition: pi.h:869
static constexpr pi_device_fp_config PI_FP_ROUND_TO_NEAREST
Definition: pi.h:884
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN
Definition: pi.h:861
static constexpr pi_device_fp_config PI_FP_ROUND_TO_INF
Definition: pi.h:886
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L1_CACHE
Definition: pi.h:875
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NUMA
Definition: pi.h:867
pi_bitfield pi_device_fp_config
Definition: pi.h:881
@ PI_EVENT_SUBMITTED
Definition: pi.h:235
@ PI_EVENT_COMPLETE
Definition: pi.h:233
@ PI_EVENT_RUNNING
Definition: pi.h:234
static constexpr pi_device_fp_config PI_FP_ROUND_TO_ZERO
Definition: pi.h:885
static constexpr pi_device_fp_config PI_FP_FMA
Definition: pi.h:887
intptr_t pi_device_partition_property
Definition: pi.h:853
static constexpr pi_device_fp_config PI_FP_INF_NAN
Definition: pi.h:883
pi_bitfield pi_device_affinity_domain
Definition: pi.h:866