DPC++ Runtime
Runtime libraries for oneAPI DPC++
fpga_annotated_properties.hpp
Go to the documentation of this file.
1 //==-- fpga_annotated_properties.hpp - SYCL properties associated with
2 // annotated_arg/ptr --==//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #pragma once
11 
16 
17 #include <cstdint>
18 #include <iosfwd>
19 #include <tuple>
20 #include <type_traits>
21 
22 namespace sycl {
23 inline namespace _V1 {
24 namespace ext {
25 namespace intel {
26 namespace experimental {
27 
28 template <typename PropertyT, typename... Ts>
29 using property_value =
31 //===----------------------------------------------------------------------===//
32 // FPGA properties of annotated_arg/annotated_ptr
33 //===----------------------------------------------------------------------===//
36  oneapi::experimental::detail::PropKind::RegisterMap> {
38 };
39 
41  oneapi::experimental::detail::PropKind::Conduit> {
43 };
44 
46  oneapi::experimental::detail::PropKind::Stable> {
48 };
49 
52  oneapi::experimental::detail::PropKind::BufferLocation> {
53  template <int K>
54  using value_t =
56 };
57 
59  oneapi::experimental::detail::PropKind::AddrWidth> {
60  template <int K>
62 };
63 
65  oneapi::experimental::detail::PropKind::DataWidth> {
66  template <int K>
68 };
69 
71  oneapi::experimental::detail::PropKind::Latency> {
72  template <int K>
74 };
75 
76 enum class read_write_mode_enum : std::uint16_t { read, write, read_write };
77 
80  oneapi::experimental::detail::PropKind::RWMode> {
81  template <read_write_mode_enum Mode>
82  using value_t =
84  std::integral_constant<read_write_mode_enum, Mode>>;
85 };
86 
88  oneapi::experimental::detail::PropKind::MaxBurst> {
89  template <int K>
91 };
92 
95  oneapi::experimental::detail::PropKind::WaitRequest> {
96  template <int K>
97  using value_t =
99 };
100 
101 // non-mmhost properties
103 inline constexpr conduit_key::value_t conduit;
104 inline constexpr stable_key::value_t stable;
105 
106 // mmhost properties
107 template <int N>
109 template <int W> inline constexpr awidth_key::value_t<W> awidth;
110 template <int W> inline constexpr dwidth_key::value_t<W> dwidth;
111 template <int N> inline constexpr latency_key::value_t<N> latency;
112 template <int N> inline constexpr maxburst_key::value_t<N> maxburst;
113 template <int Enable>
117 
118 template <read_write_mode_enum Mode>
126 
127 } // namespace experimental
128 } // namespace intel
129 
130 namespace oneapi {
131 namespace experimental {
132 template <typename T, typename PropertyListT> class annotated_arg;
133 template <typename T, typename PropertyListT> class annotated_ptr;
134 
135 struct alignment_key;
147 
148 template <typename T, typename PropertyListT>
150  : std::true_type {};
151 
152 template <typename T, typename PropertyListT>
153 struct is_property_key_of<conduit_key, annotated_arg<T, PropertyListT>>
154  : std::true_type {};
155 
156 template <typename T, typename PropertyListT>
157 struct is_property_key_of<stable_key, annotated_arg<T, PropertyListT>>
158  : std::true_type {};
159 
160 template <typename T, typename PropertyListT>
162  : std::true_type {};
163 
164 template <typename T, typename PropertyListT>
165 struct is_property_key_of<awidth_key, annotated_arg<T, PropertyListT>>
166  : std::true_type {};
167 
168 template <typename T, typename PropertyListT>
169 struct is_property_key_of<dwidth_key, annotated_arg<T, PropertyListT>>
170  : std::true_type {};
171 
172 template <typename T, typename PropertyListT>
173 struct is_property_key_of<latency_key, annotated_arg<T, PropertyListT>>
174  : std::true_type {};
175 
176 template <typename T, typename PropertyListT>
178  : std::true_type {};
179 
180 template <typename T, typename PropertyListT>
182  : std::true_type {};
183 
184 template <typename T, typename PropertyListT>
186  : std::true_type {};
187 
188 template <typename T, typename PropertyListT>
190  : std::true_type {};
191 
192 template <typename T, typename PropertyListT>
193 struct is_property_key_of<conduit_key, annotated_ptr<T, PropertyListT>>
194  : std::true_type {};
195 
196 template <typename T, typename PropertyListT>
197 struct is_property_key_of<stable_key, annotated_ptr<T, PropertyListT>>
198  : std::true_type {};
199 
200 template <typename T, typename PropertyListT>
202  : std::true_type {};
203 
204 template <typename T, typename PropertyListT>
205 struct is_property_key_of<awidth_key, annotated_ptr<T, PropertyListT>>
206  : std::true_type {};
207 
208 template <typename T, typename PropertyListT>
209 struct is_property_key_of<dwidth_key, annotated_ptr<T, PropertyListT>>
210  : std::true_type {};
211 
212 template <typename T, typename PropertyListT>
213 struct is_property_key_of<latency_key, annotated_ptr<T, PropertyListT>>
214  : std::true_type {};
215 
216 template <typename T, typename PropertyListT>
218  : std::true_type {};
219 
220 template <typename T, typename PropertyListT>
222  : std::true_type {};
223 
224 template <typename T, typename PropertyListT>
226  : std::true_type {};
227 
228 namespace detail {
229 template <> struct PropertyMetaInfo<register_map_key::value_t> {
230  static constexpr const char *name = "sycl-register-map";
231  static constexpr std::nullptr_t value = nullptr;
232 };
233 template <> struct PropertyMetaInfo<conduit_key::value_t> {
234  static constexpr const char *name = "sycl-conduit";
235  static constexpr std::nullptr_t value = nullptr;
236 };
237 template <> struct PropertyMetaInfo<stable_key::value_t> {
238  static constexpr const char *name = "sycl-stable";
239  static constexpr std::nullptr_t value = nullptr;
240 };
241 
242 template <int N> struct PropertyMetaInfo<buffer_location_key::value_t<N>> {
243  static constexpr const char *name = "sycl-buffer-location";
244  static constexpr int value = N;
245 };
246 template <int W> struct PropertyMetaInfo<awidth_key::value_t<W>> {
247  static constexpr const char *name = "sycl-awidth";
248  static constexpr int value = W;
249 };
250 template <int W> struct PropertyMetaInfo<dwidth_key::value_t<W>> {
251  static constexpr const char *name = "sycl-dwidth";
252  static constexpr int value = W;
253 };
254 template <int N> struct PropertyMetaInfo<latency_key::value_t<N>> {
255  static constexpr const char *name = "sycl-latency";
256  static constexpr int value = N;
257 };
258 template <int N> struct PropertyMetaInfo<maxburst_key::value_t<N>> {
259  static constexpr const char *name = "sycl-maxburst";
260  static constexpr int value = N;
261 };
262 template <int Enable>
263 struct PropertyMetaInfo<wait_request_key::value_t<Enable>> {
264  static constexpr const char *name = "sycl-wait-request";
265  static constexpr int value = Enable;
266 };
267 template <read_write_mode_enum Mode>
268 struct PropertyMetaInfo<read_write_mode_key::value_t<Mode>> {
269  static constexpr const char *name = "sycl-read-write-mode";
270  static constexpr read_write_mode_enum value = Mode;
271 };
272 
273 } // namespace detail
274 
275 // 'buffer_location' and mmhost properties are pointers-only
276 template <typename T, int N>
278  : std::bool_constant<std::is_pointer_v<T>> {};
279 
280 template <typename T, int W>
281 struct is_valid_property<T, awidth_key::value_t<W>>
282  : std::bool_constant<std::is_pointer_v<T>> {};
283 
284 template <typename T, int W>
285 struct is_valid_property<T, dwidth_key::value_t<W>>
286  : std::bool_constant<std::is_pointer_v<T>> {};
287 
288 template <typename T, int N>
289 struct is_valid_property<T, latency_key::value_t<N>>
290  : std::bool_constant<std::is_pointer_v<T>> {};
291 
292 template <typename T, read_write_mode_enum Mode>
293 struct is_valid_property<T, read_write_mode_key::value_t<Mode>>
294  : std::bool_constant<std::is_pointer_v<T>> {};
295 
296 template <typename T, int N>
297 struct is_valid_property<T, maxburst_key::value_t<N>>
298  : std::bool_constant<std::is_pointer_v<T>> {};
299 
300 template <typename T, int Enable>
301 struct is_valid_property<T, wait_request_key::value_t<Enable>>
302  : std::bool_constant<std::is_pointer_v<T>> {};
303 
304 // 'register_map', 'conduit', 'stable' are common properties for pointers
305 // and non pointers;
306 template <typename T>
307 struct is_valid_property<T, register_map_key::value_t> : std::true_type {};
308 template <typename T>
309 struct is_valid_property<T, conduit_key::value_t> : std::true_type {};
310 template <typename T>
311 struct is_valid_property<T, stable_key::value_t> : std::true_type {};
312 
313 // buffer_location is applied on PtrAnnotation
314 template <>
315 struct propagateToPtrAnnotation<buffer_location_key> : std::true_type {};
316 
317 //===----------------------------------------------------------------------===//
318 // Utility for FPGA properties
319 //===----------------------------------------------------------------------===//
320 //
321 namespace detail {
322 template <typename... Args> struct checkValidFPGAPropertySet {
323  using list = std::tuple<Args...>;
324  static constexpr bool has_BufferLocation =
326 
327  static constexpr bool has_InterfaceConfig =
334 
335  static constexpr bool value = !(!has_BufferLocation && has_InterfaceConfig);
336 };
337 
338 template <typename... Args> struct checkHasConduitAndRegisterMap {
339  using list = std::tuple<Args...>;
340  static constexpr bool has_Conduit =
342  static constexpr bool has_RegisterMap =
344  static constexpr bool value = !(has_Conduit && has_RegisterMap);
345 };
346 } // namespace detail
347 
348 } // namespace experimental
349 } // namespace oneapi
350 } // namespace ext
351 } // namespace _V1
352 } // namespace sycl
sycl::ext::oneapi::experimental::alignment_key alignment_key
The 'alignment' property is used to specify the alignment of memory accessed in ESIMD memory operatio...
constexpr awidth_key::value_t< W > awidth
constexpr buffer_location_key::value_t< N > buffer_location
constexpr read_write_mode_key::value_t< read_write_mode_enum::write > read_write_mode_write
constexpr latency_key::value_t< N > latency
sycl::ext::oneapi::experimental::property_value< PropertyT, Ts... > property_value
constexpr read_write_mode_key::value_t< read_write_mode_enum::read > read_write_mode_read
constexpr wait_request_key::value_t< Enable > wait_request
constexpr wait_request_key::value_t< 0 > wait_request_not_requested
constexpr wait_request_key::value_t< 1 > wait_request_requested
constexpr read_write_mode_key::value_t< read_write_mode_enum::read_write > read_write_mode_readwrite
constexpr maxburst_key::value_t< N > maxburst
constexpr read_write_mode_key::value_t< Mode > read_write_mode
constexpr dwidth_key::value_t< W > dwidth
constexpr register_map_key::value_t register_map
intel::experimental::maxburst_key maxburst_key
intel::experimental::latency_key latency_key
intel::experimental::read_write_mode_key read_write_mode_key
intel::experimental::awidth_key awidth_key
intel::experimental::dwidth_key dwidth_key
intel::experimental::register_map_key register_map_key
intel::experimental::conduit_key conduit_key
intel::experimental::buffer_location_key buffer_location_key
intel::experimental::wait_request_key wait_request_key
intel::experimental::stable_key stable_key
Definition: access.hpp:18