DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
buffer.hpp
Go to the documentation of this file.
1 //==----------- buffer.hpp --- SYCL buffer ---------------------------------==//
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 
14 #include <CL/sycl/exception.hpp>
16 #include <CL/sycl/stl.hpp>
18 
20 namespace sycl {
21 
22 class handler;
23 class queue;
24 template <int dimensions> class range;
25 
34 template <typename T, int dimensions = 1,
35  typename AllocatorT = cl::sycl::buffer_allocator,
36  typename = typename detail::enable_if_t<(dimensions > 0) &&
37  (dimensions <= 3)>>
38 class buffer {
39 public:
40  using value_type = T;
41  using reference = value_type &;
42  using const_reference = const value_type &;
43  using allocator_type = AllocatorT;
44  template <int dims>
46  // using same requirement for contiguous container as std::span
47  template <class Container>
48  using EnableIfContiguous =
49  detail::void_t<detail::enable_if_t<std::is_convertible<
50  detail::remove_pointer_t<decltype(
51  std::declval<Container>().data())> (*)[],
52  const T (*)[]>::value>,
53  decltype(std::declval<Container>().size())>;
54  template <class It>
56  std::is_convertible<typename std::iterator_traits<It>::iterator_category,
57  std::input_iterator_tag>::value>;
58  template <typename ItA, typename ItB>
60  std::is_same<ItA, ItB>::value && !std::is_const<ItA>::value, ItA>;
61 
62  buffer(const range<dimensions> &bufferRange,
63  const property_list &propList = {})
64  : Range(bufferRange) {
65  impl = std::make_shared<detail::buffer_impl>(
66  size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)), propList,
68  }
69 
70  buffer(const range<dimensions> &bufferRange, AllocatorT allocator,
71  const property_list &propList = {})
72  : Range(bufferRange) {
73  impl = std::make_shared<detail::buffer_impl>(
74  size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)), propList,
76  allocator));
77  }
78 
79  buffer(T *hostData, const range<dimensions> &bufferRange,
80  const property_list &propList = {})
81  : Range(bufferRange) {
82  impl = std::make_shared<detail::buffer_impl>(
83  hostData, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
84  propList,
86  }
87 
88  buffer(T *hostData, const range<dimensions> &bufferRange,
89  AllocatorT allocator, const property_list &propList = {})
90  : Range(bufferRange) {
91  impl = std::make_shared<detail::buffer_impl>(
92  hostData, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
93  propList,
95  allocator));
96  }
97 
98  template <typename _T = T>
100  const range<dimensions> &bufferRange,
101  const property_list &propList = {})
102  : Range(bufferRange) {
103  impl = std::make_shared<detail::buffer_impl>(
104  hostData, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
105  propList,
107  }
108 
109  template <typename _T = T>
111  const range<dimensions> &bufferRange, AllocatorT allocator,
112  const property_list &propList = {})
113  : Range(bufferRange) {
114  impl = std::make_shared<detail::buffer_impl>(
115  hostData, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
116  propList,
118  allocator));
119  }
120 
121  buffer(const std::shared_ptr<T> &hostData,
122  const range<dimensions> &bufferRange, AllocatorT allocator,
123  const property_list &propList = {})
124  : Range(bufferRange) {
125  impl = std::make_shared<detail::buffer_impl>(
126  hostData, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
127  propList,
129  allocator));
130  }
131 
132  buffer(const std::shared_ptr<T[]> &hostData,
133  const range<dimensions> &bufferRange, AllocatorT allocator,
134  const property_list &propList = {})
135  : Range(bufferRange) {
136  impl = std::make_shared<detail::buffer_impl>(
137  hostData, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
138  propList,
140  allocator));
141  }
142 
143  buffer(const std::shared_ptr<T> &hostData,
144  const range<dimensions> &bufferRange,
145  const property_list &propList = {})
146  : Range(bufferRange) {
147  impl = std::make_shared<detail::buffer_impl>(
148  hostData, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
149  propList,
151  }
152 
153  buffer(const std::shared_ptr<T[]> &hostData,
154  const range<dimensions> &bufferRange,
155  const property_list &propList = {})
156  : Range(bufferRange) {
157  impl = std::make_shared<detail::buffer_impl>(
158  hostData, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
159  propList,
161  }
162 
163  template <class InputIterator, int N = dimensions,
164  typename = EnableIfOneDimension<N>,
165  typename = EnableIfItInputIterator<InputIterator>>
166  buffer(InputIterator first, InputIterator last, AllocatorT allocator,
167  const property_list &propList = {})
168  : Range(range<1>(std::distance(first, last))) {
169  impl = std::make_shared<detail::buffer_impl>(
170  first, last, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
171  propList,
173  allocator));
174  }
175 
176  template <class InputIterator, int N = dimensions,
177  typename = EnableIfOneDimension<N>,
178  typename = EnableIfItInputIterator<InputIterator>>
179  buffer(InputIterator first, InputIterator last,
180  const property_list &propList = {})
181  : Range(range<1>(std::distance(first, last))) {
182  impl = std::make_shared<detail::buffer_impl>(
183  first, last, size() * sizeof(T), detail::getNextPowerOfTwo(sizeof(T)),
184  propList,
186  }
187 
188  // This constructor is a prototype for a future SYCL specification
189  template <class Container, int N = dimensions,
190  typename = EnableIfOneDimension<N>,
191  typename = EnableIfContiguous<Container>>
192  buffer(Container &container, AllocatorT allocator,
193  const property_list &propList = {})
194  : Range(range<1>(container.size())) {
195  impl = std::make_shared<detail::buffer_impl>(
196  container.data(), size() * sizeof(T),
197  detail::getNextPowerOfTwo(sizeof(T)), propList,
199  allocator));
200  }
201 
202  // This constructor is a prototype for a future SYCL specification
203  template <class Container, int N = dimensions,
204  typename = EnableIfOneDimension<N>,
205  typename = EnableIfContiguous<Container>>
206  buffer(Container &container, const property_list &propList = {})
207  : buffer(container, {}, propList) {}
208 
210  const range<dimensions> &subRange)
211  : impl(b.impl), Range(subRange),
212  OffsetInBytes(getOffsetInBytes<T>(baseIndex, b.Range)),
213  IsSubBuffer(true) {
214  if (b.is_sub_buffer())
215  throw cl::sycl::invalid_object_error(
216  "Cannot create sub buffer from sub buffer.", PI_INVALID_VALUE);
217  if (isOutOfBounds(baseIndex, subRange, b.Range))
218  throw cl::sycl::invalid_object_error(
219  "Requested sub-buffer size exceeds the size of the parent buffer",
221  if (!isContiguousRegion(baseIndex, subRange, b.Range))
222  throw cl::sycl::invalid_object_error(
223  "Requested sub-buffer region is not contiguous", PI_INVALID_VALUE);
224  }
225 
226  template <int N = dimensions, typename = EnableIfOneDimension<N>>
227  __SYCL2020_DEPRECATED("OpenCL interop APIs are deprecated")
228  buffer(cl_mem MemObject, const context &SyclContext,
229  event AvailableEvent = {})
230  : Range{0} {
231 
232  size_t BufSize = detail::SYCLMemObjT::getBufSizeForContext(
233  detail::getSyclObjImpl(SyclContext), MemObject);
234 
235  Range[0] = BufSize / sizeof(T);
236  impl = std::make_shared<detail::buffer_impl>(
237  MemObject, SyclContext, BufSize,
238  make_unique_ptr<detail::SYCLMemObjAllocatorHolder<AllocatorT>>(),
239  AvailableEvent);
240  }
241 
242  buffer(const buffer &rhs) = default;
243 
244  buffer(buffer &&rhs) = default;
245 
246  buffer &operator=(const buffer &rhs) = default;
247 
248  buffer &operator=(buffer &&rhs) = default;
249 
250  ~buffer() = default;
251 
252  bool operator==(const buffer &rhs) const { return impl == rhs.impl; }
253 
254  bool operator!=(const buffer &rhs) const { return !(*this == rhs); }
255 
256  /* -- common interface members -- */
257 
258  /* -- property interface members -- */
259 
260  range<dimensions> get_range() const { return Range; }
261 
262  __SYCL2020_DEPRECATED("get_count() is deprecated, please use size() instead")
263  size_t get_count() const { return size(); }
264  size_t size() const noexcept { return Range.size(); }
265 
267  "get_size() is deprecated, please use byte_size() instead")
268  size_t get_size() const { return byte_size(); }
269  size_t byte_size() const noexcept { return size() * sizeof(T); }
270 
271  AllocatorT get_allocator() const {
272  return impl->template get_allocator<AllocatorT>();
273  }
274 
275  template <access::mode Mode,
276  access::target Target = access::target::global_buffer>
277  accessor<T, dimensions, Mode, Target, access::placeholder::false_t,
279  get_access(handler &CommandGroupHandler) {
280  return accessor<T, dimensions, Mode, Target, access::placeholder::false_t,
282  CommandGroupHandler);
283  }
284 
285  template <access::mode mode>
286  accessor<T, dimensions, mode, access::target::host_buffer,
287  access::placeholder::false_t, ext::oneapi::accessor_property_list<>>
289  return accessor<T, dimensions, mode, access::target::host_buffer,
290  access::placeholder::false_t,
292  }
293 
294  template <access::mode mode,
295  access::target target = access::target::global_buffer>
296  accessor<T, dimensions, mode, target, access::placeholder::false_t,
298  get_access(handler &commandGroupHandler, range<dimensions> accessRange,
299  id<dimensions> accessOffset = {}) {
300  return accessor<T, dimensions, mode, target, access::placeholder::false_t,
302  *this, commandGroupHandler, accessRange, accessOffset);
303  }
304 
305  template <access::mode mode>
306  accessor<T, dimensions, mode, access::target::host_buffer,
307  access::placeholder::false_t, ext::oneapi::accessor_property_list<>>
308  get_access(range<dimensions> accessRange, id<dimensions> accessOffset = {}) {
309  return accessor<T, dimensions, mode, access::target::host_buffer,
310  access::placeholder::false_t,
311  ext::oneapi::accessor_property_list<>>(*this, accessRange,
312  accessOffset);
313  }
314 
315 #if __cplusplus > 201402L
316 
317  template <typename... Ts> auto get_access(Ts... args) {
318  return accessor{*this, args...};
319  }
320 
321  template <typename... Ts>
322  auto get_access(handler &commandGroupHandler, Ts... args) {
323  return accessor{*this, commandGroupHandler, args...};
324  }
325 
326  template <typename... Ts> auto get_host_access(Ts... args) {
327  return host_accessor{*this, args...};
328  }
329 
330  template <typename... Ts>
331  auto get_host_access(handler &commandGroupHandler, Ts... args) {
332  return host_accessor{*this, commandGroupHandler, args...};
333  }
334 
335 #endif
336 
337  template <typename Destination = std::nullptr_t>
338  void set_final_data(Destination finalData = nullptr) {
339  impl->set_final_data(finalData);
340  }
341 
342  void set_write_back(bool flag = true) { impl->set_write_back(flag); }
343 
344  bool is_sub_buffer() const { return IsSubBuffer; }
345 
346  template <typename ReinterpretT, int ReinterpretDim>
348  reinterpret(range<ReinterpretDim> reinterpretRange) const {
349  if (sizeof(ReinterpretT) * reinterpretRange.size() != byte_size())
350  throw cl::sycl::invalid_object_error(
351  "Total size in bytes represented by the type and range of the "
352  "reinterpreted SYCL buffer does not equal the total size in bytes "
353  "represented by the type and range of this SYCL buffer",
355 
357  impl, reinterpretRange, OffsetInBytes, IsSubBuffer);
358  }
359 
360  template <typename ReinterpretT, int ReinterpretDim = dimensions>
361  typename std::enable_if<
362  (sizeof(ReinterpretT) == sizeof(T)) && (dimensions == ReinterpretDim),
364  reinterpret() const {
366  impl, get_range(), OffsetInBytes, IsSubBuffer);
367  }
368 
369  template <typename ReinterpretT, int ReinterpretDim = dimensions>
370  typename std::enable_if<
371  (ReinterpretDim == 1) && ((dimensions != ReinterpretDim) ||
372  (sizeof(ReinterpretT) != sizeof(T))),
374  reinterpret() const {
375  long sz = byte_size();
376  if (sz % sizeof(ReinterpretT) != 0)
377  throw cl::sycl::invalid_object_error(
378  "Total byte size of buffer is not evenly divisible by the size of "
379  "the reinterpreted type",
381 
383  impl, range<1>{sz / sizeof(ReinterpretT)}, OffsetInBytes, IsSubBuffer);
384  }
385 
386  template <typename propertyT> bool has_property() const {
387  return impl->template has_property<propertyT>();
388  }
389 
390  template <typename propertyT> propertyT get_property() const {
391  return impl->template get_property<propertyT>();
392  }
393 
394 private:
395  std::shared_ptr<detail::buffer_impl> impl;
396  template <class Obj>
397  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
398  template <typename A, int dims, typename C, typename Enable>
399  friend class buffer;
400  template <typename DataT, int dims, access::mode mode, access::target target,
401  access::placeholder isPlaceholder, typename PropertyListT>
402  friend class accessor;
403  range<dimensions> Range;
404  // Offset field specifies the origin of the sub buffer inside the parent
405  // buffer
406  size_t OffsetInBytes = 0;
407  bool IsSubBuffer = false;
408 
409  // Reinterpret contructor
410  buffer(std::shared_ptr<detail::buffer_impl> Impl,
411  range<dimensions> reinterpretRange, size_t reinterpretOffset,
412  bool isSubBuffer)
413  : impl(Impl), Range(reinterpretRange), OffsetInBytes(reinterpretOffset),
414  IsSubBuffer(isSubBuffer){};
415 
416  template <typename Type, int N>
417  size_t getOffsetInBytes(const id<N> &offset, const range<N> &range) {
418  return detail::getLinearIndex(offset, range) * sizeof(Type);
419  }
420 
421  bool isOutOfBounds(const id<dimensions> &offset,
422  const range<dimensions> &newRange,
423  const range<dimensions> &parentRange) {
424  bool outOfBounds = false;
425  for (int i = 0; i < dimensions; ++i)
426  outOfBounds |= newRange[i] + offset[i] > parentRange[i];
427 
428  return outOfBounds;
429  }
430 
431  bool isContiguousRegion(const id<1> &, const range<1> &, const range<1> &) {
432  // 1D sub buffer always has contiguous region
433  return true;
434  }
435 
436  bool isContiguousRegion(const id<2> &offset, const range<2> &newRange,
437  const range<2> &parentRange) {
438  // For 2D sub buffer there are 2 cases:
439  // 1) Offset {Any, Any} | a piece of any line of a buffer
440  // Range {1, Any} |
441  // 2) Offset {Any, 0 } | any number of full lines
442  // Range {Any, Col} |
443  // where Col is a number of columns of original buffer
444  if (offset[1])
445  return newRange[0] == 1;
446  return newRange[1] == parentRange[1];
447  }
448 
449  bool isContiguousRegion(const id<3> &offset, const range<3> &newRange,
450  const range<3> &parentRange) {
451  // For 3D sub buffer there are 3 cases:
452  // 1) Offset {Any, Any, Any} | a piece of any line in any slice of a buffer
453  // Range {1, 1, Any} |
454  // 2) Offset {Any, Any, 0 } | any number of full lines in any slice
455  // Range {1, Any, Col} |
456  // 3) Offset {Any, 0, 0 } | any number of slices
457  // Range {Any, Row, Col} |
458  // where Row and Col are numbers of rows and columns of original buffer
459  if (offset[2])
460  return newRange[0] == 1 && newRange[1] == 1;
461  if (offset[1])
462  return newRange[0] == 1 && newRange[2] == parentRange[2];
463  return newRange[1] == parentRange[1] && newRange[2] == parentRange[2];
464  }
465 };
466 
467 #ifdef __cpp_deduction_guides
468 template <class InputIterator, class AllocatorT>
469 buffer(InputIterator, InputIterator, AllocatorT, const property_list & = {})
470  -> buffer<typename std::iterator_traits<InputIterator>::value_type, 1,
471  AllocatorT>;
472 template <class InputIterator>
473 buffer(InputIterator, InputIterator, const property_list & = {})
474  -> buffer<typename std::iterator_traits<InputIterator>::value_type, 1>;
475 template <class Container, class AllocatorT>
476 buffer(Container &, AllocatorT, const property_list & = {})
477  -> buffer<typename Container::value_type, 1, AllocatorT>;
478 template <class Container>
479 buffer(Container &, const property_list & = {})
480  -> buffer<typename Container::value_type, 1>;
481 template <class T, int dimensions, class AllocatorT>
482 buffer(const T *, const range<dimensions> &, AllocatorT,
483  const property_list & = {}) -> buffer<T, dimensions, AllocatorT>;
484 template <class T, int dimensions>
485 buffer(const T *, const range<dimensions> &, const property_list & = {})
486  -> buffer<T, dimensions>;
487 #endif // __cpp_deduction_guides
488 
489 } // namespace sycl
490 } // __SYCL_INLINE_NAMESPACE(cl)
491 
492 namespace std {
493 template <typename T, int dimensions, typename AllocatorT>
494 struct hash<cl::sycl::buffer<T, dimensions, AllocatorT>> {
495  size_t
497  return hash<std::shared_ptr<cl::sycl::detail::buffer_impl>>()(
499  }
500 };
501 } // namespace std
property_list.hpp
cl::sycl::buffer::buffer
buffer(const std::shared_ptr< T[]> &hostData, const range< dimensions > &bufferRange, AllocatorT allocator, const property_list &propList={})
Definition: buffer.hpp:132
cl::sycl::buffer::buffer
buffer(const range< dimensions > &bufferRange, AllocatorT allocator, const property_list &propList={})
Definition: buffer.hpp:70
cl::sycl::detail::aligned_allocator
Definition: aligned_allocator.hpp:23
cl::sycl::buffer::get_access
accessor< T, dimensions, mode, access::target::host_buffer, access::placeholder::false_t, ext::oneapi::accessor_property_list<> > get_access(range< dimensions > accessRange, id< dimensions > accessOffset={})
Definition: buffer.hpp:308
type
cl::sycl::detail::getLinearIndex
size_t getLinearIndex(const T< Dims > &Index, const U< Dims > &Range)
Definition: common.hpp:295
cl::sycl::buffer::buffer
buffer(const range< dimensions > &bufferRange, const property_list &propList={})
Definition: buffer.hpp:62
cl::sycl::distance
float distance(T p0, T p1) __NOEXC
Definition: builtins.hpp:996
cl::sycl::event
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Definition: event.hpp:31
__SYCL2020_DEPRECATED
#define __SYCL2020_DEPRECATED(message)
Definition: defines_elementary.hpp:54
cl::sycl::access::placeholder
placeholder
Definition: access.hpp:43
stl.hpp
cl::sycl::buffer::buffer
buffer(buffer< T, dimensions, AllocatorT > &b, const id< dimensions > &baseIndex, const range< dimensions > &subRange)
Definition: buffer.hpp:209
cl::sycl::id
A unique identifier of an item in an index space.
Definition: array.hpp:17
cl::sycl::buffer::buffer
buffer(const std::shared_ptr< T[]> &hostData, const range< dimensions > &bufferRange, const property_list &propList={})
Definition: buffer.hpp:153
cl::sycl::buffer::get_access
accessor< T, dimensions, mode, access::target::host_buffer, access::placeholder::false_t, ext::oneapi::accessor_property_list<> > get_access()
Definition: buffer.hpp:288
cl::sycl::buffer::get_range
range< dimensions > get_range() const
Definition: buffer.hpp:260
cl::sycl::buffer::get_access
accessor< T, dimensions, Mode, Target, access::placeholder::false_t, ext::oneapi::accessor_property_list<> > get_access(handler &CommandGroupHandler)
Definition: buffer.hpp:279
cl::sycl::buffer::byte_size
size_t byte_size() const noexcept
Definition: buffer.hpp:269
cl::sycl::buffer::buffer
buffer(T *hostData, const range< dimensions > &bufferRange, AllocatorT allocator, const property_list &propList={})
Definition: buffer.hpp:88
cl::sycl::detail::remove_pointer_t
typename remove_pointer< T >::type remove_pointer_t
Definition: type_traits.hpp:278
cl::sycl::detail::void_t
void void_t
Definition: stl_type_traits.hpp:42
cl::sycl::buffer::operator!=
bool operator!=(const buffer &rhs) const
Definition: buffer.hpp:254
cl::sycl::buffer::operator==
bool operator==(const buffer &rhs) const
Definition: buffer.hpp:252
cl::sycl::property_list
Objects of the property_list class are containers for the SYCL properties.
Definition: property_list.hpp:25
cl::sycl::buffer::reinterpret
std::enable_if<(sizeof(ReinterpretT)==sizeof(T)) &&(dimensions==ReinterpretDim), buffer< ReinterpretT, ReinterpretDim, AllocatorT > >::type reinterpret() const
Definition: buffer.hpp:364
cl::sycl::buffer
Defines a shared array that can be used by kernels in queues.
Definition: buffer.hpp:38
cl::sycl::info::queue
queue
Definition: info_desc.hpp:212
cl::sycl::range
Defines the iteration domain of either a single work-group in a parallel dispatch,...
Definition: buffer.hpp:24
cl::sycl::buffer< char, 1 >::EnableIfItInputIterator
detail::enable_if_t< std::is_convertible< typename std::iterator_traits< It >::iterator_category, std::input_iterator_tag >::value > EnableIfItInputIterator
Definition: buffer.hpp:57
cl::sycl::buffer::get_allocator
AllocatorT get_allocator() const
Definition: buffer.hpp:271
stl_type_traits.hpp
cl::sycl::range::size
size_t size() const
Definition: range.hpp:50
cl::sycl::buffer::buffer
buffer(T *hostData, const range< dimensions > &bufferRange, const property_list &propList={})
Definition: buffer.hpp:79
char
cl::sycl::buffer< char, 1 >::EnableIfOneDimension
typename detail::enable_if_t< 1==dims > EnableIfOneDimension
Definition: buffer.hpp:45
cl::sycl::buffer::buffer
buffer(const std::shared_ptr< T > &hostData, const range< dimensions > &bufferRange, AllocatorT allocator, const property_list &propList={})
Definition: buffer.hpp:121
cl::sycl::buffer< char, 1 >::EnableIfSameNonConstIterators
typename detail::enable_if_t< std::is_same< ItA, ItB >::value &&!std::is_const< ItA >::value, ItA > EnableIfSameNonConstIterators
Definition: buffer.hpp:60
cl::sycl::buffer::has_property
bool has_property() const
Definition: buffer.hpp:386
cl::sycl::accessor
Buffer accessor.
Definition: accessor.hpp:225
cl::sycl::access::target
target
Definition: access.hpp:17
cl::sycl::buffer::reinterpret
buffer< ReinterpretT, ReinterpretDim, AllocatorT > reinterpret(range< ReinterpretDim > reinterpretRange) const
Definition: buffer.hpp:348
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::buffer::is_sub_buffer
bool is_sub_buffer() const
Definition: buffer.hpp:344
cl::sycl::detail::getNextPowerOfTwo
constexpr size_t getNextPowerOfTwo(size_t Var)
Definition: common.hpp:289
cl::sycl::handler
Command group handler class.
Definition: handler.hpp:364
std::hash< cl::sycl::buffer< T, dimensions, AllocatorT > >::operator()
size_t operator()(const cl::sycl::buffer< T, dimensions, AllocatorT > &b) const
Definition: buffer.hpp:496
cl::sycl::ext::oneapi::accessor_property_list
Objects of the accessor_property_list class are containers for the SYCL properties.
Definition: property_list.hpp:18
cl::sycl::buffer::buffer
buffer(Container &container, const property_list &propList={})
Definition: buffer.hpp:206
cl::sycl::buffer::buffer
buffer(InputIterator first, InputIterator last, AllocatorT allocator, const property_list &propList={})
Definition: buffer.hpp:166
cl::sycl::buffer::buffer
buffer(const std::shared_ptr< T > &hostData, const range< dimensions > &bufferRange, const property_list &propList={})
Definition: buffer.hpp:143
PI_INVALID_VALUE
@ PI_INVALID_VALUE
Definition: pi.h:87
cl::sycl::buffer::buffer
buffer(Container &container, AllocatorT allocator, const property_list &propList={})
Definition: buffer.hpp:192
cl::sycl::detail::getSyclObjImpl
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
Definition: common.hpp:163
exception.hpp
std
Definition: accessor.hpp:2356
cl::sycl::buffer::size
size_t size() const noexcept
Definition: buffer.hpp:264
cl::sycl::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:35
cl::sycl::buffer::set_final_data
void set_final_data(Destination finalData=nullptr)
Definition: buffer.hpp:338
cl::sycl::detail::SYCLMemObjAllocatorHolder
Definition: sycl_mem_obj_allocator.hpp:35
accessor_property_list.hpp
common.hpp
cl::sycl::buffer::get_access
accessor< T, dimensions, mode, target, access::placeholder::false_t, ext::oneapi::accessor_property_list<> > get_access(handler &commandGroupHandler, range< dimensions > accessRange, id< dimensions > accessOffset={})
Definition: buffer.hpp:298
cl::sycl::access::mode
mode
Definition: access.hpp:28
cl::sycl::buffer::buffer
buffer(EnableIfSameNonConstIterators< T, _T > const *hostData, const range< dimensions > &bufferRange, const property_list &propList={})
Definition: buffer.hpp:99
cl::sycl::buffer::get_property
propertyT get_property() const
Definition: buffer.hpp:390
cl::sycl::buffer::buffer
buffer(EnableIfSameNonConstIterators< T, _T > const *hostData, const range< dimensions > &bufferRange, AllocatorT allocator, const property_list &propList={})
Definition: buffer.hpp:110
cl::sycl::buffer::reinterpret
std::enable_if<(ReinterpretDim==1) &&((dimensions !=ReinterpretDim)||(sizeof(ReinterpretT) !=sizeof(T))), buffer< ReinterpretT, ReinterpretDim, AllocatorT > >::type reinterpret() const
Definition: buffer.hpp:374
cl::sycl::buffer::__SYCL2020_DEPRECATED
__SYCL2020_DEPRECATED("get_size() is deprecated, please use byte_size() instead") size_t get_size() const
Definition: buffer.hpp:266
cl::sycl::detail::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition: stl_type_traits.hpp:24
cl::sycl::buffer::__SYCL2020_DEPRECATED
__SYCL2020_DEPRECATED("get_count() is deprecated, please use size() instead") size_t get_count() const
Definition: buffer.hpp:262
cl::sycl::buffer::buffer
buffer(InputIterator first, InputIterator last, const property_list &propList={})
Definition: buffer.hpp:179
cl::sycl::buffer_allocator
detail::sycl_memory_object_allocator buffer_allocator
Definition: buffer_impl.hpp:38
cl::sycl::buffer< char, 1 >::EnableIfContiguous
detail::void_t< detail::enable_if_t< std::is_convertible< detail::remove_pointer_t< decltype(std::declval< Container >().data())>(*)[], const char(*)[]>::value >, decltype(std::declval< Container >().size())> EnableIfContiguous
Definition: buffer.hpp:53
cl::sycl::make_unique_ptr
std::unique_ptr< T > make_unique_ptr(ArgsT &&... Args)
Definition: stl.hpp:51
cl::sycl::buffer::set_write_back
void set_write_back(bool flag=true)
Definition: buffer.hpp:342
cl::sycl::errc::accessor
@ accessor
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12
buffer_impl.hpp