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 
15 #include <type_traits>
16 
18 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 =
41 
42 constexpr const auto &noinit __SYCL2020_DEPRECATED("spelling is now: no_init") =
44 } // namespace
45 
46 #endif
47 
48 namespace ext {
49 namespace intel {
50 namespace property {
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 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 <>
109  : std::true_type {};
110 template <>
112  : std::true_type {};
113 } // namespace oneapi
114 } // namespace ext
115 
116 // Forward declaration
117 template <typename DataT, int Dimensions, access::mode AccessMode,
118  access::target AccessTarget, access::placeholder IsPlaceholder,
119  typename PropertyListT>
120 class accessor;
121 template <typename DataT, int Dimensions, access::mode AccessMode,
122  access::target AccessTarget, access::placeholder IsPlaceholder>
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,
138  access::target AccessTarget, access::placeholder IsPlaceholder,
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,
145  access::target AccessTarget, access::placeholder IsPlaceholder,
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,
152  access::target AccessTarget, access::placeholder IsPlaceholder,
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,
159  access::target AccessTarget, access::placeholder IsPlaceholder,
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,
166  access::target AccessTarget, access::placeholder IsPlaceholder,
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,
174  access::target AccessTarget, access::placeholder IsPlaceholder>
176  property::noinit,
177  image_accessor<DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder>>
178  : std::true_type {};
179 template <typename DataT, int Dimensions, access::mode AccessMode,
180  access::target AccessTarget, access::placeholder IsPlaceholder>
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 } // namespace sycl
207 } // __SYCL_INLINE_NAMESPACE(cl)
cl::sycl::ext::oneapi::property::no_alias
Definition: accessor_properties.hpp:85
cl::sycl::ext::oneapi::property::no_offset
Definition: accessor_properties.hpp:75
property_traits.hpp
__SYCL2020_DEPRECATED
#define __SYCL2020_DEPRECATED(message)
Definition: defines_elementary.hpp:56
cl::sycl::access::placeholder
placeholder
Definition: access.hpp:43
cl::sycl::ext::intel::property::buffer_location::instance
Definition: accessor_properties.hpp:52
accessor_property_list.hpp
cl::sycl::detail::IsCompileTimePropertyInstance
Definition: accessor_property_list.hpp:25
cl::sycl::ext::intel::property::buffer_location::instance::get_location
int get_location()
Definition: accessor_properties.hpp:61
sycl
Definition: invoke_simd.hpp:68
cl::sycl::detail::InlineVariableHelper
Definition: common.hpp:346
cl::sycl::ext::oneapi::property::no_alias::instance
Definition: accessor_properties.hpp:86
cl::sycl::host_accessor
Definition: accessor.hpp:2376
cl::sycl::property::no_init
Definition: accessor_properties.hpp:21
cl::sycl::is_property
Definition: property_traits.hpp:15
cl::sycl::detail::DataLessProperty
Definition: property_helper.hpp:62
cl::sycl::is_property_of
Definition: property_traits.hpp:18
cl::sycl::ext::oneapi::property::no_offset::instance::operator==
constexpr bool operator==(const no_offset::instance< B > &) const
Definition: accessor_properties.hpp:77
cl::sycl::accessor
Buffer accessor.
Definition: accessor.hpp:223
cl::sycl::ext::oneapi::property::no_offset::instance::operator!=
constexpr bool operator!=(const no_offset::instance< B > &) const
Definition: accessor_properties.hpp:80
cl::sycl::access::target
target
Definition: access.hpp:17
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::ext::oneapi::is_compile_time_property
Definition: accessor_property_list.hpp:30
cl::sycl::ext::intel::property::buffer_location::instance::operator!=
constexpr bool operator!=(const buffer_location::instance< B > &) const
Definition: accessor_properties.hpp:58
property_helper.hpp
cl::sycl::ext::oneapi::property::no_alias::instance::operator==
constexpr bool operator==(const no_alias::instance< B > &) const
Definition: accessor_properties.hpp:87
__SYCL_INLINE_CONSTEXPR
#define __SYCL_INLINE_CONSTEXPR
Definition: defines_elementary.hpp:65
cl::sycl::detail::image_accessor
Definition: accessor.hpp:377
cl::sycl::ext::intel::property::buffer_location::instance::operator==
constexpr bool operator==(const buffer_location::instance< B > &) const
Definition: accessor_properties.hpp:54
common.hpp
cl::sycl::ext::oneapi::property::no_offset::instance
Definition: accessor_properties.hpp:76
cl::sycl::access::mode
mode
Definition: access.hpp:28
cl::sycl::ext::oneapi::property::no_alias::instance::operator!=
constexpr bool operator!=(const no_alias::instance< B > &) const
Definition: accessor_properties.hpp:90
cl::sycl::ext::intel::property::buffer_location
Definition: accessor_properties.hpp:51
cl::sycl::Dimensions
Dimensions
Definition: backend.hpp:138
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12