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>
22 
23 #include <sycl/range.hpp>
24 
25 namespace sycl {
26 inline namespace _V1 {
27 
28 class device;
29 class platform;
30 class kernel_id;
31 enum class memory_scope;
32 enum class memory_order;
33 
34 // TODO: stop using OpenCL directly, use PI.
35 namespace info {
36 #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
37  struct Desc { \
38  using return_type = ReturnT; \
39  };
40 // A.1 Platform information desctiptors
41 namespace platform {
42 // TODO Despite giving this deprecation warning, we're still yet to implement
43 // info::device::aspects.
44 struct __SYCL2020_DEPRECATED("deprecated in SYCL 2020, use device::get_info() "
45  "with info::device::aspects instead") extensions;
46 #include <sycl/info/platform_traits.def>
47 } // namespace platform
48 // A.2 Context information desctiptors
49 namespace context {
50 #include <sycl/info/context_traits.def>
51 } // namespace context
52 
53 // A.3 Device information descriptors
54 enum class device_type : pi_uint64 {
56  gpu = PI_DEVICE_TYPE_GPU,
58  // TODO: figure out if we need all the below in PI
60  automatic,
61  host,
63 };
64 
66  no_partition = 0,
71 };
72 
74  not_applicable = 0,
81 };
82 
83 enum class local_mem_type : int { none, local, global };
84 
88  round_to_nearest = PI_FP_ROUND_TO_NEAREST,
91  fma = PI_FP_FMA,
94 };
95 
96 enum class global_mem_cache_type : int { none, read_only, read_write };
97 
98 enum class execution_capability : unsigned int {
101 };
102 
103 namespace device {
104 // TODO implement the following SYCL 2020 device info descriptors:
105 // atomic_fence_order_capabilities, atomic_fence_scope_capabilities, aspects,
106 // il_version.
107 
108 struct atomic_fence_order_capabilities;
109 struct atomic_fence_scope_capabilities;
110 
111 #define __SYCL_PARAM_TRAITS_DEPRECATED(Desc, Message) \
112  struct __SYCL2020_DEPRECATED(Message) Desc;
113 #include <sycl/info/device_traits_deprecated.def>
114 #undef __SYCL_PARAM_TRAITS_DEPRECATED
115 
116 template <int Dimensions = 3> struct max_work_item_sizes;
117 #define __SYCL_PARAM_TRAITS_TEMPLATE_SPEC(DescType, Desc, ReturnT, PiCode) \
118  template <> struct Desc { \
119  using return_type = ReturnT; \
120  };
121 #define __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(DescType, Desc, ReturnT, PiCode) \
122  __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode)
123 
124 #include <sycl/info/device_traits.def>
125 } // namespace device
126 #undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED
127 #undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
128 
129 // A.4 Queue information descriptors
130 namespace queue {
131 #include <sycl/info/queue_traits.def>
132 } // namespace queue
133 
134 // A.5 Kernel information desctiptors
135 namespace kernel {
136 #include <sycl/info/kernel_traits.def>
137 } // namespace kernel
138 
139 namespace kernel_device_specific {
140 #include <sycl/info/kernel_device_specific_traits.def>
141 } // namespace kernel_device_specific
142 
143 // A.6 Event information desctiptors
148  // Since all BE values are positive, it is safe to use a negative value If you
149  // add other ext_oneapi values
150  ext_oneapi_unknown = -1
151 };
152 
153 namespace event {
154 #include <sycl/info/event_traits.def>
155 } // namespace event
156 namespace event_profiling {
157 #include <sycl/info/event_profiling_traits.def>
158 } // namespace event_profiling
159 #undef __SYCL_PARAM_TRAITS_SPEC
160 
161 // Provide an alias to the return type for each of the info parameters
162 template <typename T, T param> class param_traits {};
163 
164 template <typename T, T param> struct compatibility_param_traits {};
165 
166 #define __SYCL_PARAM_TRAITS_SPEC(param_type, param, ret_type) \
167  template <> class param_traits<param_type, param_type::param> { \
168  public: \
169  using return_type = ret_type; \
170  };
171 #undef __SYCL_PARAM_TRAITS_SPEC
172 } // namespace info
173 
174 #define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, PiCode) \
175  namespace Namespace { \
176  namespace info { \
177  namespace DescType { \
178  struct Desc { \
179  using return_type = ReturnT; \
180  }; \
181  } /*DescType*/ \
182  } /*info*/ \
183  } /*Namespace*/
184 
185 #define __SYCL_PARAM_TRAITS_TEMPLATE_SPEC(Namespace, DescType, Desc, ReturnT, \
186  PiCode) \
187  namespace Namespace { \
188  namespace info { \
189  namespace DescType { \
190  template <> struct Desc { \
191  using return_type = ReturnT; \
192  }; \
193  } /*namespace DescType */ \
194  } /*namespace info */ \
195  } /*namespace Namespace */
196 
197 namespace ext::oneapi::experimental::info::device {
198 template <int Dimensions> struct max_work_groups;
199 template <ext::oneapi::experimental::execution_scope CoordinationScope>
201 template <ext::oneapi::experimental::execution_scope CoordinationScope>
203 template <ext::oneapi::experimental::execution_scope CoordinationScope>
205 
206 } // namespace ext::oneapi::experimental::info::device
207 #include <sycl/info/ext_codeplay_device_traits.def>
208 #include <sycl/info/ext_intel_device_traits.def>
209 #include <sycl/info/ext_oneapi_device_traits.def>
210 #undef __SYCL_PARAM_TRAITS_SPEC
211 #undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
212 } // namespace _V1
213 } // namespace sycl
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:50
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:71
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:110
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:262
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
Definition: pi.h:972
static constexpr pi_device_partition_property PI_EXT_INTEL_DEVICE_PARTITION_BY_CSLICE
Definition: pi.h:957
static constexpr pi_device_fp_config PI_FP_DENORM
Definition: pi.h:976
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L2_CACHE
Definition: pi.h:967
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L3_CACHE
Definition: pi.h:965
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_COUNTS
Definition: pi.h:950
@ PI_DEVICE_TYPE_ACC
A PI device that is a dedicated accelerator.
Definition: pi.h:328
@ PI_DEVICE_TYPE_ALL
All devices available in the PI plugin.
Definition: pi.h:325
@ PI_DEVICE_TYPE_GPU
A PI device that is a GPU.
Definition: pi.h:327
@ PI_DEVICE_TYPE_CUSTOM
A PI device that is a custom device.
Definition: pi.h:330
@ PI_DEVICE_TYPE_CPU
A PI device that is the host processor.
Definition: pi.h:326
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_EQUALLY
Definition: pi.h:948
uint64_t pi_uint64
Definition: pi.h:264
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L4_CACHE
Definition: pi.h:963
static constexpr pi_device_fp_config PI_FP_ROUND_TO_NEAREST
Definition: pi.h:978
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN
Definition: pi.h:955
static constexpr pi_device_fp_config PI_FP_ROUND_TO_INF
Definition: pi.h:980
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L1_CACHE
Definition: pi.h:969
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NUMA
Definition: pi.h:961
pi_bitfield pi_device_fp_config
Definition: pi.h:975
@ PI_EVENT_SUBMITTED
Definition: pi.h:285
@ PI_EVENT_COMPLETE
Definition: pi.h:283
@ PI_EVENT_RUNNING
Definition: pi.h:284
static constexpr pi_device_fp_config PI_FP_ROUND_TO_ZERO
Definition: pi.h:979
static constexpr pi_device_fp_config PI_FP_FMA
Definition: pi.h:981
intptr_t pi_device_partition_property
Definition: pi.h:947
static constexpr pi_device_fp_config PI_FP_INF_NAN
Definition: pi.h:977
pi_bitfield pi_device_affinity_domain
Definition: pi.h:960