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/types.hpp> // for vec
34 
35 #include <cstddef> // for size_t, nullptr_t
36 #include <functional> // for function
37 #include <memory> // for shared_ptr
38 #include <stdint.h> // for uint8_t, uint32_t
39 #include <type_traits> // for enable_if_t
40 #include <variant> // for hash
41 
42 namespace sycl {
43 inline namespace _V1 {
44 
45 // forward declarations
46 class handler;
47 
48 template <int D, typename A> class image;
49 
50 // 'friend'
51 template <backend Backend, int D, typename A>
52 std::enable_if_t<Backend == backend::ext_oneapi_level_zero, image<D, A>>
53 make_image(const backend_input_t<Backend, image<D, A>> &BackendObject,
54  const context &TargetContext, event AvailableEvent = {});
55 
56 enum class image_channel_order : unsigned int {
57  a = 0,
58  r = 1,
59  rx = 2,
60  rg = 3,
61  rgx = 4,
62  ra = 5,
63  rgb = 6,
64  rgbx = 7,
65  rgba = 8,
66  argb = 9,
67  bgra = 10,
68  intensity = 11,
69  luminance = 12,
70  abgr = 13,
71  ext_oneapi_srgba = 14 // OpenCL 2.0
72 };
73 
74 enum class image_channel_type : unsigned int {
75  snorm_int8 = 0,
76  snorm_int16 = 1,
77  unorm_int8 = 2,
78  unorm_int16 = 3,
79  unorm_short_565 = 4,
80  unorm_short_555 = 5,
81  unorm_int_101010 = 6,
82  signed_int8 = 7,
83  signed_int16 = 8,
84  signed_int32 = 9,
85  unsigned_int8 = 10,
86  unsigned_int16 = 11,
87  unsigned_int32 = 12,
88  fp16 = 13,
89  fp32 = 14
90 };
91 
92 // SYCL 2020 image_format
93 enum class image_format : unsigned int {
94  r8g8b8a8_unorm = 0,
96  r8g8b8a8_sint = 2,
99  r8g8b8a8_uint = 5,
100  r16g16b16a16_uint = 6,
101  r32b32g32a32_uint = 7,
104  b8g8r8a8_unorm = 10
105 };
106 
107 using byte = unsigned char;
108 
109 using image_allocator = detail::aligned_allocator<byte>;
110 
111 namespace detail {
112 
113 class image_impl;
114 
115 // validImageDataT: cl_int4, cl_uint4, cl_float4, cl_half4
116 template <typename T>
120 
121 template <typename DataT>
123  typename std::enable_if_t<is_validImageDataT<DataT>::value, DataT>;
124 
126  switch (Format) {
148  }
149  throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
150  "Unrecognized channel type.");
151 }
152 
154  switch (Format) {
168  }
169  throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
170  "Unrecognized channel order.");
171 }
172 
173 // The non-template base for the sycl::image class
174 class __SYCL_EXPORT image_plain {
175 protected:
176  image_plain(const std::shared_ptr<detail::image_impl> &Impl) : impl{Impl} {}
177 
179  const range<3> &Range,
180  std::unique_ptr<SYCLMemObjAllocator> Allocator,
181  uint8_t Dimensions, const property_list &PropList);
182 
184  const range<3> &Range, const range<2> &Pitch,
185  std::unique_ptr<SYCLMemObjAllocator> Allocator,
186  uint8_t Dimensions, const property_list &PropList);
187 
188  image_plain(void *HostPointer, image_channel_order Order,
189  image_channel_type Type, const range<3> &Range,
190  std::unique_ptr<SYCLMemObjAllocator> Allocator,
191  uint8_t Dimensions, const property_list &PropList);
192 
193  image_plain(const void *HostPointer, image_channel_order Order,
194  image_channel_type Type, const range<3> &Range,
195  std::unique_ptr<SYCLMemObjAllocator> Allocator,
196  uint8_t Dimensions, const property_list &PropList);
197 
198  image_plain(void *HostPointer, image_channel_order Order,
199  image_channel_type Type, const range<3> &Range,
200  const range<2> &Pitch,
201  std::unique_ptr<SYCLMemObjAllocator> Allocator,
202  uint8_t Dimensions, const property_list &PropList);
203 
204  image_plain(const std::shared_ptr<const void> &HostPointer,
206  const range<3> &Range,
207  std::unique_ptr<SYCLMemObjAllocator> Allocator,
208  uint8_t Dimensions, const property_list &PropList,
209  bool IsConstPtr);
210 
211  image_plain(const std::shared_ptr<const void> &HostPointer,
213  const range<3> &Range, const range<2> &Pitch,
214  std::unique_ptr<SYCLMemObjAllocator> Allocator,
215  uint8_t Dimensions, const property_list &PropList,
216  bool IsConstPtr);
217 
218  image_plain(const void *HostPointer, image_channel_order Order,
219  image_channel_type Type, image_sampler Sampler,
220  const range<3> &Range,
221  std::unique_ptr<SYCLMemObjAllocator> Allocator,
222  uint8_t Dimensions, const property_list &PropList);
223 
224  image_plain(const void *HostPointer, image_channel_order Order,
225  image_channel_type Type, image_sampler Sampler,
226  const range<3> &Range, const range<2> &Pitch,
227  std::unique_ptr<SYCLMemObjAllocator> Allocator,
228  uint8_t Dimensions, const property_list &PropList);
229 
230  image_plain(const std::shared_ptr<const void> &HostPointer,
232  image_sampler Sampler, const range<3> &Range,
233  std::unique_ptr<SYCLMemObjAllocator> Allocator,
234  uint8_t Dimensions, const property_list &PropList);
235 
236  image_plain(const std::shared_ptr<const void> &HostPointer,
238  image_sampler Sampler, const range<3> &Range,
239  const range<2> &Pitch,
240  std::unique_ptr<SYCLMemObjAllocator> Allocator,
241  uint8_t Dimensions, const property_list &PropList);
242 
243 #ifdef __SYCL_INTERNAL_API
244  image_plain(cl_mem ClMemObject, const context &SyclContext,
245  event AvailableEvent,
246  std::unique_ptr<SYCLMemObjAllocator> Allocator,
247  uint8_t Dimensions);
248 #endif
249 
250  image_plain(pi_native_handle MemObject, const context &SyclContext,
251  event AvailableEvent,
252  std::unique_ptr<SYCLMemObjAllocator> Allocator,
253  uint8_t Dimensions, image_channel_order Order,
254  image_channel_type Type, bool OwnNativeHandle,
255  range<3> Range3WithOnes);
256 
257  template <typename propertyT> bool has_property() const noexcept;
258 
259  template <typename propertyT> propertyT get_property() const;
260 
261  range<3> get_range() const;
262 
263  range<2> get_pitch() const;
264 
265  size_t get_size() const noexcept;
266 
267  size_t get_count() const noexcept;
268 
269  void set_final_data_internal();
270 
271  void set_final_data_internal(
272  const std::function<void(const std::function<void(void *const Ptr)> &)>
273  &FinalDataFunc);
274 
275  void set_write_back(bool flag);
276 
277  const std::unique_ptr<SYCLMemObjAllocator> &get_allocator_internal() const;
278 
279  size_t getElementSize() const;
280 
281  size_t getRowPitch() const;
282 
283  size_t getSlicePitch() const;
284 
285  image_sampler getSampler() const noexcept;
286 
287  image_channel_order getChannelOrder() const;
288 
289  image_channel_type getChannelType() const;
290 
291  void sampledImageConstructorNotification(const detail::code_location &CodeLoc,
292  void *UserObj, const void *HostObj,
293  uint32_t Dim, size_t Range[3],
294  image_format Format,
295  const image_sampler &Sampler);
296  void sampledImageDestructorNotification(void *UserObj);
297 
299  const detail::code_location &CodeLoc, void *UserObj, const void *HostObj,
300  uint32_t Dim, size_t Range[3], image_format Format);
301  void unsampledImageDestructorNotification(void *UserObj);
302 
303  std::shared_ptr<detail::image_impl> impl;
304 };
305 
306 // Common base class for image implementations
307 template <int Dimensions, typename AllocatorT>
308 class image_common : public image_plain {
309 protected:
310  // Use the same ctors as image_plain.
312 
313 public:
314  /* -- property interface members -- */
315  template <typename propertyT> bool has_property() const noexcept {
316  return image_plain::template has_property<propertyT>();
317  }
318 
319  template <typename propertyT> propertyT get_property() const {
320  return image_plain::get_property<propertyT>();
321  }
322 
324  return detail::convertToArrayOfN<Dimensions, 0>(image_plain::get_range());
325  }
326 
327  /* Available only when: dimensions >1 */
328  template <bool IsMultiDim = (Dimensions > 1)>
329  typename std::enable_if_t<IsMultiDim, range<Dimensions - 1>>
330  get_pitch() const {
331  return detail::convertToArrayOfN<Dimensions - 1, 0>(
333  }
334 
335  size_t size() const noexcept { return image_plain::get_count(); }
336 
337  // Returns the allocator provided to the image
338  AllocatorT get_allocator() const {
340  ->template getAllocator<AllocatorT>();
341  }
342 };
343 
344 // Common base class for unsampled image implementations
345 template <int Dimensions, typename AllocatorT>
346 class unsampled_image_common : public image_common<Dimensions, AllocatorT> {
347 private:
348  using common_base = typename detail::image_common<Dimensions, AllocatorT>;
349 
350 protected:
351  // Use the same ctors as image_plain.
352  using common_base::image_common;
353 
354 public:
355  template <typename Destination = std::nullptr_t>
356  void set_final_data(Destination finalData = nullptr) {
357  this->set_final_data_internal(finalData);
358  }
359 
360  void set_write_back(bool flag = true) { common_base::set_write_back(flag); }
361 
362 private:
363  void set_final_data_internal(std::nullptr_t) {
364  common_base::set_final_data_internal();
365  }
366 
367  template <template <typename WeakT> class WeakPtrT, typename WeakT>
368  std::enable_if_t<
369  std::is_convertible<WeakPtrT<WeakT>, std::weak_ptr<WeakT>>::value>
370  set_final_data_internal(WeakPtrT<WeakT> FinalData) {
371  std::weak_ptr<WeakT> TempFinalData(FinalData);
372  this->set_final_data_internal(TempFinalData);
373  }
374 
375  template <typename WeakT>
376  void set_final_data_internal(std::weak_ptr<WeakT> FinalData) {
377  common_base::set_final_data_internal(
378  [FinalData](const std::function<void(void *const Ptr)> &F) {
379  if (std::shared_ptr<WeakT> LockedFinalData = FinalData.lock())
380  F(LockedFinalData.get());
381  });
382  }
383 
384  template <typename Destination>
385  detail::EnableIfOutputPointerT<Destination>
386  set_final_data_internal(Destination FinalData) {
387  if (!FinalData)
388  common_base::set_final_data_internal();
389  else
390  common_base::set_final_data_internal(
391  [FinalData](const std::function<void(void *const Ptr)> &F) {
392  F(FinalData);
393  });
394  }
395 
396  template <typename Destination>
397  detail::EnableIfOutputIteratorT<Destination>
398  set_final_data_internal(Destination FinalData) {
399  const size_t Size = common_base::size();
400  common_base::set_final_data_internal(
401  [FinalData, Size](const std::function<void(void *const Ptr)> &F) {
402  using DestinationValueT = detail::iterator_value_type_t<Destination>;
403  // TODO if Destination is ContiguousIterator then don't create
404  // ContiguousStorage. updateHostMemory works only with pointer to
405  // continuous data.
406  std::unique_ptr<DestinationValueT[]> ContiguousStorage(
407  new DestinationValueT[Size]);
408  F(ContiguousStorage.get());
409  std::copy(ContiguousStorage.get(), ContiguousStorage.get() + Size,
410  FinalData);
411  });
412  }
413 };
414 
415 template <typename DataT, int Dims, access::mode AccMode,
417 class image_accessor;
418 
419 } // namespace detail
420 
421 template <typename DataT, int Dimensions, access_mode AccessMode,
422  image_target AccessTarget>
423 class unsampled_image_accessor;
424 
425 template <typename DataT, int Dimensions, access_mode AccessMode>
426 class host_unsampled_image_accessor;
427 
428 template <typename DataT, int Dimensions, image_target AccessTarget>
429 class sampled_image_accessor;
430 
431 template <typename DataT, int Dimensions> class host_sampled_image_accessor;
432 
442 template <int Dimensions = 1, typename AllocatorT = sycl::image_allocator>
443 class image : public detail::unsampled_image_common<Dimensions, AllocatorT> {
444 private:
445  using common_base =
447 
448 public:
450  const range<Dimensions> &Range, const property_list &PropList = {})
451  : common_base(Order, Type, detail::convertToArrayOfN<3, 1>(Range),
452  std::make_unique<
454  Dimensions, PropList) {}
455 
457  const range<Dimensions> &Range, AllocatorT Allocator,
458  const property_list &PropList = {})
459  : common_base(
460  Order, Type, detail::convertToArrayOfN<3, 1>(Range),
461  std::make_unique<
463  Dimensions, PropList) {}
464 
465  /* Available only when: dimensions >1 */
466  template <bool B = (Dimensions > 1)>
468  const range<Dimensions> &Range,
469  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
470  const property_list &PropList = {})
471  : common_base(Order, Type, detail::convertToArrayOfN<3, 1>(Range),
472  detail::convertToArrayOfN<2, 0>(Pitch),
473  std::make_unique<
475  Dimensions, PropList) {}
476 
477  /* Available only when: dimensions >1 */
478  template <bool B = (Dimensions > 1)>
480  const range<Dimensions> &Range,
481  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
482  AllocatorT Allocator, const property_list &PropList = {})
483  : common_base(
484  Order, Type, detail::convertToArrayOfN<3, 1>(Range),
485  detail::convertToArrayOfN<2, 0>(Pitch),
486  std::make_unique<
488  Dimensions, PropList) {}
489 
490  image(void *HostPointer, image_channel_order Order, image_channel_type Type,
491  const range<Dimensions> &Range, const property_list &PropList = {})
492  : common_base(HostPointer, Order, Type,
493  detail::convertToArrayOfN<3, 1>(Range),
494  std::make_unique<
496  Dimensions, PropList) {}
497 
498  image(void *HostPointer, image_channel_order Order, image_channel_type Type,
499  const range<Dimensions> &Range, AllocatorT Allocator,
500  const property_list &PropList = {})
501  : common_base(
502  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
503  std::make_unique<
505  Dimensions, PropList) {}
506 
507  image(const void *HostPointer, image_channel_order Order,
508  image_channel_type Type, const range<Dimensions> &Range,
509  const property_list &PropList = {})
510  : common_base(HostPointer, Order, Type,
511  detail::convertToArrayOfN<3, 1>(Range),
512  std::make_unique<
514  Dimensions, PropList) {}
515 
516  image(const void *HostPointer, image_channel_order Order,
517  image_channel_type Type, const range<Dimensions> &Range,
518  AllocatorT Allocator, const property_list &PropList = {})
519  : common_base(
520  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
521  std::make_unique<
523  Dimensions, PropList) {}
524 
525  /* Available only when: dimensions >1 */
526  template <bool B = (Dimensions > 1)>
527  image(void *HostPointer, image_channel_order Order, image_channel_type Type,
528  const range<Dimensions> &Range,
529  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
530  const property_list &PropList = {})
531  : common_base(HostPointer, Order, Type,
532  detail::convertToArrayOfN<3, 1>(Range),
533  detail::convertToArrayOfN<2, 0>(Pitch),
534  std::make_unique<
536  Dimensions, PropList) {}
537 
538  /* Available only when: dimensions >1 */
539  template <bool B = (Dimensions > 1)>
540  image(void *HostPointer, image_channel_order Order, image_channel_type Type,
541  const range<Dimensions> &Range,
542  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
543  AllocatorT Allocator, const property_list &PropList = {})
544  : common_base(
545  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
546  detail::convertToArrayOfN<2, 0>(Pitch),
547  std::make_unique<
549  Dimensions, PropList) {}
550 
551  image(std::shared_ptr<void> &HostPointer, image_channel_order Order,
552  image_channel_type Type, const range<Dimensions> &Range,
553  const property_list &PropList = {})
554  : common_base(HostPointer, Order, Type,
555  detail::convertToArrayOfN<3, 1>(Range),
556  std::make_unique<
558  Dimensions, PropList, /*IsConstPtr*/ false) {}
559 
560  image(std::shared_ptr<void> &HostPointer, image_channel_order Order,
561  image_channel_type Type, const range<Dimensions> &Range,
562  AllocatorT Allocator, const property_list &PropList = {})
563  : common_base(
564  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
565  std::make_unique<
567  Dimensions, PropList, /*IsConstPtr*/ false) {}
568 
569  /* Available only when: dimensions >1 */
570  template <bool B = (Dimensions > 1)>
571  image(std::shared_ptr<void> &HostPointer, image_channel_order Order,
572  image_channel_type Type, const range<Dimensions> &Range,
573  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
574  const property_list &PropList = {})
575  : common_base(HostPointer, Order, Type,
576  detail::convertToArrayOfN<3, 1>(Range),
577  detail::convertToArrayOfN<2, 0>(Pitch),
578  std::make_unique<
580  Dimensions, PropList, /*IsConstPtr*/ false) {}
581 
582  /* Available only when: dimensions >1 */
583  template <bool B = (Dimensions > 1)>
584  image(std::shared_ptr<void> &HostPointer, image_channel_order Order,
585  image_channel_type Type, const range<Dimensions> &Range,
586  const typename std::enable_if_t<B, range<Dimensions - 1>> &Pitch,
587  AllocatorT Allocator, const property_list &PropList = {})
588  : common_base(
589  HostPointer, Order, Type, detail::convertToArrayOfN<3, 1>(Range),
590  detail::convertToArrayOfN<2, 0>(Pitch),
591  std::make_unique<
593  Dimensions, PropList, /*IsConstPtr*/ false) {}
594 
595 #ifdef __SYCL_INTERNAL_API
596  image(cl_mem ClMemObject, const context &SyclContext,
597  event AvailableEvent = {})
598  : common_base(ClMemObject, SyclContext, AvailableEvent,
599  std::make_unique<
600  detail::SYCLMemObjAllocatorHolder<AllocatorT, byte>>(),
601  Dimensions) {}
602 #endif
603 
604  /* -- common interface members -- */
605 
606  image(const image &rhs) = default;
607 
608  image(image &&rhs) = default;
609 
610  image &operator=(const image &rhs) = default;
611 
612  image &operator=(image &&rhs) = default;
613 
614  ~image() = default;
615 
616  bool operator==(const image &rhs) const { return this->impl == rhs.impl; }
617 
618  bool operator!=(const image &rhs) const { return !(*this == rhs); }
619 
620  /* -- property interface members -- */
621  template <typename propertyT> bool has_property() const noexcept {
622  return common_base::template has_property<propertyT>();
623  }
624 
625  template <typename propertyT> propertyT get_property() const {
626  return common_base::template get_property<propertyT>();
627  }
628 
630  return detail::convertToArrayOfN<Dimensions, 0>(common_base::get_range());
631  }
632 
633  /* Available only when: dimensions >1 */
634  template <bool B = (Dimensions > 1)>
635  typename std::enable_if_t<B, range<Dimensions - 1>> get_pitch() const {
636  return detail::convertToArrayOfN<Dimensions - 1, 0>(
638  }
639 
640  // Returns the size of the image storage in bytes
641  size_t get_size() const { return common_base::get_size(); }
642 
643  // Returns the total number of elements in the image
644  __SYCL2020_DEPRECATED("get_count() is deprecated, please use size() instead")
645  size_t get_count() const { return common_base::size(); }
646 
647  template <typename DataT, access::mode AccessMode>
651  get_access(handler &commandGroupHandler) {
655  commandGroupHandler);
656  }
657 
658  template <typename DataT, access::mode AccessMode>
666  }
667 
668 private:
669  image(pi_native_handle MemObject, const context &SyclContext,
670  event AvailableEvent, image_channel_order Order,
671  image_channel_type Type, bool OwnNativeHandle, range<Dimensions> Range)
672  : common_base(MemObject, SyclContext, AvailableEvent,
673  std::make_unique<
674  detail::SYCLMemObjAllocatorHolder<AllocatorT, byte>>(),
675  Dimensions, Order, Type, OwnNativeHandle,
676  detail::convertToArrayOfN<3, 1>(Range)) {}
677 
678  // This utility api is currently used by accessor to get the element size of
679  // the image. Element size is dependent on num of channels and channel type.
680  // This information is not accessible from the image using any public API.
681  size_t getElementSize() const { return common_base::getElementSize(); }
682 
683  size_t getRowPitch() const { return common_base::getRowPitch(); }
684 
685  size_t getSlicePitch() const { return common_base::getSlicePitch(); }
686 
687  image_channel_order getChannelOrder() const {
688  return common_base::getChannelOrder();
689  }
690 
691  image_channel_type getChannelType() const {
692  return common_base::getChannelType();
693  }
694 
695  // Declare make_image as a friend function
696  template <backend Backend, int D, typename A>
697  friend std::enable_if_t<
700  image<D, A>>
702  const typename backend_traits<Backend>::template input_type<image<D, A>>
703  &BackendObject,
704  const context &TargetContext, event AvailableEvent);
705 
706  template <backend Backend, int D, typename A>
707  friend std::enable_if_t<Backend == backend::ext_oneapi_level_zero,
708  image<D, A>>
709  make_image(const backend_input_t<Backend, image<D, A>> &BackendObject,
710  const context &TargetContext, event AvailableEvent);
711 
712  template <class Obj>
713  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
714 
715  template <typename DataT, int Dims, access::mode AccMode,
717  typename PropertyListT>
718  friend class accessor;
719 
720  template <typename DataT, int Dims, access::mode AccMode,
723 };
724 
725 template <int Dimensions = 1, typename AllocatorT = sycl::image_allocator>
727  : public detail::unsampled_image_common<Dimensions, AllocatorT>,
728  public detail::OwnerLessBase<unsampled_image<Dimensions, AllocatorT>> {
729 private:
730  using common_base =
732 
733  unsampled_image(const std::shared_ptr<detail::image_impl> &Impl)
734  : common_base{Impl} {}
735 
736 public:
738  image_format Format, const range<Dimensions> &Range,
739  const property_list &PropList = {},
741  : common_base(detail::FormatChannelOrder(Format),
743  detail::convertToArrayOfN<3, 1>(Range),
744  std::make_unique<
746  Dimensions, PropList) {
748  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
749  detail::rangeToArray(Range).data(), Format);
750  }
751 
753  image_format Format, const range<Dimensions> &Range, AllocatorT Allocator,
754  const property_list &PropList = {},
756  : common_base(
759  detail::convertToArrayOfN<3, 1>(Range),
760  std::make_unique<
762  Dimensions, PropList) {
764  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
765  detail::rangeToArray(Range).data(), Format);
766  }
767 
768  template <bool IsMultiDim = (Dimensions > 1),
769  typename = std::enable_if_t<IsMultiDim>>
771  image_format Format, const range<Dimensions> &Range,
772  const range<Dimensions - 1> &Pitch, const property_list &PropList = {},
774  : common_base(detail::FormatChannelOrder(Format),
776  detail::convertToArrayOfN<3, 1>(Range),
777  detail::convertToArrayOfN<2, 0>(Pitch),
778  std::make_unique<
780  Dimensions, PropList) {
782  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
783  detail::rangeToArray(Range).data(), Format);
784  }
785 
786  template <bool IsMultiDim = (Dimensions > 1),
787  typename = std::enable_if_t<IsMultiDim>>
789  image_format Format, const range<Dimensions> &Range,
790  const range<Dimensions - 1> &Pitch, AllocatorT Allocator,
791  const property_list &PropList = {},
793  : common_base(
796  detail::convertToArrayOfN<3, 1>(Range),
797  detail::convertToArrayOfN<2, 0>(Pitch),
798  std::make_unique<
800  Dimensions, PropList) {
802  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
803  detail::rangeToArray(Range).data(), Format);
804  }
805 
807  void *HostPointer, image_format Format, const range<Dimensions> &Range,
808  const property_list &PropList = {},
810  : common_base(HostPointer, detail::FormatChannelOrder(Format),
812  detail::convertToArrayOfN<3, 1>(Range),
813  std::make_unique<
815  Dimensions, PropList) {
817  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
818  detail::rangeToArray(Range).data(), Format);
819  }
820 
822  void *HostPointer, image_format Format, const range<Dimensions> &Range,
823  AllocatorT Allocator, const property_list &PropList = {},
825  : common_base(
826  HostPointer, detail::FormatChannelOrder(Format),
828  detail::convertToArrayOfN<3, 1>(Range),
829  std::make_unique<
831  Dimensions, PropList) {
833  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
834  detail::rangeToArray(Range).data(), Format);
835  }
836 
837  template <bool IsMultiDim = (Dimensions > 1),
838  typename = std::enable_if_t<IsMultiDim>>
840  void *HostPointer, image_format Format, const range<Dimensions> &Range,
841  const range<Dimensions - 1> &Pitch, const property_list &PropList = {},
843  : common_base(HostPointer, detail::FormatChannelOrder(Format),
845  detail::convertToArrayOfN<3, 1>(Range),
846  detail::convertToArrayOfN<2, 0>(Pitch),
847  std::make_unique<
849  Dimensions, PropList) {
851  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
852  detail::rangeToArray(Range).data(), Format);
853  }
854 
855  template <bool IsMultiDim = (Dimensions > 1),
856  typename = std::enable_if_t<IsMultiDim>>
858  void *HostPointer, image_format Format, const range<Dimensions> &Range,
859  const range<Dimensions - 1> &Pitch, AllocatorT Allocator,
860  const property_list &PropList = {},
862  : common_base(
863  HostPointer, detail::FormatChannelOrder(Format),
865  detail::convertToArrayOfN<3, 1>(Range),
866  detail::convertToArrayOfN<2, 0>(Pitch),
867  std::make_unique<
869  Dimensions, PropList) {
871  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
872  detail::rangeToArray(Range).data(), Format);
873  }
874 
876  std::shared_ptr<void> &HostPointer, image_format Format,
877  const range<Dimensions> &Range, const property_list &PropList = {},
879  : common_base(HostPointer, detail::FormatChannelOrder(Format),
881  detail::convertToArrayOfN<3, 1>(Range),
882  std::make_unique<
884  Dimensions, PropList, /*IsConstPtr*/ false) {
886  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
887  detail::rangeToArray(Range).data(), Format);
888  }
889 
891  std::shared_ptr<void> &HostPointer, image_format Format,
892  const range<Dimensions> &Range, AllocatorT Allocator,
893  const property_list &PropList = {},
895  : common_base(
896  HostPointer, detail::FormatChannelOrder(Format),
898  detail::convertToArrayOfN<3, 1>(Range),
899  std::make_unique<
901  Dimensions, PropList, /*IsConstPtr*/ false) {
903  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
904  detail::rangeToArray(Range).data(), Format);
905  }
906 
907  template <bool IsMultiDim = (Dimensions > 1),
908  typename = std::enable_if_t<IsMultiDim>>
910  std::shared_ptr<void> &HostPointer, image_format Format,
911  const range<Dimensions> &Range, const range<Dimensions - 1> &Pitch,
912  const property_list &PropList = {},
914  : common_base(HostPointer, detail::FormatChannelOrder(Format),
916  detail::convertToArrayOfN<3, 1>(Range),
917  detail::convertToArrayOfN<2, 0>(Pitch),
918  std::make_unique<
920  Dimensions, PropList, /*IsConstPtr*/ false) {
922  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
923  detail::rangeToArray(Range).data(), Format);
924  }
925 
926  template <bool IsMultiDim = (Dimensions > 1),
927  typename = std::enable_if_t<IsMultiDim>>
929  std::shared_ptr<void> &HostPointer, image_format Format,
930  const range<Dimensions> &Range, const range<Dimensions - 1> &Pitch,
931  AllocatorT Allocator, const property_list &PropList = {},
933  : common_base(
934  HostPointer, detail::FormatChannelOrder(Format),
936  detail::convertToArrayOfN<3, 1>(Range),
937  detail::convertToArrayOfN<2, 0>(Pitch),
938  std::make_unique<
940  Dimensions, PropList, /*IsConstPtr*/ false) {
942  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
943  detail::rangeToArray(Range).data(), Format);
944  }
945 
946  /* -- common interface members -- */
947 
948  unsampled_image(const unsampled_image &rhs) = default;
949 
951 
952  unsampled_image &operator=(const unsampled_image &rhs) = default;
953 
955 
957  common_base::unsampledImageDestructorNotification((void *)this->impl.get());
958  }
959 
960  bool operator==(const unsampled_image &rhs) const {
961  return this->impl == rhs.impl;
962  }
963 
964  bool operator!=(const unsampled_image &rhs) const { return !(*this == rhs); }
965 
966  size_t byte_size() const noexcept { return common_base::get_size(); }
967 
968  using common_base::size;
969 
970  template <typename DataT,
971  access_mode AccessMode = (std::is_const_v<DataT>
974  image_target AccessTarget = image_target::device>
977  handler &CommandGroupHandlerRef, const property_list &PropList = {},
979  return {*this, CommandGroupHandlerRef, PropList, CodeLoc};
980  }
981 
982  template <typename DataT,
983  access_mode AccessMode = (std::is_const_v<DataT>
987  const property_list &PropList = {},
989  return {*this, PropList, CodeLoc};
990  }
991 
992 private:
993  template <class Obj>
994  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
995 
996  template <class T>
997  friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
998 
999  template <typename DataT, int Dims, access_mode AccessMode>
1001 
1002  template <typename DataT, int Dims, access_mode AccessMode,
1003  image_target AccessTarget>
1005 };
1006 
1007 template <int Dimensions = 1, typename AllocatorT = sycl::image_allocator>
1009  : public detail::image_common<Dimensions, AllocatorT>,
1010  public detail::OwnerLessBase<sampled_image<Dimensions, AllocatorT>> {
1011 private:
1012  using common_base = typename detail::image_common<Dimensions, AllocatorT>;
1013 
1014  sampled_image(const std::shared_ptr<detail::image_impl> &Impl)
1015  : common_base{Impl} {}
1016 
1017 public:
1019  const void *HostPointer, image_format Format, image_sampler Sampler,
1020  const range<Dimensions> &Range, const property_list &PropList = {},
1022  : common_base(HostPointer, detail::FormatChannelOrder(Format),
1023  detail::FormatChannelType(Format), Sampler,
1024  detail::convertToArrayOfN<3, 1>(Range),
1025  std::make_unique<
1027  Dimensions, PropList) {
1029  CodeLoc, (void *)this->impl.get(), nullptr, Dimensions,
1030  detail::rangeToArray(Range).data(), Format, Sampler);
1031  }
1032 
1033  template <bool IsMultiDim = (Dimensions > 1),
1034  typename = std::enable_if_t<IsMultiDim>>
1036  const void *HostPointer, image_format Format, image_sampler Sampler,
1037  const range<Dimensions> &Range, const range<Dimensions - 1> &Pitch,
1038  const property_list &PropList = {},
1040  : common_base(HostPointer, detail::FormatChannelOrder(Format),
1041  detail::FormatChannelType(Format), Sampler,
1042  detail::convertToArrayOfN<3, 1>(Range),
1043  detail::convertToArrayOfN<2, 0>(Pitch),
1044  std::make_unique<
1046  Dimensions, PropList) {
1048  CodeLoc, (void *)this->impl.get(), HostPointer, Dimensions,
1049  detail::rangeToArray(Range).data(), Format, Sampler);
1050  }
1051 
1053  std::shared_ptr<const void> &HostPointer, image_format Format,
1054  image_sampler Sampler, const range<Dimensions> &Range,
1055  const property_list &PropList = {},
1057  : common_base(HostPointer, detail::FormatChannelOrder(Format),
1058  detail::FormatChannelType(Format), Sampler,
1059  detail::convertToArrayOfN<3, 1>(Range),
1060  std::make_unique<
1062  Dimensions, PropList) {
1064  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
1065  detail::rangeToArray(Range).data(), Format, Sampler);
1066  }
1067 
1068  template <bool IsMultiDim = (Dimensions > 1),
1069  typename = std::enable_if_t<IsMultiDim>>
1071  std::shared_ptr<const void> &HostPointer, image_format Format,
1072  image_sampler Sampler, const range<Dimensions> &Range,
1073  const range<Dimensions - 1> &Pitch, const property_list &PropList = {},
1075  : common_base(HostPointer, detail::FormatChannelOrder(Format),
1076  detail::FormatChannelType(Format), Sampler,
1077  detail::convertToArrayOfN<3, 1>(Range),
1078  detail::convertToArrayOfN<2, 0>(Pitch),
1079  std::make_unique<
1081  Dimensions, PropList) {
1083  CodeLoc, (void *)this->impl.get(), HostPointer.get(), Dimensions,
1084  detail::rangeToArray(Range).data(), Format, Sampler);
1085  }
1086 
1087  /* -- common interface members -- */
1088 
1089  sampled_image(const sampled_image &rhs) = default;
1090 
1091  sampled_image(sampled_image &&rhs) = default;
1092 
1093  sampled_image &operator=(const sampled_image &rhs) = default;
1094 
1096 
1098  common_base::sampledImageDestructorNotification((void *)this->impl.get());
1099  }
1100 
1101  bool operator==(const sampled_image &rhs) const {
1102  return this->impl == rhs.impl;
1103  }
1104 
1105  bool operator!=(const sampled_image &rhs) const { return !(*this == rhs); }
1106 
1107  size_t byte_size() const noexcept { return common_base::get_size(); }
1108 
1109  template <typename DataT, image_target AccessTarget = image_target::device>
1111  handler &CommandGroupHandlerRef, const property_list &PropList = {},
1113  return {*this, CommandGroupHandlerRef, PropList, CodeLoc};
1114  }
1115 
1116  template <typename DataT>
1118  const property_list &PropList = {},
1120  return {*this, PropList, CodeLoc};
1121  }
1122 
1123 private:
1124  template <class Obj>
1125  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
1126 
1127  template <class T>
1128  friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
1129 
1130  template <typename DataT, int Dims> friend class host_sampled_image_accessor;
1131 
1132  template <typename DataT, int Dims, image_target AccessTarget>
1134 };
1135 
1136 } // namespace _V1
1137 } // namespace sycl
1138 
1139 namespace std {
1140 template <int Dimensions, typename AllocatorT>
1141 struct hash<sycl::image<Dimensions, AllocatorT>> {
1143  return hash<std::shared_ptr<sycl::detail::image_impl>>()(
1145  }
1146 };
1147 
1148 template <int Dimensions, typename AllocatorT>
1149 struct hash<sycl::unsampled_image<Dimensions, AllocatorT>> {
1150  size_t
1152  return hash<std::shared_ptr<sycl::detail::image_impl>>()(
1154  }
1155 };
1156 
1157 template <int Dimensions, typename AllocatorT>
1158 struct hash<sycl::sampled_image<Dimensions, AllocatorT>> {
1159  size_t
1161  return hash<std::shared_ptr<sycl::detail::image_impl>>()(
1163  }
1164 };
1165 } // 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:319
AllocatorT get_allocator() const
Definition: image.hpp:338
range< Dimensions > get_range() const
Definition: image.hpp:323
bool has_property() const noexcept
Definition: image.hpp:315
std::enable_if_t< IsMultiDim, range< Dimensions - 1 > > get_pitch() const
Definition: image.hpp:330
size_t size() const noexcept
Definition: image.hpp:335
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:303
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:176
void set_final_data(Destination finalData=nullptr)
Definition: image.hpp:356
void set_write_back(bool flag=true)
Definition: image.hpp:360
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:458
Defines a shared image data.
Definition: image.hpp:443
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:571
std::enable_if_t< B, range< Dimensions - 1 > > get_pitch() const
Definition: image.hpp:635
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:490
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:551
~image()=default
image(image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, AllocatorT Allocator, const property_list &PropList={})
Definition: image.hpp:456
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:651
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:584
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:560
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:467
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:479
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:516
bool operator!=(const image &rhs) const
Definition: image.hpp:618
range< Dimensions > get_range() const
Definition: image.hpp:629
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:498
image(const void *HostPointer, image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const property_list &PropList={})
Definition: image.hpp:507
accessor< detail::EnableIfImgAccDataT< DataT >, Dimensions, AccessMode, access::target::host_image, access::placeholder::false_t, ext::oneapi::accessor_property_list<> > get_access()
Definition: image.hpp:662
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:527
__SYCL2020_DEPRECATED("get_count() is deprecated, please use size() instead") size_t get_count() const
Definition: image.hpp:644
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:540
bool has_property() const noexcept
Definition: image.hpp:621
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:616
image & operator=(const image &rhs)=default
propertyT get_property() const
Definition: image.hpp:625
image(image_channel_order Order, image_channel_type Type, const range< Dimensions > &Range, const property_list &PropList={})
Definition: image.hpp:449
size_t get_size() const
Definition: image.hpp:641
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:1110
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:1070
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:1035
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:1117
bool operator==(const sampled_image &rhs) const
Definition: image.hpp:1101
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:1018
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:1052
sampled_image & operator=(sampled_image &&rhs)=default
size_t byte_size() const noexcept
Definition: image.hpp:1107
bool operator!=(const sampled_image &rhs) const
Definition: image.hpp:1105
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:788
bool operator==(const unsampled_image &rhs) const
Definition: image.hpp:960
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:890
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:976
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:857
friend class host_unsampled_image_accessor
Definition: image.hpp:1000
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:752
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:821
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:806
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:839
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:909
bool operator!=(const unsampled_image &rhs) const
Definition: image.hpp:964
size_t byte_size() const noexcept
Definition: image.hpp:966
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:770
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:737
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:875
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:986
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:928
Provides a cross-patform vector class template that works efficiently on SYCL devices as well as in h...
Definition: types.hpp:284
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:125
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:119
image_channel_order FormatChannelOrder(image_format Format)
Definition: image.hpp:153
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:123
static constexpr auto get_property()
unsigned char byte
Definition: image.hpp:107
access::mode access_mode
Definition: access.hpp:72
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:56
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:93
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:109
image_channel_type
Definition: image.hpp:74
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
Definition: exception.cpp:87
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:158
uintptr_t pi_native_handle
Definition: pi.h:217
_Abi const simd< _Tp, _Abi > & noexcept
Definition: simd.hpp:1324
size_t operator()(const sycl::image< Dimensions, AllocatorT > &I) const
Definition: image.hpp:1142
size_t operator()(const sycl::sampled_image< Dimensions, AllocatorT > &I) const
Definition: image.hpp:1160
size_t operator()(const sycl::unsampled_image< Dimensions, AllocatorT > &I) const
Definition: image.hpp:1151
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