DPC++ Runtime
Runtime libraries for oneAPI DPC++
accessor_properties.hpp
Go to the documentation of this file.
1 //==----------- accessor_properties.hpp --- SYCL accessor properties -------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 #include <sycl/detail/common.hpp>
15 #include <type_traits>
16 
17 namespace sycl {
19 namespace property {
20 
21 class no_init : public detail::DataLessProperty<detail::NoInit> {};
22 
23 class __SYCL2020_DEPRECATED("spelling is now: no_init") noinit
24  : public detail::DataLessProperty<detail::NoInit> {};
25 
26 } // namespace property
27 
28 #if __cplusplus >= 201703L
29 
30 __SYCL_INLINE_CONSTEXPR property::no_init no_init;
31 
32 __SYCL2020_DEPRECATED("spelling is now: no_init")
33 __SYCL_INLINE_CONSTEXPR property::noinit noinit;
34 
35 #else
36 
37 namespace {
38 
39 constexpr const auto &no_init =
40  sycl::detail::InlineVariableHelper<property::no_init>::value;
41 
42 constexpr const auto &noinit __SYCL2020_DEPRECATED("spelling is now: no_init") =
43  sycl::detail::InlineVariableHelper<property::noinit>::value;
44 } // namespace
45 
46 #endif
47 
48 namespace ext {
49 namespace intel {
50 namespace property {
51 struct __SYCL_TYPE(buffer_location) buffer_location {
52  template <int A = 0> struct instance {
53  template <int B>
54  constexpr bool operator==(const buffer_location::instance<B> &) const {
55  return A == B;
56  }
57  template <int B>
58  constexpr bool operator!=(const buffer_location::instance<B> &) const {
59  return A != B;
60  }
61  int get_location() { return A; }
62  };
63 };
64 } // namespace property
65 #if __cplusplus >= 201703L
66 template <int A>
67 inline constexpr property::buffer_location::instance<A> buffer_location{};
68 #endif
69 } // namespace intel
70 } // namespace ext
71 
72 namespace ext {
73 namespace oneapi {
74 namespace property {
75 struct no_offset {
76  template <bool B = true> struct instance {
77  constexpr bool operator==(const no_offset::instance<B> &) const {
78  return true;
79  }
80  constexpr bool operator!=(const no_offset::instance<B> &) const {
81  return false;
82  }
83  };
84 };
85 struct __SYCL_TYPE(no_alias) no_alias {
86  template <bool B = true> struct instance {
87  constexpr bool operator==(const no_alias::instance<B> &) const {
88  return true;
89  }
90  constexpr bool operator!=(const no_alias::instance<B> &) const {
91  return false;
92  }
93  };
94 };
95 } // namespace property
96 
97 #if __cplusplus >= 201703L
98 
99 inline constexpr property::no_offset::instance<> no_offset;
100 inline constexpr property::no_alias::instance<> no_alias;
101 
102 #endif
103 
104 template <>
106  : std::true_type {};
107 template <>
108 struct is_compile_time_property<ext::oneapi::property::no_alias>
109  : std::true_type {};
110 template <>
111 struct is_compile_time_property<sycl::ext::intel::property::buffer_location>
112  : std::true_type {};
113 } // namespace oneapi
114 } // namespace ext
115 
116 // Forward declaration
117 template <typename DataT, int Dimensions, access::mode AccessMode,
119  typename PropertyListT>
120 class accessor;
121 template <typename DataT, int Dimensions, access::mode AccessMode,
124 template <typename DataT, int Dimensions, access::mode AccessMode>
125 class host_accessor;
126 
127 // Accessor property trait specializations
128 template <> struct is_property<property::noinit> : std::true_type {};
129 template <> struct is_property<property::no_init> : std::true_type {};
130 template <>
131 struct is_property<ext::oneapi::property::no_offset> : std::true_type {};
132 template <>
133 struct is_property<ext::oneapi::property::no_alias> : std::true_type {};
134 template <>
135 struct is_property<ext::intel::property::buffer_location> : std::true_type {};
136 
137 template <typename DataT, int Dimensions, access::mode AccessMode,
139  typename PropertyListT>
140 struct is_property_of<property::noinit,
141  accessor<DataT, Dimensions, AccessMode, AccessTarget,
142  IsPlaceholder, PropertyListT>> : std::true_type {
143 };
144 template <typename DataT, int Dimensions, access::mode AccessMode,
146  typename PropertyListT>
147 struct is_property_of<property::no_init,
148  accessor<DataT, Dimensions, AccessMode, AccessTarget,
149  IsPlaceholder, PropertyListT>> : std::true_type {
150 };
151 template <typename DataT, int Dimensions, access::mode AccessMode,
153  typename PropertyListT>
154 struct is_property_of<ext::oneapi::property::no_offset,
155  accessor<DataT, Dimensions, AccessMode, AccessTarget,
156  IsPlaceholder, PropertyListT>> : std::true_type {
157 };
158 template <typename DataT, int Dimensions, access::mode AccessMode,
160  typename PropertyListT>
161 struct is_property_of<ext::oneapi::property::no_alias,
162  accessor<DataT, Dimensions, AccessMode, AccessTarget,
163  IsPlaceholder, PropertyListT>> : std::true_type {
164 };
165 template <typename DataT, int Dimensions, access::mode AccessMode,
167  typename PropertyListT>
168 struct is_property_of<ext::intel::property::buffer_location,
169  accessor<DataT, Dimensions, AccessMode, AccessTarget,
170  IsPlaceholder, PropertyListT>> : std::true_type {
171 };
172 
173 template <typename DataT, int Dimensions, access::mode AccessMode,
176  property::noinit,
177  image_accessor<DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder>>
178  : std::true_type {};
179 template <typename DataT, int Dimensions, access::mode AccessMode,
182  property::no_init,
183  image_accessor<DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder>>
184  : std::true_type {};
185 
186 template <typename DataT, int Dimensions, access::mode AccessMode>
187 struct is_property_of<property::noinit,
188  host_accessor<DataT, Dimensions, AccessMode>>
189  : std::true_type {};
190 template <typename DataT, int Dimensions, access::mode AccessMode>
191 struct is_property_of<property::no_init,
192  host_accessor<DataT, Dimensions, AccessMode>>
193  : std::true_type {};
194 
195 namespace detail {
196 template <int I>
198  ext::intel::property::buffer_location::instance<I>> : std::true_type {};
199 template <>
201  ext::oneapi::property::no_alias::instance<>> : std::true_type {};
202 template <>
204  ext::oneapi::property::no_offset::instance<>> : std::true_type {};
205 } // namespace detail
206 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
207 } // namespace sycl
sycl::_V1::operator!=
bool operator!=(const multi_ptr< ElementType, Space > &lhs, const multi_ptr< ElementType, Space > &rhs)
Definition: multi_ptr.hpp:674
__SYCL_INLINE_CONSTEXPR
#define __SYCL_INLINE_CONSTEXPR
Definition: defines_elementary.hpp:63
sycl::_V1::ext::oneapi::property::no_offset::instance
Definition: accessor_properties.hpp:76
sycl::_V1::access::mode
mode
Definition: access.hpp:28
property_traits.hpp
sycl::_V1::detail::DataLessProperty
Definition: property_helper.hpp:62
sycl::_V1::is_property
Definition: property_traits.hpp:15
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:13
sycl::_V1::ext::oneapi::is_compile_time_property
Definition: accessor_property_list.hpp:31
accessor_property_list.hpp
sycl::_V1::is_property_of
Definition: property_traits.hpp:18
sycl::_V1::host_accessor
Definition: accessor.hpp:2831
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:13
sycl::_V1::ext::oneapi::property::no_offset::instance::operator!=
constexpr bool operator!=(const no_offset::instance< B > &) const
Definition: accessor_properties.hpp:80
operator==
bool operator==(const Slab &Lhs, const Slab &Rhs)
Definition: usm_allocator.cpp:582
sycl::_V1::image_accessor
Definition: accessor_properties.hpp:123
sycl::_V1::access::placeholder
placeholder
Definition: access.hpp:43
sycl::_V1::ext::oneapi::property::no_offset
Definition: accessor_properties.hpp:75
sycl::_V1::ext::oneapi::property::no_offset::instance::operator==
constexpr bool operator==(const no_offset::instance< B > &) const
Definition: accessor_properties.hpp:77
sycl::_V1::Dimensions
class __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_SPECIAL_CLASS Dimensions
Definition: accessor.hpp:2686
sycl::_V1::detail::IsCompileTimePropertyInstance
Definition: accessor_property_list.hpp:26
sycl::_V1::IsPlaceholder
class __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_SPECIAL_CLASS IsPlaceholder
Definition: accessor.hpp:2688
common.hpp
sycl::_V1::access::target
target
Definition: access.hpp:17
sycl::_V1::AccessMode
class __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_SPECIAL_CLASS AccessMode
Definition: accessor.hpp:2686
sycl::_V1::accessor
Definition: accessor.hpp:227
property_helper.hpp
sycl::_V1::property::no_init
Definition: accessor_properties.hpp:21
__SYCL2020_DEPRECATED
#define __SYCL2020_DEPRECATED(message)
Definition: defines_elementary.hpp:54