23 #include <string_view>
25 #include <type_traits>
30 inline namespace _V1 {
33 namespace experimental {
35 template <
typename T,
typename PropertyListT = empty_properties_t>
38 static constexpr
bool is_valid_property_list =
45 template <
class T,
class P>
47 template <
class T,
class P>
53 template <
typename... Ts>
60 sycl::detail::boost::mp11::mp_copy_if<property_list, filter>;
63 template <
typename... Props>
71 template <
typename I,
typename... P>
74 return __builtin_intel_sycl_ptr_annotation(
80 return *__builtin_intel_sycl_ptr_annotation(
85 template <
class O>
static I
store(I *ptr, O &&Obj) {
86 return *__builtin_intel_sycl_ptr_annotation(
92 template <
typename T,
typename... Props>
97 std::is_trivially_copyable_v<T>,
98 "annotated_ref can only encapsulate a trivially-copyable type!");
109 #ifdef __SYCL_DEVICE_ONLY__
118 template <
class O,
typename = std::enable_if_t<!detail::is_ann_ref_v<O>>>
120 #ifdef __SYCL_DEVICE_ONLY__
124 return *
m_Ptr = std::forward<O>(Obj);
128 template <
class O,
class P>
130 O t2 = Ref.operator O();
135 #define PROPAGATE_OP(op) \
136 template <class O, typename = std::enable_if_t<!detail::is_ann_ref_v<O>>> \
137 T operator op(O &&rhs) const { \
138 T t = this->operator T(); \
139 t op std::forward<O>(rhs); \
143 template <class O, class P> \
144 T operator op(const annotated_ref<O, P> &rhs) const { \
145 T t = this->operator T(); \
146 O t2 = rhs.operator T(); \
164 #define PROPAGATE_OP(op) \
166 friend auto operator op(O &&a, const annotated_ref &b) \
167 ->decltype(std::forward<O>(a) op std::declval<T>()) { \
168 return std::forward<O>(a) op b.operator T(); \
170 template <class O, typename = std::enable_if_t<!detail::is_ann_ref_v<O>>> \
171 friend auto operator op(const annotated_ref &a, O &&b) \
172 ->decltype(std::declval<T>() op std::forward<O>(b)) { \
173 return a.operator T() op std::forward<O>(b); \
197 #define PROPAGATE_OP(op) \
198 template <typename O = T> \
199 auto operator op() const->decltype(op std::declval<O>()) { \
200 return op this->operator O(); \
210 T
t = this->
operator T();
217 T t1 = this->
operator T();
225 T
t = this->
operator T();
232 T t1 = this->
operator T();
242 #ifdef __cpp_deduction_guides
243 template <
typename T,
typename... Args>
247 template <
typename T,
typename old,
typename... ArgT>
253 template <
typename T,
typename PropertyListT = empty_properties_t>
256 static constexpr
bool is_valid_property_list =
261 template <
typename T,
typename... Props>
265 static_assert(std::is_same_v<T, void> || std::is_trivially_copyable_v<T>,
266 "annotated_ptr can only encapsulate either "
267 "a trivially-copyable type "
276 #ifdef __ENABLE_USM_ADDR_SPACE__
292 #ifdef __SYCL_DEVICE_ONLY__
293 void __init([[__sycl_detail__::add_ir_attributes_kernel_parameter(
313 template <
typename... PropertyValueTs>
317 static constexpr
bool has_same_properties = std::is_same<
323 "The property list must contain all properties of the input of the "
331 template <
typename T2,
typename PropertyList2>
333 :
m_Ptr(other.m_Ptr) {
334 static constexpr
bool is_input_convertible =
335 std::is_convertible<T2 *, T *>::value;
337 is_input_convertible,
338 "The underlying pointer type of the input annotated_ptr is not "
339 "convertible to the target pointer type");
341 static constexpr
bool has_same_properties = std::is_same<
346 "The constructed annotated_ptr type must contain all the properties "
347 "of the input annotated_ptr");
354 template <
typename T2,
typename PropertyListU,
typename PropertyListV>
357 :
m_Ptr(other.m_Ptr) {
358 static constexpr
bool is_input_convertible =
359 std::is_convertible<T2 *, T *>::value;
361 is_input_convertible,
362 "The underlying pointer type of the input annotated_ptr is not "
363 "convertible to the target pointer type");
365 static constexpr
bool has_same_properties = std::is_same<
370 "The property list of constructed annotated_ptr type must be the "
371 "union of the input property lists");
377 return m_Ptr - other.m_Ptr;
382 operator T *()
const noexcept =
delete;
385 #ifdef __SYCL_DEVICE_ONLY__
400 class = std::enable_if_t<!has_alignment>>
406 class = std::enable_if_t<has_alignment>>
407 auto operator[](std::ptrdiff_t idx)
const noexcept -> decltype(
"operator[] is not available when alignment is specified!") =
delete;
410 class = std::enable_if_t<!has_alignment>>
416 class = std::enable_if_t<has_alignment>>
417 auto operator+(
size_t offset)
const noexcept -> decltype(
"operator+ is not available when alignment is specified!") =
delete;
420 class = std::enable_if_t<!has_alignment>>
427 class = std::enable_if_t<has_alignment>>
439 class = std::enable_if_t<has_alignment>>
440 auto operator++(
int)
noexcept -> decltype(
"operator++ is not available when alignment is specified!") =
delete;
443 class = std::enable_if_t<!has_alignment>>
450 class = std::enable_if_t<has_alignment>>
462 class = std::enable_if_t<has_alignment>>
463 auto operator--(
int)
noexcept -> decltype(
"operator-- is not available when alignment is specified!") =
delete;
468 return property_list_t::template has_property<PropertyT>();
472 return property_list_t::template get_property<PropertyT>();
489 "The property list contains invalid property.");
494 "FPGA Interface properties (i.e. awidth, dwidth, etc.) "
495 "can only be set with BufferLocation together.");
500 "The properties conduit and register_map cannot be "
501 "specified at the same time.");
annotated_ref(const annotated_ref &)=delete
T operator=(const annotated_ref< O, P > &Ref) const
T operator=(O &&Obj) const
Objects of the property_list class are containers for the SYCL properties.
#define __SYCL_SPECIAL_CLASS
sycl::ext::oneapi::experimental::alignment_key alignment_key
The 'alignment' property is used to specify the alignment of memory accessed in ESIMD memory operatio...
sycl::detail::ods_target filter
constexpr bool is_ann_ref_v
sycl::detail::boost::mp11::mp_copy_if< property_list, filter > PropertiesFilter
typename merged_properties< LHSPropertiesT, RHSPropertiesT >::type merged_properties_t
properties< std::tuple< PropertyValueTs... > > properties_t
detail::ContainsProperty< alignment_key, std::tuple< Ts... > > contains_alignment
static constexpr bool has_alignment
constexpr alignment_key::value_t< K > alignment
annotated_ptr & operator++() noexcept
static constexpr bool has_property()
sycl::ext::oneapi::experimental::annotated_ref< T, property_list_t > reference
friend class annotated_ptr
static constexpr bool hasValidFPGAProperties
std::ptrdiff_t operator-(annotated_ptr other) const noexcept
class __SYCL_SPECIAL_CLASS __SYCL_TYPE(annotated_arg) annotated_arg< T *
reference operator*() const noexcept
static constexpr bool is_valid_property_list
static constexpr auto get_property()
detail::properties_t< Props... > property_list_t
static constexpr bool is_valid_property_list
static constexpr bool contains_valid_properties
annotated_ptr & operator--() noexcept
T & operator[](std::ptrdiff_t idx) const noexcept
annotated_ptr operator+(size_t offset) const noexcept
static constexpr bool hasConduitAndRegisterMapProperties
typename decorated_global_ptr< T >::pointer global_pointer_t
_Abi const simd< _Tp, _Abi > & noexcept
static I store(I *ptr, O &&Obj)
static I * annotate(I *ptr)