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 inline constexpr property::no_init no_init;
29 
30 __SYCL2020_DEPRECATED("spelling is now: no_init")
31 inline constexpr property::noinit noinit;
32 
33 namespace ext::intel {
34 namespace property {
35 struct __SYCL_TYPE(buffer_location) buffer_location {
36  template <int A = 0> struct instance {
37  template <int B>
38  constexpr bool operator==(const buffer_location::instance<B> &) const {
39  return A == B;
40  }
41  template <int B>
42  constexpr bool operator!=(const buffer_location::instance<B> &) const {
43  return A != B;
44  }
45  int get_location() { return A; }
46  };
47 };
48 } // namespace property
49 
50 template <int A>
51 inline constexpr property::buffer_location::instance<A> buffer_location{};
52 } // namespace ext::intel
53 
54 namespace ext::oneapi {
55 namespace property {
56 struct no_offset {
57  template <bool B = true> struct instance {
58  constexpr bool operator==(const no_offset::instance<B> &) const {
59  return true;
60  }
61  constexpr bool operator!=(const no_offset::instance<B> &) const {
62  return false;
63  }
64  };
65 };
66 struct __SYCL_TYPE(no_alias) no_alias {
67  template <bool B = true> struct instance {
68  constexpr bool operator==(const no_alias::instance<B> &) const {
69  return true;
70  }
71  constexpr bool operator!=(const no_alias::instance<B> &) const {
72  return false;
73  }
74  };
75 };
76 } // namespace property
77 
79 inline constexpr property::no_alias::instance<> no_alias;
80 
81 template <>
83  : std::true_type {};
84 template <>
86  : std::true_type {};
87 template <>
89  : std::true_type {};
90 } // namespace ext::oneapi
91 
92 // Forward declaration
93 template <typename DataT, int Dimensions, access::mode AccessMode,
95  typename PropertyListT>
96 class accessor;
97 template <typename DataT, int Dimensions, access::mode AccessMode>
98 class host_accessor;
99 
100 namespace detail::acc_properties {
101 template <typename T> struct is_accessor : std::false_type {};
102 template <typename DataT, int Dimensions, access::mode AccessMode,
104  typename PropertyListT>
105 struct is_accessor<accessor<DataT, Dimensions, AccessMode, AccessTarget,
106  IsPlaceholder, PropertyListT>> : std::true_type {};
107 
108 template <typename T> struct is_host_accessor : std::false_type {};
109 template <typename DataT, int Dimensions, access::mode AccessMode>
111  : std::true_type {};
112 } // namespace detail::acc_properties
113 
114 // Accessor property trait specializations
115 template <>
116 struct is_property<ext::oneapi::property::no_offset> : std::true_type {};
117 template <>
118 struct is_property<ext::oneapi::property::no_alias> : std::true_type {};
119 template <>
120 struct is_property<ext::intel::property::buffer_location> : std::true_type {};
121 
122 template <typename T>
123 struct is_property_of<property::noinit, T>
124  : std::bool_constant<detail::acc_properties::is_accessor<T>::value ||
125  detail::acc_properties::is_host_accessor<T>::value> {};
126 
127 template <typename T>
128 struct is_property_of<property::no_init, T>
129  : std::bool_constant<detail::acc_properties::is_accessor<T>::value ||
130  detail::acc_properties::is_host_accessor<T>::value> {};
131 
132 template <typename T>
134  : std::bool_constant<detail::acc_properties::is_accessor<T>::value> {};
135 
136 template <typename T>
138  : std::bool_constant<detail::acc_properties::is_accessor<T>::value> {};
139 
140 template <typename T>
142  : std::bool_constant<detail::acc_properties::is_accessor<T>::value> {};
143 
144 namespace detail {
145 template <int I>
147  ext::intel::property::buffer_location::instance<I>> : std::true_type {};
148 template <>
150  ext::oneapi::property::no_alias::instance<>> : std::true_type {};
151 template <>
153  ext::oneapi::property::no_offset::instance<>> : std::true_type {};
154 } // namespace detail
155 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
156 } // namespace sycl
sycl::_V1::IsPlaceholder
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS IsPlaceholder
Definition: accessor.hpp:2855
sycl::_V1::ext::oneapi::property::no_offset::instance
Definition: accessor_properties.hpp:57
sycl::_V1::__SYCL2020_DEPRECATED
signed char __SYCL2020_DEPRECATED
Definition: aliases.hpp:96
sycl::_V1::ext::oneapi::no_alias
constexpr property::no_alias::instance no_alias
Definition: accessor_properties.hpp:79
sycl::_V1::noinit
constexpr property::noinit noinit
Definition: accessor_properties.hpp:31
sycl::_V1::access::mode
mode
Definition: access.hpp:30
property_traits.hpp
sycl::_V1::detail::DataLessProperty
Definition: property_helper.hpp:71
sycl::_V1::is_property
Definition: property_traits.hpp:18
sycl::_V1::detail::bool_constant
std::integral_constant< bool, V > bool_constant
Definition: stl_type_traits.hpp:40
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
sycl::_V1::ext::oneapi::is_compile_time_property
Definition: accessor_property_list.hpp:30
sycl::_V1::detail::acc_properties::is_accessor
Definition: accessor_properties.hpp:101
accessor_property_list.hpp
sycl::_V1::is_property_of
Definition: property_traits.hpp:24
sycl::_V1::host_accessor
Definition: accessor.hpp:3011
sycl::_V1::Dimensions
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS Dimensions
Definition: accessor.hpp:2854
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::ext::oneapi::property::no_offset::instance::operator!=
constexpr bool operator!=(const no_offset::instance< B > &) const
Definition: accessor_properties.hpp:61
sycl::_V1::no_init
constexpr property::no_init no_init
Definition: accessor_properties.hpp:28
operator==
bool operator==(const Slab &Lhs, const Slab &Rhs)
Definition: usm_allocator.cpp:313
sycl::_V1::ext::intel::buffer_location
constexpr property::buffer_location::instance< A > buffer_location
Definition: accessor_properties.hpp:51
sycl::_V1::access::placeholder
placeholder
Definition: access.hpp:45
sycl::_V1::ext::oneapi::property::no_offset
Definition: accessor_properties.hpp:56
sycl::_V1::ext::oneapi::property::no_offset::instance::operator==
constexpr bool operator==(const no_offset::instance< B > &) const
Definition: accessor_properties.hpp:58
sycl::_V1::detail::IsCompileTimePropertyInstance
Definition: accessor_property_list.hpp:26
common.hpp
sycl::_V1::access::target
target
Definition: access.hpp:18
sycl::_V1::accessor
Definition: accessor.hpp:225
property_helper.hpp
sycl::_V1::ext::oneapi::no_offset
constexpr property::no_offset::instance no_offset
Definition: accessor_properties.hpp:78
sycl::_V1::property::no_init
Definition: accessor_properties.hpp:21
sycl::_V1::ext::intel::experimental::operator!=
bool operator!=(const cache_config &lhs, const cache_config &rhs)
Definition: kernel_execution_properties.hpp:37
sycl::_V1::AccessMode
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS AccessMode
Definition: accessor.hpp:2854
sycl::_V1::detail::acc_properties::is_host_accessor
Definition: accessor_properties.hpp:108