19 #include <type_traits>
22 #ifdef __SYCL_DEVICE_ONLY__
23 #define __SYCL_HOST_NOT_SUPPORTED(Op)
25 #define __SYCL_HOST_NOT_SUPPORTED(Op) \
26 throw sycl::exception( \
27 sycl::make_error_code(sycl::errc::feature_not_supported), \
28 Op " is not supported on host device.");
34 #define __SYCL_DEVICE_GLOBAL_PROP_META_INFO(Props) \
35 detail::ConditionalPropertyMetaInfo< \
36 Props, detail::DeviceGlobalMetaInfoFilter< \
37 Props, detail::properties_t<Props...>>::value>
40 inline namespace _V1 {
41 namespace ext::oneapi::experimental {
45 template <
typename T,
typename =
void>
49 std::void_t<decltype(std::declval<T>().operator->())>>
53 template <
typename T,
typename PropertyListT,
typename =
void>
68 template <
typename... Args>
74 template <access::decorated IsDecorated>
82 template <access::decorated IsDecorated>
93 template <
typename T,
typename... Props>
96 std::enable_if_t<properties_t<Props...>::template has_property<
97 device_image_scope_key>()>> {
105 template <
typename... Args>
111 template <access::decorated IsDecorated>
119 template <access::decorated IsDecorated>
129 template <
typename T,
typename PropertyListT = empty_properties_t>
131 #ifdef __SYCL_DEVICE_ONLY__
133 [[__sycl_detail__::global_variable_allowed, __sycl_detail__::device_global]]
138 "Property list is invalid.");
141 template <
typename T,
typename... Props>
143 #ifdef __SYCL_DEVICE_ONLY__
144 [[__sycl_detail__::global_variable_allowed, __sycl_detail__::device_global,
145 __sycl_detail__::add_ir_attributes_global_variable(
146 "sycl-device-global-size",
159 static_assert(std::is_trivially_default_constructible_v<T>,
160 "Type T must be trivially default constructable (until C++20 "
161 "consteval is supported and enabled.)");
163 static_assert(std::is_trivially_destructible_v<T>,
164 "Type T must be trivially destructible.");
167 "Property list is invalid.");
180 return *this->get_ptr();
185 return *this->get_ptr();
200 *this->get_ptr() = newValue;
204 template <
class RelayT = T>
205 std::remove_reference_t<
206 decltype(std::declval<RelayT>()[std::declval<std::ptrdiff_t>()])> &
209 return (*this->get_ptr())[idx];
212 template <
class RelayT = T>
213 const std::remove_reference_t<
214 decltype(std::declval<RelayT>()[std::declval<std::ptrdiff_t>()])> &
217 return (*this->get_ptr())[idx];
220 template <
class RelayT = T>
221 std::enable_if_t<detail::HasArrowOperator<RelayT>::value ||
222 std::is_pointer_v<RelayT>,
226 return *this->get_ptr();
229 template <
class RelayT = T>
230 std::enable_if_t<detail::HasArrowOperator<RelayT>::value ||
231 std::is_pointer_v<RelayT>,
235 return *this->get_ptr();
239 return property_list_t::template has_property<propertyT>();
243 return property_list_t::template get_property<propertyT>();
251 #undef __SYCL_HOST_NOT_SUPPORTED
252 #undef __SYCL_DEVICE_GLOBAL_PROP_META_INFO
const T * get_ptr() const noexcept
device_global_base()=default
multi_ptr< const T, access::address_space::global_space, IsDecorated > get_multi_ptr() const noexcept
multi_ptr< T, access::address_space::global_space, IsDecorated > get_multi_ptr() noexcept
device_global_base()=default
pointer_t get_ptr() const noexcept
pointer_t get_ptr() noexcept
multi_ptr< const T, access::address_space::global_space, IsDecorated > get_multi_ptr() const noexcept
multi_ptr< T, access::address_space::global_space, IsDecorated > get_multi_ptr() noexcept
typename decorated_global_ptr< T >::pointer pointer_t
static constexpr auto get_property()
device_global & operator=(const device_global &&)=delete
std::remove_extent_t< T > element_type
std::enable_if_t< detail::HasArrowOperator< RelayT >::value||std::is_pointer_v< RelayT >, const RelayT > & operator->() const noexcept
std::remove_reference_t< decltype(std::declval< RelayT >)[std::declval< std::ptrdiff_t >)])> & operator[](std::ptrdiff_t idx) noexcept
device_global(const device_global &&)=delete
device_global(const device_global &)=delete
std::enable_if_t< detail::HasArrowOperator< RelayT >::value||std::is_pointer_v< RelayT >, RelayT > & operator->() noexcept
const T & get() const noexcept
device_global & operator=(const T &newValue) noexcept
device_global & operator=(const device_global &)=delete
const std::remove_reference_t< decltype(std::declval< RelayT >)[std::declval< std::ptrdiff_t >)])> & operator[](std::ptrdiff_t idx) const noexcept
static constexpr bool has_property()
#define __SYCL_DEVICE_GLOBAL_PROP_META_INFO(Props)
#define __SYCL_HOST_NOT_SUPPORTED(Op)
_Abi const simd< _Tp, _Abi > & noexcept