22 #include <string_view>
24 #include <type_traits>
29 inline namespace _V1 {
32 namespace experimental {
34 template <
typename T,
typename PropertyListT = empty_properties_t>
37 static constexpr
bool is_valid_property_list =
44 template <
class T,
class P>
46 template <
class T,
class P>
52 template <
typename... Ts>
59 sycl::detail::boost::mp11::mp_copy_if<property_list, filter>;
62 template <
typename... Props>
70 template <
typename I,
typename... P>
73 return __builtin_intel_sycl_ptr_annotation(
79 return *__builtin_intel_sycl_ptr_annotation(
84 template <
class O>
static I
store(I *ptr, O &&Obj) {
85 return *__builtin_intel_sycl_ptr_annotation(
91 template <
typename T,
typename... Props>
96 std::is_trivially_copyable_v<T>,
97 "annotated_ref can only encapsulate a trivially-copyable type!");
108 #ifdef __SYCL_DEVICE_ONLY__
117 template <
class O,
typename = std::enable_if_t<!detail::is_ann_ref_v<O>>>
119 #ifdef __SYCL_DEVICE_ONLY__
123 return *
m_Ptr = std::forward<O>(Obj);
127 template <
class O,
class P>
129 O t2 = Ref.operator O();
134 #define PROPAGATE_OP(op) \
135 template <class O, typename = std::enable_if_t<!detail::is_ann_ref_v<O>>> \
136 T operator op(O &&rhs) const { \
137 T t = this->operator T(); \
138 t op std::forward<O>(rhs); \
142 template <class O, class P> \
143 T operator op(const annotated_ref<O, P> &rhs) const { \
144 T t = this->operator T(); \
145 O t2 = rhs.operator T(); \
163 #define PROPAGATE_OP(op) \
165 friend auto operator op(O &&a, const annotated_ref &b) \
166 ->decltype(std::forward<O>(a) op std::declval<T>()) { \
167 return std::forward<O>(a) op b.operator T(); \
169 template <class O, typename = std::enable_if_t<!detail::is_ann_ref_v<O>>> \
170 friend auto operator op(const annotated_ref &a, O &&b) \
171 ->decltype(std::declval<T>() op std::forward<O>(b)) { \
172 return a.operator T() op std::forward<O>(b); \
196 #define PROPAGATE_OP(op) \
197 template <typename O = T> \
198 auto operator op() const->decltype(op std::declval<O>()) { \
199 return op this->operator O(); \
209 T
t = this->
operator T();
216 T t1 = this->
operator T();
224 T
t = this->
operator T();
231 T t1 = this->
operator T();
241 #ifdef __cpp_deduction_guides
242 template <
typename T,
typename... Args>
246 template <
typename T,
typename old,
typename... ArgT>
252 template <
typename T,
typename PropertyListT = empty_properties_t>
255 static constexpr
bool is_valid_property_list =
260 template <
typename T,
typename... Props>
264 static_assert(std::is_same_v<T, void> || std::is_trivially_copyable_v<T>,
265 "annotated_ptr can only encapsulate either "
266 "a trivially-copyable type "
275 #ifdef __ENABLE_USM_ADDR_SPACE__
291 #ifdef __SYCL_DEVICE_ONLY__
292 void __init([[__sycl_detail__::add_ir_attributes_kernel_parameter(
312 template <
typename... PropertyValueTs>
316 static constexpr
bool has_same_properties = std::is_same<
322 "The property list must contain all properties of the input of the "
330 template <
typename T2,
typename PropertyList2>
332 :
m_Ptr(other.m_Ptr) {
333 static constexpr
bool is_input_convertible =
334 std::is_convertible<T2 *, T *>::value;
336 is_input_convertible,
337 "The underlying pointer type of the input annotated_ptr is not "
338 "convertible to the target pointer type");
340 static constexpr
bool has_same_properties = std::is_same<
345 "The constructed annotated_ptr type must contain all the properties "
346 "of the input annotated_ptr");
353 template <
typename T2,
typename PropertyListU,
typename PropertyListV>
356 :
m_Ptr(other.m_Ptr) {
357 static constexpr
bool is_input_convertible =
358 std::is_convertible<T2 *, T *>::value;
360 is_input_convertible,
361 "The underlying pointer type of the input annotated_ptr is not "
362 "convertible to the target pointer type");
364 static constexpr
bool has_same_properties = std::is_same<
369 "The property list of constructed annotated_ptr type must be the "
370 "union of the input property lists");
376 return m_Ptr - other.m_Ptr;
381 operator T *()
const noexcept =
delete;
384 #ifdef __SYCL_DEVICE_ONLY__
399 class = std::enable_if_t<!has_alignment>>
405 class = std::enable_if_t<has_alignment>>
406 auto operator[](std::ptrdiff_t idx)
const noexcept -> decltype(
"operator[] is not available when alignment is specified!") =
delete;
409 class = std::enable_if_t<!has_alignment>>
415 class = std::enable_if_t<has_alignment>>
416 auto operator+(
size_t offset)
const noexcept -> decltype(
"operator+ is not available when alignment is specified!") =
delete;
419 class = std::enable_if_t<!has_alignment>>
426 class = std::enable_if_t<has_alignment>>
438 class = std::enable_if_t<has_alignment>>
439 auto operator++(
int)
noexcept -> decltype(
"operator++ is not available when alignment is specified!") =
delete;
442 class = std::enable_if_t<!has_alignment>>
449 class = std::enable_if_t<has_alignment>>
461 class = std::enable_if_t<has_alignment>>
462 auto operator--(
int)
noexcept -> decltype(
"operator-- is not available when alignment is specified!") =
delete;
467 return property_list_t::template has_property<PropertyT>();
471 return property_list_t::template get_property<PropertyT>();
488 "The property list contains invalid property.");
493 "FPGA Interface properties (i.e. awidth, dwidth, etc.) "
494 "can only be set with BufferLocation together.");
499 "The properties conduit and register_map cannot be "
500 "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)