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/common.hpp>
12 #include <sycl/detail/pi.hpp>
13 #include <sycl/id.hpp>
14 
15 namespace sycl {
17 
18 class device;
19 class platform;
20 class kernel_id;
21 enum class memory_scope;
22 
23 // TODO: stop using OpenCL directly, use PI.
24 namespace info {
25 #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
26  struct Desc { \
27  using return_type = ReturnT; \
28  };
29 // A.1 Platform information desctiptors
30 namespace platform {
31 // TODO Despite giving this deprecation warning, we're still yet to implement
32 // info::device::aspects.
33 struct __SYCL2020_DEPRECATED("deprecated in SYCL 2020, use device::get_info() "
34  "with info::device::aspects instead") extensions;
35 #include <sycl/info/platform_traits.def>
36 } // namespace platform
37 // A.2 Context information desctiptors
38 namespace context {
39 #include <sycl/info/context_traits.def>
40 } // namespace context
41 
42 // A.3 Device information descriptors
43 enum class device_type : pi_uint64 {
45  gpu = PI_DEVICE_TYPE_GPU,
47  // TODO: figure out if we need all the below in PI
49  automatic,
50  host,
52 };
53 
55  no_partition = 0,
59 };
60 
62  not_applicable = 0,
69 };
70 
71 enum class local_mem_type : int { none, local, global };
72 
79  fma = PI_FP_FMA,
82 };
83 
84 enum class global_mem_cache_type : int { none, read_only, read_write };
85 
86 enum class execution_capability : unsigned int {
89 };
90 
91 namespace device {
92 // TODO implement the following SYCL 2020 device info descriptors:
93 // atomic_fence_order_capabilities, atomic_fence_scope_capabilities, aspects,
94 // il_version.
95 
96 #define __SYCL_PARAM_TRAITS_DEPRECATED(Desc, Message) \
97  struct __SYCL2020_DEPRECATED(Message) Desc;
98 #include <sycl/info/device_traits_deprecated.def>
99 #undef __SYCL_PARAM_TRAITS_DEPRECATED
100 
101 template <int Dimensions = 3> struct max_work_item_sizes;
102 #define __SYCL_PARAM_TRAITS_TEMPLATE_SPEC(DescType, Desc, ReturnT, PiCode) \
103  template <> struct Desc { \
104  using return_type = ReturnT; \
105  };
106 #define __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(DescType, Desc, ReturnT, PiCode) \
107  __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode)
108 
109 #include <sycl/info/device_traits.def>
110 } // namespace device
111 #undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED
112 #undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
113 
114 // A.4 Queue information descriptors
115 namespace queue {
116 #include <sycl/info/queue_traits.def>
117 } // namespace queue
118 
119 // A.5 Kernel information desctiptors
120 namespace kernel {
121 #include <sycl/info/kernel_traits.def>
122 } // namespace kernel
123 
124 namespace kernel_device_specific {
125 #include <sycl/info/kernel_device_specific_traits.def>
126 } // namespace kernel_device_specific
127 
128 // A.6 Event information desctiptors
133  // Since all BE values are positive, it is safe to use a negative value If you
134  // add other ext_oneapi values
135  ext_oneapi_unknown = -1
136 };
137 
138 namespace event {
139 #include <sycl/info/event_traits.def>
140 } // namespace event
141 namespace event_profiling {
142 #include <sycl/info/event_profiling_traits.def>
143 } // namespace event_profiling
144 #undef __SYCL_PARAM_TRAITS_SPEC
145 
146 // Provide an alias to the return type for each of the info parameters
147 template <typename T, T param> class param_traits {};
148 
149 template <typename T, T param> struct compatibility_param_traits {};
150 
151 #define __SYCL_PARAM_TRAITS_SPEC(param_type, param, ret_type) \
152  template <> class param_traits<param_type, param_type::param> { \
153  public: \
154  using return_type = ret_type; \
155  };
156 #undef __SYCL_PARAM_TRAITS_SPEC
157 } // namespace info
158 
159 #define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, PiCode) \
160  namespace Namespace { \
161  namespace info { \
162  namespace DescType { \
163  struct Desc { \
164  using return_type = ReturnT; \
165  }; \
166  } /*DescType*/ \
167  } /*info*/ \
168  } /*Namespace*/
169 
170 #define __SYCL_PARAM_TRAITS_TEMPLATE_SPEC(Namespace, DescType, Desc, ReturnT, \
171  PiCode) \
172  namespace Namespace { \
173  namespace info { \
174  namespace DescType { \
175  template <> struct Desc { \
176  using return_type = ReturnT; \
177  }; \
178  } /*namespace DescType */ \
179  } /*namespace info */ \
180  } /*namespace Namespace */
181 
182 namespace ext {
183 namespace oneapi {
184 namespace experimental {
185 namespace info {
186 namespace device {
187 template <int Dimensions> struct max_work_groups;
188 } // namespace device
189 } // namespace info
190 } // namespace experimental
191 } // namespace oneapi
192 } // namespace ext
193 #include <sycl/info/ext_intel_device_traits.def>
194 #include <sycl/info/ext_oneapi_device_traits.def>
195 #undef __SYCL_PARAM_TRAITS_SPEC
196 #undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
197 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
198 } // namespace sycl
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:39
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:47
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Definition: event.hpp:38
Objects of the class identify kernel is some kernel_bundle related APIs.
Provides an abstraction of a SYCL kernel.
Definition: kernel.hpp:69
Encapsulates a SYCL platform on which kernels may be executed.
Definition: platform.hpp:45
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition: queue.hpp:86
#define __SYCL_INLINE_VER_NAMESPACE(X)
#define __SYCL2020_DEPRECATED(message)
detail::enable_if_t< detail::is_genfloat< T >::value, T > fma(T a, T b, T c) __NOEXC
Definition: builtins.hpp:196
detail::enable_if_t< detail::is_sigeninteger< T >::value, detail::anyall_ret_t > all(T x) __NOEXC
Definition: builtins.hpp:1243
std::uint8_t instead
Definition: aliases.hpp:69
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
int32_t pi_int32
Definition: pi.h:102
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
Definition: pi.h:638
static constexpr pi_device_fp_config PI_FP_DENORM
Definition: pi.h:642
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L2_CACHE
Definition: pi.h:633
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L3_CACHE
Definition: pi.h:631
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_COUNTS
Definition: pi.h:618
@ PI_DEVICE_TYPE_ACC
A PI device that is a dedicated accelerator.
Definition: pi.h:167
@ PI_DEVICE_TYPE_ALL
All devices available in the PI plugin.
Definition: pi.h:164
@ PI_DEVICE_TYPE_GPU
A PI device that is a GPU.
Definition: pi.h:166
@ PI_DEVICE_TYPE_CUSTOM
A PI device that is a custom device.
Definition: pi.h:169
@ PI_DEVICE_TYPE_CPU
A PI device that is the host processor.
Definition: pi.h:165
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_EQUALLY
Definition: pi.h:616
uint64_t pi_uint64
Definition: pi.h:104
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L4_CACHE
Definition: pi.h:629
static constexpr pi_device_fp_config PI_FP_ROUND_TO_NEAREST
Definition: pi.h:644
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN
Definition: pi.h:623
static constexpr pi_device_fp_config PI_FP_ROUND_TO_INF
Definition: pi.h:646
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_L1_CACHE
Definition: pi.h:635
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NUMA
Definition: pi.h:627
pi_bitfield pi_device_fp_config
Definition: pi.h:641
@ PI_EVENT_SUBMITTED
Definition: pi.h:125
@ PI_EVENT_COMPLETE
Definition: pi.h:123
@ PI_EVENT_RUNNING
Definition: pi.h:124
static constexpr pi_device_fp_config PI_FP_ROUND_TO_ZERO
Definition: pi.h:645
static constexpr pi_device_fp_config PI_FP_FMA
Definition: pi.h:647
intptr_t pi_device_partition_property
Definition: pi.h:615
static constexpr pi_device_fp_config PI_FP_INF_NAN
Definition: pi.h:643
pi_bitfield pi_device_affinity_domain
Definition: pi.h:626
C++ wrapper of extern "C" PI interfaces.