18 #include <type_traits>
25 template <
typename T,
typename PropertyList>
30 inline namespace _V1 {
33 namespace experimental {
41 !std::is_void_v<decltype(std::declval<T>().operator[](0))>> {};
46 template <
typename T,
typename... Args>
50 template <
typename T,
typename old,
typename... ArgT>
55 template <
typename T,
typename PropertyListT = empty_properties_t>
58 static constexpr
bool is_valid_property_list =
60 static_assert(is_valid_property_list,
"Property list is invalid.");
64 template <
typename T,
typename... Props>
71 template <
typename T2,
typename PropertyListT>
friend class annotated_arg;
73 #ifdef __SYCL_DEVICE_ONLY__
74 void __init([[__sycl_detail__::add_ir_attributes_kernel_parameter(
97 template <
typename... PropertyValueTs>
99 static constexpr
bool has_same_properties = std::is_same<
105 "The property list must contain all properties of the input of the "
113 template <
typename T2,
typename PropertyList2>
116 static constexpr
bool is_input_convertible =
117 std::is_convertible<T2, T *>::value;
118 static_assert(is_input_convertible,
119 "The underlying data type of the input annotated_arg is not "
122 static constexpr
bool has_same_properties = std::is_same<
127 "The constructed annotated_arg type must contain all the properties "
128 "of the input annotated_arg");
135 template <
typename T2,
typename PropertyListU,
typename PropertyListV>
137 const PropertyListV &proplist)
noexcept
140 static constexpr
bool is_input_convertible =
141 std::is_convertible<T2, T *>::value;
142 static_assert(is_input_convertible,
143 "The underlying data type of the input annotated_arg is not "
146 static constexpr
bool has_same_properties = std::is_same<
151 "The property list of constructed annotated_arg type must be the union "
152 "of the input property lists");
163 return property_list_t::template has_property<PropertyT>();
167 return property_list_t::template get_property<PropertyT>();
184 "The property list contains invalid property.");
189 "FPGA Interface properties (i.e. awidth, dwidth, etc.) "
190 "can only be set with BufferLocation together.");
195 "The properties conduit and register_map cannot be "
196 "specified at the same time.");
200 template <
typename T,
typename... Props>
205 template <
typename T2,
typename PropertyListT>
friend class annotated_arg;
209 #ifdef __SYCL_DEVICE_ONLY__
210 void __init([[__sycl_detail__::add_ir_attributes_kernel_parameter(
232 template <
typename... PropertyValueTs>
234 static constexpr
bool has_same_properties = std::is_same<
240 "The property list must contain all properties of the input of the "
248 template <
typename T2,
typename PropertyList2>
251 static constexpr
bool is_input_convertible =
252 std::is_convertible<T2, T>::value;
253 static_assert(is_input_convertible,
254 "The underlying data type of the input annotated_arg is not "
257 static constexpr
bool has_same_properties = std::is_same<
259 detail::merged_properties_t<property_list_t, PropertyList2>>::value;
262 "The constructed annotated_arg type must contain all the properties "
263 "of the input annotated_arg");
270 template <
typename T2,
typename PropertyListU,
typename PropertyListV>
271 explicit annotated_arg(
const annotated_arg<T2, PropertyListU> &other,
272 const PropertyListV &proplist)
noexcept
275 static constexpr
bool is_input_convertible =
276 std::is_convertible<T2, T>::value;
277 static_assert(is_input_convertible,
278 "The underlying data type of the input annotated_arg is not "
281 static constexpr
bool has_same_properties = std::is_same<
283 detail::merged_properties_t<PropertyListU, PropertyListV>>::value;
286 "The property list of constructed annotated_arg type must be the union "
287 "of the input property lists");
293 template <
class RelayT = T>
294 std::enable_if_t<detail::HasSubscriptOperator<RelayT>::value,
295 decltype(std::declval<RelayT>().
operator[](0))> &
297 return obj.operator[](idx);
300 template <
typename PropertyT>
static constexpr
bool has_property() {
301 return property_list_t::template has_property<PropertyT>();
304 template <
typename PropertyT>
static constexpr
auto get_property() {
305 return property_list_t::template get_property<PropertyT>();
308 template <
typename T2,
typename PropertyList2,
309 typename R = decltype(std::declval<T>() + std::declval<T2>())>
311 return obj + other.obj;
314 template <
typename T2,
typename PropertyList2,
315 typename R = decltype(std::declval<T>() - std::declval<T2>())>
317 return obj - other.obj;
320 template <
typename T2,
typename PropertyList2,
321 typename R = decltype(std::declval<T>() * std::declval<T2>())>
323 return obj * other.obj;
326 template <
typename T2,
typename PropertyList2,
327 typename R = decltype(std::declval<T>() / std::declval<T2>())>
329 return obj / other.obj;
332 template <
typename T2,
typename PropertyList2,
333 typename R = decltype(std::declval<T>() % std::declval<T2>())>
335 return obj % other.obj;
338 template <
typename T2,
typename PropertyList2,
339 typename R = decltype(std::declval<T>() & std::declval<T2>())>
341 return obj & other.obj;
344 template <
typename T2,
typename PropertyList2,
345 typename R = decltype(std::declval<T>() | std::declval<T2>())>
347 return obj | other.obj;
350 template <
typename T2,
typename PropertyList2,
351 typename R = decltype(std::declval<T>() ^ std::declval<T2>())>
353 return obj ^ other.obj;
356 template <
typename T2,
typename PropertyList2,
357 typename R = decltype(std::declval<T>() >> std::declval<T2>())>
359 return obj >> other.obj;
362 template <
typename T2,
typename PropertyList2,
363 typename R = decltype(std::declval<T>() << std::declval<T2>())>
365 return obj << other.obj;
381 has_property<buffer_location_key>();
383 "Property buffer_location cannot be specified for "
384 "annotated_arg<T> when T is a non pointer type.");
386 static constexpr
bool has_awidth = has_property<awidth_key>();
387 static_assert(!
has_awidth,
"Property awidth cannot be specified for "
388 "annotated_arg<T> when T is a non pointer type.");
390 static constexpr
bool has_dwidth = has_property<dwidth_key>();
391 static_assert(!
has_dwidth,
"Property dwidth cannot be specified for "
392 "annotated_arg<T> when T is a non pointer type.");
395 static_assert(!
has_latency,
"Property latency cannot be specified for "
396 "annotated_arg<T> when T is a non pointer type.");
399 has_property<read_write_mode_key>();
401 "Property read_write_mode cannot be specified for "
402 "annotated_arg<T> when T is a non pointer type.");
406 "Property maxburst cannot be specified for "
407 "annotated_arg<T> when T is a non pointer type.");
411 "Property wait_request cannot be specified for "
412 "annotated_arg<T> when T is a non pointer type.");
416 "Property alignment cannot be specified for "
417 "annotated_arg<T> when T is a non pointer type.");
421 "Property usm_kind cannot be specified for "
422 "annotated_arg<T> when T is a non pointer type.");
430 "The property list contains invalid property.");
435 "FPGA Interface properties (i.e. awidth, dwidth, etc.) "
436 "can only be set with BufferLocation together.");
441 "The properties conduit and register_map cannot be "
442 "specified at the same time.");
445 template <
typename T,
typename PropertyList,
typename T2,
446 typename R = decltype(std::declval<T>() + std::declval<T2>())>
452 template <
typename T,
typename PropertyList,
typename T2,
453 typename R = decltype(std::declval<T>() - std::declval<T2>())>
459 template <
typename T,
typename PropertyList,
typename T2,
460 typename R = decltype(std::declval<T>() * std::declval<T2>())>
466 template <
typename T,
typename PropertyList,
typename T2,
467 typename R = decltype(std::declval<T>() / std::declval<T2>())>
473 template <
typename T,
typename PropertyList,
typename T2,
474 typename R = decltype(std::declval<T>() % std::declval<T2>())>
480 template <
typename T,
typename PropertyList,
typename T2,
481 typename R = decltype(std::declval<T>() & std::declval<T2>())>
487 template <
typename T,
typename PropertyList,
typename T2,
488 typename R = decltype(std::declval<T>() | std::declval<T2>())>
494 template <
typename T,
typename PropertyList,
typename T2,
495 typename R = decltype(std::declval<T>() ^ std::declval<T2>())>
501 template <
typename T,
typename PropertyList,
typename T2,
502 typename R = decltype(std::declval<T>() >> std::declval<T2>())>
508 template <
typename T,
typename PropertyList,
typename T2,
509 typename R = decltype(std::declval<T>() << std::declval<T2>())>
515 template <
typename T,
typename T2,
typename PropertyList2,
516 typename R = decltype(std::declval<T>() + std::declval<T2>())>
522 template <
typename T,
typename T2,
typename PropertyList2,
523 typename R = decltype(std::declval<T>() - std::declval<T2>())>
529 template <
typename T,
typename T2,
typename PropertyList2,
530 typename R = decltype(std::declval<T>() * std::declval<T2>())>
536 template <
typename T,
typename T2,
typename PropertyList2,
537 typename R = decltype(std::declval<T>() / std::declval<T2>())>
543 template <
typename T,
typename T2,
typename PropertyList2,
544 typename R = decltype(std::declval<T>() % std::declval<T2>())>
550 template <
typename T,
typename T2,
typename PropertyList2,
551 typename R = decltype(std::declval<T>() & std::declval<T2>())>
557 template <
typename T,
typename T2,
typename PropertyList2,
558 typename R = decltype(std::declval<T>() | std::declval<T2>())>
564 template <
typename T,
typename T2,
typename PropertyList2,
565 typename R = decltype(std::declval<T>() ^ std::declval<T2>())>
571 template <
typename T,
typename T2,
typename PropertyList2,
572 typename R = decltype(std::declval<T>() >> std::declval<T2>())>
578 template <
typename T,
typename T2,
typename PropertyList2,
579 typename R = decltype(std::declval<T>() << std::declval<T2>())>