12 #include <type_traits>
23 namespace experimental {
31 !std::is_void<decltype(std::declval<T>().operator[](0))>::value>{};
40 template <
typename... Args>
48 template <
typename T,
typename... Args>
52 template <
typename T,
typename old,
typename... ArgT>
57 template <
typename T,
typename PropertyListT = detail::empty_properties_t>
61 "Property list is invalid.");
65 template <
typename T,
typename... Props>
70 #ifdef __SYCL_DEVICE_ONLY__
78 template <
typename T2,
typename PropertyListT>
friend class annotated_arg;
80 #ifdef __SYCL_DEVICE_ONLY__
81 void __init([[__sycl_detail__::add_ir_attributes_kernel_parameter(
89 static_assert(is_property_list<property_list_t>::value,
90 "Property list is invalid.");
97 const property_list_t &PropList =
properties{}) noexcept
106 template <
typename... PropertyValueTs>
114 "The property list must contain all properties of the input of the "
122 template <
typename T2,
typename PropertyList2>
125 static_assert(std::is_convertible<T2, T *>::value,
126 "The underlying data type of the input annotated_arg is not "
133 "The constructed annotated_arg type must contain all the properties of "
134 "the input annotated_arg");
141 template <
typename T2,
typename PropertyListU,
typename PropertyListV>
143 const PropertyListV &proplist) noexcept
146 static_assert(std::is_convertible<T2, T *>::value,
147 "The underlying data type of the input annotated_arg is not "
152 PropertyListU, PropertyListV>>::value,
153 "The property list of constructed annotated_arg type must be the union "
154 "of the input property lists");
157 operator T *() noexcept {
return obj; }
158 operator T *()
const noexcept {
return obj; }
163 return property_list_t::template has_property<PropertyT>();
167 return property_list_t::template get_property<PropertyT>();
172 template <
typename T,
typename... Props>
177 template <
typename T2,
typename PropertyListT>
friend class annotated_arg;
181 #ifdef __SYCL_DEVICE_ONLY__
182 void __init([[__sycl_detail__::add_ir_attributes_kernel_parameter(
183 detail::PropertyMetaInfo<Props>::name...,
184 detail::PropertyMetaInfo<Props>::value...)]] T _obj) {
190 static_assert(is_device_copyable_v<T>,
"Type T must be device copyable.");
191 static_assert(is_property_list<property_list_t>::value,
192 "Property list is invalid.");
193 static_assert(check_property_list<T, Props...>::value,
194 "The property list contains invalid property.");
201 const property_list_t &PropList =
properties{}) noexcept
210 template <
typename... PropertyValueTs>
217 "The property list must contain all properties of the input of the "
225 template <
typename T2,
typename PropertyList2>
226 explicit annotated_arg(
const annotated_arg<T2, PropertyList2> &other) noexcept
228 static_assert(std::is_convertible<T2, T>::value,
229 "The underlying data type of the input annotated_arg is not "
235 detail::merged_properties_t<property_list_t, PropertyList2>>::value,
236 "The constructed annotated_arg type must contain all the properties of "
237 "the input annotated_arg");
244 template <
typename T2,
typename PropertyListU,
typename PropertyListV>
245 explicit annotated_arg(
const annotated_arg<T2, PropertyListU> &other,
246 const PropertyListV &proplist) noexcept
249 static_assert(std::is_convertible<T2, T>::value,
250 "The underlying data type of the input annotated_arg is not "
255 PropertyListU, PropertyListV>>::value,
256 "The property list of constructed annotated_arg type must be the union "
257 "of the input property lists");
260 operator T() noexcept {
return obj; }
261 operator T() const noexcept {
return obj; }
263 template <
class RelayT = T>
264 std::enable_if_t<detail::HasSubscriptOperator<RelayT>::value,
265 decltype(std::declval<RelayT>().
operator[](0))> &
266 operator[](std::ptrdiff_t idx)
const noexcept {
267 return obj.operator[](idx);
270 template <
typename PropertyT>
static constexpr
bool has_property() {
271 return property_list_t::template has_property<PropertyT>();
274 template <
typename PropertyT>
static constexpr
auto get_property() {
275 return property_list_t::template get_property<PropertyT>();