DPC++ Runtime
Runtime libraries for oneAPI DPC++
image.hpp
Go to the documentation of this file.
1 //==------------ image.hpp -------------------------------------------------==//
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/access/access.hpp> // for placeholder
12 #include <sycl/aliases.hpp> // for cl_float, cl_half
13 #include <sycl/backend_types.hpp> // for backend, backe...
14 #include <sycl/buffer.hpp> // for range
15 #include <sycl/context.hpp> // for context
16 #include <sycl/detail/aligned_allocator.hpp> // for aligned_allocator
17 #include <sycl/detail/backend_traits.hpp> // for InteropFeature...
18 #include <sycl/detail/common.hpp> // for convertToArrayOfN
19 #include <sycl/detail/defines_elementary.hpp> // for __SYCL2020_DEP...
20 #include <sycl/detail/export.hpp> // for __SYCL_EXPORT
21 #include <sycl/detail/impl_utils.hpp> // for getSyclObjImpl
22 #include <sycl/detail/owner_less_base.hpp> // for OwnerLessBase
23 #include <sycl/detail/pi.h> // for pi_native_handle
24 #include <sycl/detail/stl_type_traits.hpp> // for iterator_value...
25 #include <sycl/detail/sycl_mem_obj_allocator.hpp> // for SYCLMemObjAllo...
26 #include <sycl/detail/type_list.hpp> // for is_contained
27 #include <sycl/event.hpp> // for event
28 #include <sycl/exception.hpp> // for make_error_code
29 #include <sycl/ext/oneapi/accessor_property_list.hpp> // for accessor_prope...
30 #include <sycl/property_list.hpp> // for property_list
31 #include <sycl/range.hpp> // for range, rangeTo...
32 #include <sycl/sampler.hpp> // for image_sampler
33 #include <sycl/stl.hpp> // for make_unique_ptr
34 #include <sycl/types.hpp> // for vec
35 
36 #include <cstddef> // for size_t, nullptr_t
37 #include <functional> // for function
38 #include <memory> // for shared_ptr
39 #include <stdint.h> // for uint8_t, uint32_t
40 #include <type_traits> // for enable_if_t
41 #include <variant> // for hash
42 
43 namespace sycl {
44 inline namespace _V1 {
45 
46 // forward declarations
47 class handler;
48 
49 template <int D, typename A> class image;
50 
51 // 'friend'
52 template <backend Backend, int D, typename A>
53 std::enable_if_t<Backend == backend::ext_oneapi_level_zero, image<D, A>>
54 make_image(const backend_input_t<Backend, image<D, A>> &BackendObject,
55  const context &TargetContext, event AvailableEvent = {});
56 
57 enum class image_channel_order : unsigned int {
58  a = 0,
59  r = 1,
60  rx = 2,
61  rg = 3,
62  rgx = 4,
63  ra = 5,
64  rgb = 6,
65  rgbx = 7,
66  rgba = 8,
67  argb = 9,
68  bgra = 10,
69  intensity = 11,
70  luminance = 12,
71  abgr = 13,
72  ext_oneapi_srgba = 14 // OpenCL 2.0
73 };
74 
75 enum class image_channel_type : unsigned int {
76  snorm_int8 = 0,
77  snorm_int16 = 1,
78  unorm_int8 = 2,
79  unorm_int16 = 3,
80  unorm_short_565 = 4,
81  unorm_short_555 = 5,
82  unorm_int_101010 = 6,
83  signed_int8 = 7,
84  signed_int16 = 8,
85  signed_int32 = 9,
86  unsigned_int8 = 10,
87  unsigned_int16 = 11,
88  unsigned_int32 = 12,
89  fp16 = 13,
90  fp32 = 14
91 };
92 
93 // SYCL 2020 image_format
94 enum class image_format : unsigned int {
95  r8g8b8a8_unorm = 0,
97  r8g8b8a8_sint = 2,
100  r8g8b8a8_uint = 5,
101  r16g16b16a16_uint = 6,
102  r32b32g32a32_uint = 7,
105  b8g8r8a8_unorm = 10
106 };
107 
108 using byte = unsigned char;
109 
110 using image_allocator = detail::aligned_allocator<byte>;
111 
112 namespace detail {
113 
114 class image_impl;
115 
116 // validImageDataT: cl_int4, cl_uint4, cl_float4, cl_half4
117 template <typename T>
121 
122 template <typename DataT>
124  typename std::enable_if_t<is_validImageDataT<DataT>::value, DataT>;
125 
127  switch (Format) {
149  }
150  throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
151  "Unrecognized channel type.");
152 }
153 
155  switch (Format) {
169  }
170  throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
171  "Unrecognized channel order.");
172 }
173 
174 // The non-template base for the sycl::image class
175 class __SYCL_EXPORT image_plain {
176 protected:
177  image_plain(const std::shared_ptr<detail::image_impl> &Impl) : impl{Impl} {}
178 
180  const range<3> &Range,
181  std::unique_ptr<SYCLMemObjAllocator> Allocator,
182  uint8_t Dimensions, const property_list &PropList);
183 
185  const range<3> &Range, const range<2> &Pitch,
186  std::unique_ptr<SYCLMemObjAllocator> Allocator,
187  uint8_t Dimensions, const property_list &PropList);
188 
189  image_plain(void *HostPointer, image_channel_order Order,
190  image_channel_type Type, const range<3> &Range,
191  std::unique_ptr<SYCLMemObjAllocator> Allocator,
192  uint8_t Dimensions, const property_list &PropList);
193 
194  image_plain(const void *HostPointer, image_channel_order Order,
195  image_channel_type Type, const range<3> &Range,
196  std::unique_ptr<SYCLMemObjAllocator> Allocator,
197  uint8_t Dimensions, const property_list &PropList);
198 
199  image_plain(void *HostPointer, image_channel_order Order,
200  image_channel_type Type, const range<3> &Range,
201  const range<2> &Pitch,
202  std::unique_ptr<SYCLMemObjAllocator> Allocator,
203  uint8_t Dimensions, const property_list &PropList);
204 
205  image_plain(const std::shared_ptr<const void> &HostPointer,
207  const range<3> &Range,
208  std::unique_ptr<SYCLMemObjAllocator> Allocator,
209  uint8_t Dimensions, const property_list &PropList,
210  bool IsConstPtr);
211 
212  image_plain(const std::shared_ptr<const void> &HostPointer,
214  const range<3> &Range, const range<2> &Pitch,
215  std::unique_ptr<SYCLMemObjAllocator> Allocator,
216  uint8_t Dimensions, const property_list &PropList,
217  bool IsConstPtr);
218 
219  image_plain(const void *HostPointer, image_channel_order Order,
220  image_channel_type Type, image_sampler Sampler,
221  const range<3> &Range,
222  std::unique_ptr<SYCLMemObjAllocator> Allocator,
223  uint8_t Dimensions, const property_list &PropList);
224 
225  image_plain(const void *HostPointer, image_channel_order Order,
226  image_channel_type Type, image_sampler Sampler,
227  const range<3> &Range, const range<2> &Pitch,
228  std::unique_ptr<SYCLMemObjAllocator> Allocator,
229  uint8_t Dimensions, const property_list &PropList);
230 
231  image_plain(const std::shared_ptr<const void> &HostPointer,
233  image_sampler Sampler, const range<3> &Range,
234  std::unique_ptr<SYCLMemObjAllocator> Allocator,
235  uint8_t Dimensions, const property_list &PropList);
236 
237  image_plain(const std::shared_ptr<const void> &HostPointer,
239  image_sampler Sampler, const range<3> &Range,
240  const range<2> &Pitch,
241  std::unique_ptr<SYCLMemObjAllocator> Allocator,
242  uint8_t Dimensions, const property_list &PropList);
243 
244 #ifdef __SYCL_INTERNAL_API
245  image_plain(cl_mem ClMemObject, const context &SyclContext,
246  event AvailableEvent,
247  std::unique_ptr<SYCLMemObjAllocator> Allocator,
248  uint8_t Dimensions);
249 #endif
250 
251  image_plain(pi_native_handle MemObject, const context &SyclContext,
252  event AvailableEvent,
253  std::unique_ptr<SYCLMemObjAllocator> Allocator,
254  uint8_t Dimensions, image_channel_order Order,
255  image_channel_type Type, bool OwnNativeHandle,
256  range<3> Range3WithOnes);
257 
258  template <typename propertyT> bool has_property() const noexcept;
259 
260  template <typename propertyT> propertyT get_property() const;
261 
262  range<3> get_range() const;
263 
264  range<2> get_pitch() const;
265 
266  size_t get_size() const noexcept;
267 
268  size_t get_count() const noexcept;
269 
270  void set_final_data_internal();
271 
272  void set_final_data_internal(
273  const std::function<void(const std::function<void(void *const Ptr)> &)>
274  &FinalDataFunc);
275 
276  void set_write_back(bool flag);
277 
278  const std::unique_ptr<SYCLMemObjAllocator> &get_allocator_internal() const;
279 
280  size_t getElementSize() const;
281 
282  size_t getRowPitch() const;
283 
284  size_t getSlicePitch() const;
285 
286  image_sampler getSampler() const noexcept;
287 
288  image_channel_order getChannelOrder() const;
289 
290  image_channel_type getChannelType() const;
291 
292  void sampledImageConstructorNotification(const detail::code_location &CodeLoc,
293  void *UserObj, const void *HostObj,
294  uint32_t Dim, size_t Range[3],
295  image_format Format,
296  const image_sampler &Sampler);
297  void sampledImageDestructorNotification(void *UserObj);
298 
300  const detail::code_location &CodeLoc, void *UserObj, const void *HostObj,
301  uint32_t Dim, size_t Range[3], image_format Format);
302  void unsampledImageDestructorNotification(void *UserObj);
303 
304  std::shared_ptr<detail::image_impl> impl;
305 };
306 
307 // Common base class for image implementations
308 template <int Dimensions, typename AllocatorT>
309 class image_common : public image_plain {
310 protected:
311  // Use the same ctors as image_plain.
313 
314 public:
315  /* -- property interface members -- */
316  template <typename propertyT> bool has_property() const noexcept {
317  return image_plain::template has_property<propertyT>();
318  }
319 
320  template <typename propertyT> propertyT get_property() const {
321  return image_plain::get_property<propertyT>();
322  }
323 
325  return detail::convertToArrayOfN<Dimensions, 0>(image_plain::get_range());
326  }
327 
328  /* Available only when: dimensions >1 */
329  template <bool IsMultiDim = (Dimensions > 1)>
330  typename std::enable_if_t<IsMultiDim, range<Dimensions - 1>>
331  get_pitch() const {
332  return detail::convertToArrayOfN<Dimensions - 1, 0>(
334  }
335 
336  size_t size() const noexcept { return image_plain::get_count(); }
337 
338  // Returns the allocator provided to the image
339  AllocatorT get_allocator() const {
341  ->template getAllocator<AllocatorT>();
342  }
343 };
344 
345 // Common base class for unsampled image implementations
346 template <int Dimensions, typename AllocatorT>
347 class unsampled_image_common : public image_common<Dimensions, AllocatorT> {
348 private:
349  using common_base = typename detail::image_common<Dimensions, AllocatorT>;
350 
351 protected:
352  // Use the same ctors as image_plain.
353  using common_base::image_common;
354 
355 public:
356  template <typename Destination = std::nullptr_t>
357  void set_final_data(Destination finalData = nullptr) {
358  this->set_final_data_internal(finalData);
359  }
360 
361  void set_write_back(bool flag = true) { common_base::set_write_back(flag); }
362 
363 private:
364  void set_final_data_internal(std::nullptr_t) {
365  common_base::set_final_data_internal();
366  }
367 
368  template <template <typename WeakT> class WeakPtrT, typename WeakT>
369  std::enable_if_t<
370  std::is_convertible<WeakPtrT<WeakT>, std::weak_ptr<WeakT>>::value>
371  set_final_data_internal(WeakPtrT<WeakT> FinalData) {
372  std::weak_ptr<WeakT> TempFinalData(FinalData);
373  this->set_final_data_internal(TempFinalData);
374  }
375 
376  template <typename WeakT>
377  void set_final_data_internal(std::weak_ptr<WeakT> FinalData) {
378  common_base::set_final_data_internal(
379  [FinalData](const std::function<void(void *const Ptr)> &F) {
380  if (std::shared_ptr<WeakT> LockedFinalData = FinalData.lock())
381  F(LockedFinalData.get());
382  });
383  }
384 
385  template <typename Destination>
386  detail::EnableIfOutputPointerT<Destination>
387  set_final_data_internal(Destination FinalData) {
388  if (!FinalData)
389  common_base::set_final_data_internal();
390  else
391  common_base::set_final_data_internal(
392  [FinalData](const std::function<void(void *const Ptr)> &F) {
393  F(FinalData);
394  });
395  }
396 
397  template <typename Destination>
398  detail::EnableIfOutputIteratorT<Destination>
399  set_final_data_internal(Destination FinalData) {
400  const size_t Size = common_base::size();
401  common_base::set_final_data_internal(
402  [FinalData, Size](const std::function<void(void *const Ptr)> &F) {
403  using DestinationValueT = detail::iterator_value_type_t<Destination>;
404  // TODO if Destination is ContiguousIterator then don't create
405  // ContiguousStorage. updateHostMemory works only with pointer to
406  // continuous data.
407  std::unique_ptr<DestinationValueT[]> ContiguousStorage(
408  new DestinationValueT[Size]);
409  F(ContiguousStorage.get());
410  std::copy(ContiguousStorage.get(), ContiguousStorage.get() + Size,
411  FinalData);
412  });
413  }
414 };
415 
416 template <typename DataT, int Dims, access::mode AccMode,
418 class image_accessor;
419 
420 } // namespace detail
421 
422 template <typename DataT, int Dimensions, access_mode AccessMode,
423  image_target AccessTarget>
424 class unsampled_image_accessor;
425 
426 template <typename DataT, int Dimensions, access_mode AccessMode>
427 class host_unsampled_image_accessor;
428 
429 template <typename DataT, int Dimensions, image_target AccessTarget>
430 class sampled_image_accessor;
431 
432 template <typename DataT, int Dimensions> class host_sampled_image_accessor;
433 
443 template <int Dimensions = 1, typename AllocatorT = sycl::image_allocator>
444 class image : public detail::unsampled_image_common<Dimensions, AllocatorT> {
445 private:
446  using common_base =
448 
449 public:
451  const range<Dimensions> &Range, const property_list &PropList = {})
452  : common_base(Order, Type, detail::convertToArrayOfN<3, 1>(Range),
455  Dimensions, PropList) {}
456 
458  const range<Dimensions> &Range, AllocatorT Allocator,
459  const property_list &PropList = {})
460  : common_base(
461  Order, Type, detail::convertToArrayOfN<3, 1>(Range),
464  Dimensions, PropList) {}
465 
466  /* Available only when: dimensions >1 */
467  template <bool B = (Dimensions > 1)>
469  const range<Dimensions> &Range,
470  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
471  const property_list &PropList = {})
472  : common_base(Order, Type, detail::convertToArrayOfN<3, 1>(Range),
473  detail::convertToArrayOfN<2, 0>(Pitch),
476  Dimensions, PropList) {}
477 
478  /* Available only when: dimensions >1 */
479  template <bool B = (Dimensions > 1)>
481  const range<Dimensions> &Range,
482  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
483  AllocatorT Allocator, const property_list &PropList = {})
484  : common_base(
485  Order, Type, detail::convertToArrayOfN<3, 1>(Range),
486  detail::convertToArrayOfN<2, 0>(Pitch),
489  Dimensions, PropList) {}
490 
491  image(void *HostPointer, image_channel_order Order, image_channel_type Type,
492  const range<Dimensions> &Range, const property_list &PropList = {})
493  : common_base(HostPointer, Order, Type,
494  detail::convertToArrayOfN<3, 1>(Range),
497  Dimensions, PropList) {}
498 
499  image(void *HostPointer, image_channel_order Order, image_channel_type Type,
500  const range<Dimensions> &Range, AllocatorT Allocator,
501  const property_list &PropList = {})
502  : common_base(
503  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
506  Dimensions, PropList) {}
507 
508  image(const void *HostPointer, image_channel_order Order,
509  image_channel_type Type, const range<Dimensions> &Range,
510  const property_list &PropList = {})
511  : common_base(HostPointer, Order, Type,
512  detail::convertToArrayOfN<3, 1>(Range),
515  Dimensions, PropList) {}
516 
517  image(const void *HostPointer, image_channel_order Order,
518  image_channel_type Type, const range<Dimensions> &Range,
519  AllocatorT Allocator, const property_list &PropList = {})
520  : common_base(
521  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
524  Dimensions, PropList) {}
525 
526  /* Available only when: dimensions >1 */
527  template <bool B = (Dimensions > 1)>
528  image(void *HostPointer, image_channel_order Order, image_channel_type Type,
529  const range<Dimensions> &Range,
530  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
531  const property_list &PropList = {})
532  : common_base(HostPointer, Order, Type,
533  detail::convertToArrayOfN<3, 1>(Range),
534  detail::convertToArrayOfN<2, 0>(Pitch),
537  Dimensions, PropList) {}
538 
539  /* Available only when: dimensions >1 */
540  template <bool B = (Dimensions > 1)>
541  image(void *HostPointer, image_channel_order Order, image_channel_type Type,
542  const range<Dimensions> &Range,
543  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
544  AllocatorT Allocator, const property_list &PropList = {})
545  : common_base(
546  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
547  detail::convertToArrayOfN<2, 0>(Pitch),
550  Dimensions, PropList) {}
551 
552  image(std::shared_ptr<void> &HostPointer, image_channel_order Order,
553  image_channel_type Type, const range<Dimensions> &Range,
554  const property_list &PropList = {})
555  : common_base(HostPointer, Order, Type,
556  detail::convertToArrayOfN<3, 1>(Range),
559  Dimensions, PropList, /*IsConstPtr*/ false) {}
560 
561  image(std::shared_ptr<void> &HostPointer, image_channel_order Order,
562  image_channel_type Type, const range<Dimensions> &Range,
563  AllocatorT Allocator, const property_list &PropList = {})
564  : common_base(
565  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
568  Dimensions, PropList, /*IsConstPtr*/ false) {}
569 
570  /* Available only when: dimensions >1 */
571  template <bool B = (Dimensions > 1)>
572  image(std::shared_ptr<void> &HostPointer, image_channel_order Order,
573  image_channel_type Type, const range<Dimensions> &Range,
574  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
575  const property_list &PropList = {})
576  : common_base(HostPointer, Order, Type,
577  detail::convertToArrayOfN<3, 1>(Range),
578  detail::convertToArrayOfN<2, 0>(Pitch),
581  Dimensions, PropList, /*IsConstPtr*/ false) {}
582 
583  /* Available only when: dimensions >1 */
584  template <bool B = (Dimensions > 1)>
585  image(std::shared_ptr<void> &HostPointer, image_channel_order Order,
586  image_channel_type Type, const range<Dimensions> &Range,
587  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
588  AllocatorT Allocator, const property_list &PropList = {})
589  : common_base(
590  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
591  detail::convertToArrayOfN<2, 0>(Pitch),
594  Dimensions, PropList, /*IsConstPtr*/ false) {}
595 
596 #ifdef __SYCL_INTERNAL_API
597  image(cl_mem ClMemObject, const context &SyclContext,
598  event AvailableEvent = {})
599  : common_base(ClMemObject, SyclContext, AvailableEvent,
601  detail::SYCLMemObjAllocatorHolder<AllocatorT, byte>>(),
602  Dimensions) {}
603 #endif
604 
605  /* -- common interface members -- */
606 
607  image(const image &rhs) = default;
608 
609  image(image &&rhs) = default;
610 
611  image &operator=(const image &rhs) = default;
612 
613  image &operator=(image &&rhs) = default;
614 
615  ~image() = default;
616 
617  bool operator==(const image &rhs) const { return this->impl == rhs.impl; }
618 
619  bool operator!=(const image &rhs) const { return !(*this == rhs); }
620 
621  /* -- property interface members -- */
622  template <typename propertyT> bool has_property() const noexcept {
623  return common_base::template has_property<propertyT>();
624  }
625 
626  template <typename propertyT> propertyT get_property() const {
627  return common_base::template get_property<propertyT>();
628  }
629 
631  return detail::convertToArrayOfN<Dimensions, 0>(common_base::get_range());
632  }
633 
634  /* Available only when: dimensions >1 */
635  template <bool B = (Dimensions > 1)>
636  typename std::enable_if_t<B, range<Dimensions - 1>> get_pitch() const {
637  return detail::convertToArrayOfN<Dimensions - 1, 0>(
639  }
640 
641  // Returns the size of the image storage in bytes
642  size_t get_size() const { return common_base::get_size(); }
643 
644  // Returns the total number of elements in the image
645  __SYCL2020_DEPRECATED("get_count() is deprecated, please use size() instead")
646  size_t get_count() const { return common_base::size(); }
647 
648  template <typename DataT, access::mode AccessMode>
652  get_access(handler &commandGroupHandler) {
656  commandGroupHandler);
657  }
658 
659  template <typename DataT, access::mode AccessMode>
667  }
668 
669 private:
670  image(pi_native_handle MemObject, const context &SyclContext,
671  event AvailableEvent, image_channel_order Order,
672  image_channel_type Type, bool OwnNativeHandle, range<Dimensions> Range)
673  : common_base(MemObject, SyclContext, AvailableEvent,
675  detail::SYCLMemObjAllocatorHolder<AllocatorT, byte>>(),
676  Dimensions, Order, Type, OwnNativeHandle,
677  detail::convertToArrayOfN<3, 1>(Range)) {}
678 
679  // This utility api is currently used by accessor to get the element size of
680  // the image. Element size is dependent on num of channels and channel type.
681  // This information is not accessible from the image using any public API.
682  size_t getElementSize() const { return common_base::getElementSize(); }
683 
684  size_t getRowPitch() const { return common_base::getRowPitch(); }
685 
686  size_t getSlicePitch() const { return common_base::getSlicePitch(); }
687 
688  image_channel_order getChannelOrder() const {
689  return common_base::getChannelOrder();
690  }
691 
692  image_channel_type getChannelType() const {
693  return common_base::getChannelType();
694  }
695 
696  // Declare make_image as a friend function
697  template <backend Backend, int D, typename A>
698  friend std::enable_if_t<
701  image<D, A>>
703  const typename backend_traits<Backend>::template input_type<image<D, A>>
704  &BackendObject,
705  const context &TargetContext, event AvailableEvent);
706 
707  template <backend Backend, int D, typename A>
708  friend std::enable_if_t<Backend == backend::ext_oneapi_level_zero,
709  image<D, A>>
710  make_image(const backend_input_t<Backend, image<D, A>> &BackendObject,
711  const context &TargetContext, event AvailableEvent);
712 
713  template <class Obj>
714  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
715 
716  template <typename DataT, int Dims, access::mode AccMode,
718  typename PropertyListT>
719  friend class accessor;
720 
721  template <typename DataT, int Dims, access::mode AccMode,
724 };
725 
726 template <int Dimensions = 1, typename AllocatorT = sycl::image_allocator>
728  : public detail::unsampled_image_common<Dimensions, AllocatorT>,
729  public detail::OwnerLessBase<unsampled_image<Dimensions, AllocatorT>> {
730 private:
731  using common_base =
733 
734  unsampled_image(const std::shared_ptr<detail::image_impl> &Impl)
735  : common_base{Impl} {}
736 
737 public:
739  image_format Format, const range<Dimensions> &Range,
740  const property_list &PropList = {},
742  : common_base(detail::FormatChannelOrder(Format),
744  detail::convertToArrayOfN<3, 1>(Range),
747  Dimensions, PropList) {
749  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
750  detail::rangeToArray(Range).data(), Format);
751  }
752 
754  image_format Format, const range<Dimensions> &Range, AllocatorT Allocator,
755  const property_list &PropList = {},
757  : common_base(
760  detail::convertToArrayOfN<3, 1>(Range),
763  Dimensions, PropList) {
765  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
766  detail::rangeToArray(Range).data(), Format);
767  }
768 
769  template <bool IsMultiDim = (Dimensions > 1),
770  typename = std::enable_if_t<IsMultiDim>>
772  image_format Format, const range<Dimensions> &Range,
773  const range<Dimensions - 1> &Pitch, const property_list &PropList = {},
775  : common_base(detail::FormatChannelOrder(Format),
777  detail::convertToArrayOfN<3, 1>(Range),
778  detail::convertToArrayOfN<2, 0>(Pitch),
781  Dimensions, PropList) {
783  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
784  detail::rangeToArray(Range).data(), Format);
785  }
786 
787  template <bool IsMultiDim = (Dimensions > 1),
788  typename = std::enable_if_t<IsMultiDim>>
790  image_format Format, const range<Dimensions> &Range,
791  const range<Dimensions - 1> &Pitch, AllocatorT Allocator,
792  const property_list &PropList = {},
794  : common_base(
797  detail::convertToArrayOfN<3, 1>(Range),
798  detail::convertToArrayOfN<2, 0>(Pitch),
801  Dimensions, PropList) {
803  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
804  detail::rangeToArray(Range).data(), Format);
805  }
806 
808  void *HostPointer, image_format Format, const range<Dimensions> &Range,
809  const property_list &PropList = {},
811  : common_base(HostPointer, detail::FormatChannelOrder(Format),
813  detail::convertToArrayOfN<3, 1>(Range),
816  Dimensions, PropList) {
818  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
819  detail::rangeToArray(Range).data(), Format);
820  }
821 
823  void *HostPointer, image_format Format, const range<Dimensions> &Range,
824  AllocatorT Allocator, const property_list &PropList = {},
826  : common_base(
827  HostPointer, detail::FormatChannelOrder(Format),
829  detail::convertToArrayOfN<3, 1>(Range),
832  Dimensions, PropList) {
834  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
835  detail::rangeToArray(Range).data(), Format);
836  }
837 
838  template <bool IsMultiDim = (Dimensions > 1),
839  typename = std::enable_if_t<IsMultiDim>>
841  void *HostPointer, image_format Format, const range<Dimensions> &Range,
842  const range<Dimensions - 1> &Pitch, const property_list &PropList = {},
844  : common_base(HostPointer, detail::FormatChannelOrder(Format),
846  detail::convertToArrayOfN<3, 1>(Range),
847  detail::convertToArrayOfN<2, 0>(Pitch),
850  Dimensions, PropList) {
852  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
853  detail::rangeToArray(Range).data(), Format);
854  }
855 
856  template <bool IsMultiDim = (Dimensions > 1),
857  typename = std::enable_if_t<IsMultiDim>>
859  void *HostPointer, image_format Format, const range<Dimensions> &Range,
860  const range<Dimensions - 1> &Pitch, AllocatorT Allocator,
861  const property_list &PropList = {},
863  : common_base(
864  HostPointer, detail::FormatChannelOrder(Format),
866  detail::convertToArrayOfN<3, 1>(Range),
867  detail::convertToArrayOfN<2, 0>(Pitch),
870  Dimensions, PropList) {
872  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
873  detail::rangeToArray(Range).data(), Format);
874  }
875 
877  std::shared_ptr<void> &HostPointer, image_format Format,
878  const range<Dimensions> &Range, const property_list &PropList = {},
880  : common_base(HostPointer, detail::FormatChannelOrder(Format),
882  detail::convertToArrayOfN<3, 1>(Range),
885  Dimensions, PropList, /*IsConstPtr*/ false) {
887  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
888  detail::rangeToArray(Range).data(), Format);
889  }
890 
892  std::shared_ptr<void> &HostPointer, image_format Format,
893  const range<Dimensions> &Range, AllocatorT Allocator,
894  const property_list &PropList = {},
896  : common_base(
897  HostPointer, detail::FormatChannelOrder(Format),
899  detail::convertToArrayOfN<3, 1>(Range),
902  Dimensions, PropList, /*IsConstPtr*/ false) {
904  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
905  detail::rangeToArray(Range).data(), Format);
906  }
907 
908  template <bool IsMultiDim = (Dimensions > 1),
909  typename = std::enable_if_t<IsMultiDim>>
911  std::shared_ptr<void> &HostPointer, image_format Format,
912  const range<Dimensions> &Range, const range<Dimensions - 1> &Pitch,
913  const property_list &PropList = {},
915  : common_base(HostPointer, detail::FormatChannelOrder(Format),
917  detail::convertToArrayOfN<3, 1>(Range),
918  detail::convertToArrayOfN<2, 0>(Pitch),
921  Dimensions, PropList, /*IsConstPtr*/ false) {
923  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
924  detail::rangeToArray(Range).data(), Format);
925  }
926 
927  template <bool IsMultiDim = (Dimensions > 1),
928  typename = std::enable_if_t<IsMultiDim>>
930  std::shared_ptr<void> &HostPointer, image_format Format,
931  const range<Dimensions> &Range, const range<Dimensions - 1> &Pitch,
932  AllocatorT Allocator, const property_list &PropList = {},
934  : common_base(
935  HostPointer, detail::FormatChannelOrder(Format),
937  detail::convertToArrayOfN<3, 1>(Range),
938  detail::convertToArrayOfN<2, 0>(Pitch),
941  Dimensions, PropList, /*IsConstPtr*/ false) {
943  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
944  detail::rangeToArray(Range).data(), Format);
945  }
946 
947  /* -- common interface members -- */
948 
949  unsampled_image(const unsampled_image &rhs) = default;
950 
952 
953  unsampled_image &operator=(const unsampled_image &rhs) = default;
954 
956 
958  common_base::unsampledImageDestructorNotification((void *)this->impl.get());
959  }
960 
961  bool operator==(const unsampled_image &rhs) const {
962  return this->impl == rhs.impl;
963  }
964 
965  bool operator!=(const unsampled_image &rhs) const { return !(*this == rhs); }
966 
967  size_t byte_size() const noexcept { return common_base::get_size(); }
968 
969  using common_base::size;
970 
971  template <typename DataT,
972  access_mode AccessMode = (std::is_const_v<DataT>
975  image_target AccessTarget = image_target::device>
978  handler &CommandGroupHandlerRef, const property_list &PropList = {},
980  return {*this, CommandGroupHandlerRef, PropList, CodeLoc};
981  }
982 
983  template <typename DataT,
984  access_mode AccessMode = (std::is_const_v<DataT>
988  const property_list &PropList = {},
990  return {*this, PropList, CodeLoc};
991  }
992 
993 private:
994  template <class Obj>
995  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
996 
997  template <class T>
998  friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
999 
1000  template <typename DataT, int Dims, access_mode AccessMode>
1002 
1003  template <typename DataT, int Dims, access_mode AccessMode,
1004  image_target AccessTarget>
1006 };
1007 
1008 template <int Dimensions = 1, typename AllocatorT = sycl::image_allocator>
1010  : public detail::image_common<Dimensions, AllocatorT>,
1011  public detail::OwnerLessBase<sampled_image<Dimensions, AllocatorT>> {
1012 private:
1013  using common_base = typename detail::image_common<Dimensions, AllocatorT>;
1014 
1015  sampled_image(const std::shared_ptr<detail::image_impl> &Impl)
1016  : common_base{Impl} {}
1017 
1018 public:
1020  const void *HostPointer, image_format Format, image_sampler Sampler,
1021  const range<Dimensions> &Range, const property_list &PropList = {},
1023  : common_base(HostPointer, detail::FormatChannelOrder(Format),
1024  detail::FormatChannelType(Format), Sampler,
1025  detail::convertToArrayOfN<3, 1>(Range),
1028  Dimensions, PropList) {
1030  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
1031  detail::rangeToArray(Range).data(), Format, Sampler);
1032  }
1033 
1034  template <bool IsMultiDim = (Dimensions > 1),
1035  typename = std::enable_if_t<IsMultiDim>>
1037  const void *HostPointer, image_format Format, image_sampler Sampler,
1038  const range<Dimensions> &Range, const range<Dimensions - 1> &Pitch,
1039  const property_list &PropList = {},
1041  : common_base(HostPointer, detail::FormatChannelOrder(Format),
1042  detail::FormatChannelType(Format), Sampler,
1043  detail::convertToArrayOfN<3, 1>(Range),
1044  detail::convertToArrayOfN<2, 0>(Pitch),
1047  Dimensions, PropList) {
1049  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
1050  detail::rangeToArray(Range).data(), Format, Sampler);
1051  }
1052 
1054  std::shared_ptr<const void> &HostPointer, image_format Format,
1055  image_sampler Sampler, const range<Dimensions> &Range,
1056  const property_list &PropList = {},
1058  : common_base(HostPointer, detail::FormatChannelOrder(Format),
1059  detail::FormatChannelType(Format), Sampler,
1060  detail::convertToArrayOfN<3, 1>(Range),
1063  Dimensions, PropList) {
1065  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
1066  detail::rangeToArray(Range).data(), Format, Sampler);
1067  }
1068 
1069  template <bool IsMultiDim = (Dimensions > 1),
1070  typename = std::enable_if_t<IsMultiDim>>
1072  std::shared_ptr<const void> &HostPointer, image_format Format,
1073  image_sampler Sampler, const range<Dimensions> &Range,
1074  const range<Dimensions - 1> &Pitch, const property_list &PropList = {},
1076  : common_base(HostPointer, detail::FormatChannelOrder(Format),
1077  detail::FormatChannelType(Format), Sampler,
1078  detail::convertToArrayOfN<3, 1>(Range),
1079  detail::convertToArrayOfN<2, 0>(Pitch),
1082  Dimensions, PropList) {
1084  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
1085  detail::rangeToArray(Range).data(), Format, Sampler);
1086  }
1087 
1088  /* -- common interface members -- */
1089 
1090  sampled_image(const sampled_image &rhs) = default;
1091 
1092  sampled_image(sampled_image &&rhs) = default;
1093 
1094  sampled_image &operator=(const sampled_image &rhs) = default;
1095 
1097 
1099  common_base::sampledImageDestructorNotification((void *)this->impl.get());
1100  }
1101 
1102  bool operator==(const sampled_image &rhs) const {
1103  return this->impl == rhs.impl;
1104  }
1105 
1106  bool operator!=(const sampled_image &rhs) const { return !(*this == rhs); }
1107 
1108  size_t byte_size() const noexcept { return common_base::get_size(); }
1109 
1110  template <typename DataT, image_target AccessTarget = image_target::device>
1112  handler &CommandGroupHandlerRef, const property_list &PropList = {},
1114  return {*this, CommandGroupHandlerRef, PropList, CodeLoc};
1115  }
1116 
1117  template <typename DataT>
1119  const property_list &PropList = {},
1121  return {*this, PropList, CodeLoc};
1122  }
1123 
1124 private:
1125  template <class Obj>
1126  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
1127 
1128  template <class T>
1129  friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
1130 
1131  template <typename DataT, int Dims> friend class host_sampled_image_accessor;
1132 
1133  template <typename DataT, int Dims, image_target AccessTarget>
1135 };
1136 
1137 } // namespace _V1
1138 } // namespace sycl
1139 
1140 namespace std {
1141 template <int Dimensions, typename AllocatorT>
1142 struct hash<sycl::image<Dimensions, AllocatorT>> {
1144  return hash<std::shared_ptr<sycl::detail::image_impl>>()(
1146  }
1147 };
1148 
1149 template <int Dimensions, typename AllocatorT>
1150 struct hash<sycl::unsampled_image<Dimensions, AllocatorT>> {
1151  size_t
1153  return hash<std::shared_ptr<sycl::detail::image_impl>>()(
1155  }
1156 };
1157 
1158 template <int Dimensions, typename AllocatorT>
1159 struct hash<sycl::sampled_image<Dimensions, AllocatorT>> {
1160  size_t
1162  return hash<std::shared_ptr<sycl::detail::image_impl>>()(
1164  }
1165 };
1166 } // namespace std
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:51
propertyT get_property() const
Definition: image.hpp:320
AllocatorT get_allocator() const
Definition: image.hpp:339
range< Dimensions > get_range() const
Definition: image.hpp:324
bool has_property() const noexcept
Definition: image.hpp:316
std::enable_if_t< IsMultiDim, range< Dimensions - 1 > > get_pitch() const
Definition: image.hpp:331
size_t size() const noexcept
Definition: image.hpp:336
size_t get_count() const noexcept
Definition: image.cpp:168
range< 2 > get_pitch() const
Definition: image.cpp:164
bool has_property() const noexcept
range< 3 > get_range() const
Definition: image.cpp:162
std::shared_ptr< detail::image_impl > impl
Definition: image.hpp:304
const std::unique_ptr< SYCLMemObjAllocator > & get_allocator_internal() const
Definition: image.cpp:183
image_plain(const std::shared_ptr< detail::image_impl > &Impl)
Definition: image.hpp:177
void set_final_data(Destination finalData=nullptr)
Definition: image.hpp:357
void set_write_back(bool flag=true)
Definition: image.hpp:361
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Definition: event.hpp:44
Command group handler class.
Definition: handler.hpp:453
Defines a shared image data.
Definition: image.hpp:444
image(std::shared_ptr< void > &HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const typename std::enable_if_t< B, range< Dimensions - 1 >> &Pitch, const property_list &PropList={})
Definition: image.hpp:572
std::enable_if_t< B, range< Dimensions - 1 > > get_pitch() const
Definition: image.hpp:636
image(const image &rhs)=default
image(void *HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const property_list &PropList={})
Definition: image.hpp:491
image(std::shared_ptr< void > &HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const property_list &PropList={})
Definition: image.hpp:552
~image()=default
image(image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, AllocatorT Allocator, const property_list &PropList={})
Definition: image.hpp:457
accessor< detail::EnableIfImgAccDataT< DataT >, Dimensions, AccessMode, access::target::image, access::placeholder::false_t, ext::oneapi::accessor_property_list<> > get_access(handler &commandGroupHandler)
Definition: image.hpp:652
image(std::shared_ptr< void > &HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const typename std::enable_if_t< B, range< Dimensions - 1 >> &Pitch, AllocatorT Allocator, const property_list &PropList={})
Definition: image.hpp:585
image(std::shared_ptr< void > &HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, AllocatorT Allocator, const property_list &PropList={})
Definition: image.hpp:561
image(image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const typename std::enable_if_t< B, range< Dimensions - 1 >> &Pitch, const property_list &PropList={})
Definition: image.hpp:468
image(image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const typename std::enable_if_t< B, range< Dimensions - 1 >> &Pitch, AllocatorT Allocator, const property_list &PropList={})
Definition: image.hpp:480
image(const void *HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, AllocatorT Allocator, const property_list &PropList={})
Definition: image.hpp:517
bool operator!=(const image &rhs) const
Definition: image.hpp:619
range< Dimensions > get_range() const
Definition: image.hpp:630
image(image &&rhs)=default
image(void *HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, AllocatorT Allocator, const property_list &PropList={})
Definition: image.hpp:499
image(const void *HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const property_list &PropList={})
Definition: image.hpp:508
accessor< detail::EnableIfImgAccDataT< DataT >, Dimensions, AccessMode, access::target::host_image, access::placeholder::false_t, ext::oneapi::accessor_property_list<> > get_access()
Definition: image.hpp:663
image(void *HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const typename std::enable_if_t< B, range< Dimensions - 1 >> &Pitch, const property_list &PropList={})
Definition: image.hpp:528
__SYCL2020_DEPRECATED("get_count() is deprecated, please use size() instead") size_t get_count() const
Definition: image.hpp:645
friend std::enable_if_t< Backend==backend::ext_oneapi_level_zero, image< D, A > > make_image(const backend_input_t< Backend, image< D, A >> &BackendObject, const context &TargetContext, event AvailableEvent)
image & operator=(image &&rhs)=default
image(void *HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const typename std::enable_if_t< B, range< Dimensions - 1 >> &Pitch, AllocatorT Allocator, const property_list &PropList={})
Definition: image.hpp:541
bool has_property() const noexcept
Definition: image.hpp:622
friend std::enable_if_t< detail::InteropFeatureSupportMap< Backend >::MakeImage==true &&Backend !=backend::ext_oneapi_level_zero, image< D, A > > make_image(const typename backend_traits< Backend >::template input_type< image< D, A >> &BackendObject, const context &TargetContext, event AvailableEvent)
bool operator==(const image &rhs) const
Definition: image.hpp:617
image & operator=(const image &rhs)=default
propertyT get_property() const
Definition: image.hpp:626
image(image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const property_list &PropList={})
Definition: image.hpp:450
size_t get_size() const
Definition: image.hpp:642
Objects of the property_list class are containers for the SYCL properties.
sampled_image_accessor< DataT, Dimensions, AccessTarget > get_access(handler &CommandGroupHandlerRef, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:1111
sampled_image(const sampled_image &rhs)=default
sampled_image(std::shared_ptr< const void > &HostPointer, image_format Format, image_sampler Sampler, const range< Dimensions > &Range, const range< Dimensions - 1 > &Pitch, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:1071
sampled_image(const void *HostPointer, image_format Format, image_sampler Sampler, const range< Dimensions > &Range, const range< Dimensions - 1 > &Pitch, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:1036
host_sampled_image_accessor< DataT, Dimensions > get_host_access(const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:1118
bool operator==(const sampled_image &rhs) const
Definition: image.hpp:1102
sampled_image(const void *HostPointer, image_format Format, image_sampler Sampler, const range< Dimensions > &Range, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:1019
sampled_image(sampled_image &&rhs)=default
sampled_image(std::shared_ptr< const void > &HostPointer, image_format Format, image_sampler Sampler, const range< Dimensions > &Range, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:1053
sampled_image & operator=(sampled_image &&rhs)=default
size_t byte_size() const noexcept
Definition: image.hpp:1108
bool operator!=(const sampled_image &rhs) const
Definition: image.hpp:1106
sampled_image & operator=(const sampled_image &rhs)=default
unsampled_image(image_format Format, const range< Dimensions > &Range, const range< Dimensions - 1 > &Pitch, AllocatorT Allocator, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:789
bool operator==(const unsampled_image &rhs) const
Definition: image.hpp:961
unsampled_image & operator=(unsampled_image &&rhs)=default
unsampled_image(std::shared_ptr< void > &HostPointer, image_format Format, const range< Dimensions > &Range, AllocatorT Allocator, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:891
unsampled_image & operator=(const unsampled_image &rhs)=default
unsampled_image(const unsampled_image &rhs)=default
unsampled_image_accessor< DataT, Dimensions, AccessMode, AccessTarget > get_access(handler &CommandGroupHandlerRef, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:977
unsampled_image(void *HostPointer, image_format Format, const range< Dimensions > &Range, const range< Dimensions - 1 > &Pitch, AllocatorT Allocator, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:858
friend class host_unsampled_image_accessor
Definition: image.hpp:1001
unsampled_image(image_format Format, const range< Dimensions > &Range, AllocatorT Allocator, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:753
unsampled_image(void *HostPointer, image_format Format, const range< Dimensions > &Range, AllocatorT Allocator, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:822
unsampled_image(void *HostPointer, image_format Format, const range< Dimensions > &Range, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:807
unsampled_image(void *HostPointer, image_format Format, const range< Dimensions > &Range, const range< Dimensions - 1 > &Pitch, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:840
unsampled_image(std::shared_ptr< void > &HostPointer, image_format Format, const range< Dimensions > &Range, const range< Dimensions - 1 > &Pitch, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:910
bool operator!=(const unsampled_image &rhs) const
Definition: image.hpp:965
size_t byte_size() const noexcept
Definition: image.hpp:967
unsampled_image(image_format Format, const range< Dimensions > &Range, const range< Dimensions - 1 > &Pitch, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:771
unsampled_image(unsampled_image &&rhs)=default
unsampled_image(image_format Format, const range< Dimensions > &Range, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:738
unsampled_image(std::shared_ptr< void > &HostPointer, image_format Format, const range< Dimensions > &Range, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:876
host_unsampled_image_accessor< DataT, Dimensions, AccessMode > get_host_access(const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:987
unsampled_image(std::shared_ptr< void > &HostPointer, image_format Format, const range< Dimensions > &Range, const range< Dimensions - 1 > &Pitch, AllocatorT Allocator, const property_list &PropList={}, const detail::code_location CodeLoc=detail::code_location::current())
Definition: image.hpp:929
defined(__INTEL_PREVIEW_BREAKING_CHANGES)
Definition: types.hpp:346
static T< NewDim > convertToArrayOfN(T< OldDim > OldObj)
Definition: common.hpp:384
void unsampledImageConstructorNotification(void *ImageObj, void *AccessorObj, const std::optional< image_target > &Target, access::mode Mode, const void *Type, uint32_t ElemSize, const code_location &CodeLoc)
std::array< size_t, 3 > rangeToArray(const range< 3 > &r)
Definition: range.hpp:234
boost::mp11::mp_set_contains< TypeList, std::remove_cv_t< T > > is_contained
Definition: type_list.hpp:32
image_channel_type FormatChannelType(image_format Format)
Definition: image.hpp:126
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
Definition: impl_utils.hpp:30
boost::mp11::mp_list< T... > type_list
Definition: type_list.hpp:22
T createSyclObjFromImpl(decltype(T::impl) ImplObj)
Definition: impl_utils.hpp:48
typename detail::is_contained< T, type_list< vec< opencl::cl_int, 4 >, vec< opencl::cl_uint, 4 >, vec< opencl::cl_float, 4 >, vec< opencl::cl_half, 4 > >>::type is_validImageDataT
Definition: image.hpp:120
image_channel_order FormatChannelOrder(image_format Format)
Definition: image.hpp:154
void sampledImageConstructorNotification(void *ImageObj, void *AccessorObj, const std::optional< image_target > &Target, const void *Type, uint32_t ElemSize, const code_location &CodeLoc)
typename std::enable_if_t< is_validImageDataT< DataT >::value, DataT > EnableIfImgAccDataT
Definition: image.hpp:124
static constexpr auto get_property()
unsigned char byte
Definition: image.hpp:108
access::mode access_mode
Definition: access.hpp:72
std::unique_ptr< T > make_unique_ptr(ArgsT &&...Args)
Definition: stl.hpp:43
image_target
Definition: access.hpp:74
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS Dimensions
Definition: accessor.hpp:3233
constexpr mode_tag_t< access_mode::read_write > read_write
Definition: access.hpp:85
image_channel_order
Definition: image.hpp:57
std::enable_if_t< detail::InteropFeatureSupportMap< Backend >::MakeImage==true &&Backend !=backend::ext_oneapi_level_zero, image< Dimensions, AllocatorT > > make_image(const typename backend_traits< Backend >::template input_type< image< Dimensions, AllocatorT >> &BackendObject, const context &TargetContext, event AvailableEvent={})
Definition: backend.hpp:384
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS IsPlaceholder
Definition: accessor.hpp:3234
image_format
Definition: image.hpp:94
class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(local_accessor) local_accessor class __SYCL_EBO __SYCL_SPECIAL_CLASS AccessMode
Definition: accessor.hpp:3233
detail::aligned_allocator< byte > image_allocator
Definition: image.hpp:110
image_channel_type
Definition: image.hpp:75
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
Definition: exception.cpp:94
typename backend_traits< Backend >::template input_type< SyclType > backend_input_t
Definition: backend.hpp:83
Definition: access.hpp:18
static constexpr size_t get_pitch(size_t x)
Calculate pitch (padded length of major dimension x) by rounding up to multiple of 32.
Definition: memory.hpp:152
uintptr_t pi_native_handle
Definition: pi.h:204
_Abi const simd< _Tp, _Abi > & noexcept
Definition: simd.hpp:1324
size_t operator()(const sycl::image< Dimensions, AllocatorT > &I) const
Definition: image.hpp:1143
size_t operator()(const sycl::sampled_image< Dimensions, AllocatorT > &I) const
Definition: image.hpp:1161
size_t operator()(const sycl::unsampled_image< Dimensions, AllocatorT > &I) const
Definition: image.hpp:1152
static constexpr code_location current(const char *fileName=__CODELOC_FILE_NAME, const char *funcName=__CODELOC_FUNCTION, unsigned long lineNo=__CODELOC_LINE, unsigned long columnNo=__CODELOC_COLUMN) noexcept
Definition: common.hpp:68