DPC++ Runtime
Runtime libraries for oneAPI DPC++
bindless_images.hpp
Go to the documentation of this file.
1 //==----------- bindless_images.hpp --- SYCL bindless images ---------------==//
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/context.hpp> // for context
12 #include <sycl/detail/export.hpp> // for __SYCL_EXPORT
13 #include <sycl/detail/pi.h> // for pi_uint64
14 #include <sycl/device.hpp> // for device
15 #include <sycl/ext/oneapi/bindless_images_descriptor.hpp> // for image_desc...
16 #include <sycl/ext/oneapi/bindless_images_interop.hpp> // for interop_me...
17 #include <sycl/ext/oneapi/bindless_images_memory.hpp> // for image_mem_...
18 #include <sycl/ext/oneapi/bindless_images_sampler.hpp> // for bindless_i...
19 #include <sycl/image.hpp> // for image_chan...
20 #include <sycl/queue.hpp> // for queue
21 #include <sycl/range.hpp> // for range
22 
23 #include <assert.h> // for assert
24 #include <stddef.h> // for size_t
25 #include <type_traits> // for is_scalar
26 
27 namespace sycl {
28 inline namespace _V1 {
29 namespace ext::oneapi::experimental {
30 
34 
36 
38  : raw_handle(raw_image_handle) {}
39 
41 };
42 
46 
48 
50  : raw_handle(raw_image_handle) {}
51 
53 };
54 
63 __SYCL_EXPORT image_mem_handle
64 alloc_image_mem(const image_descriptor &desc, const sycl::device &syclDevice,
65  const sycl::context &syclContext);
66 
74 __SYCL_EXPORT image_mem_handle alloc_image_mem(const image_descriptor &desc,
75  const sycl::queue &syclQueue);
76 
84 __SYCL_EXPORT_DEPRECATED("Distinct image frees are deprecated. "
85  "Instead use overload that accepts image_type.")
86 void free_image_mem(image_mem_handle handle, const sycl::device &syclDevice,
87  const sycl::context &syclContext);
88 
95 __SYCL_EXPORT_DEPRECATED("Distinct image frees are deprecated. "
96  "Instead use overload that accepts image_type.")
97 void free_image_mem(image_mem_handle handle, const sycl::queue &syclQueue);
98 
107 __SYCL_EXPORT void free_image_mem(image_mem_handle handle, image_type imageType,
108  const sycl::device &syclDevice,
109  const sycl::context &syclContext);
110 
118 __SYCL_EXPORT void free_image_mem(image_mem_handle handle, image_type imageType,
119  const sycl::queue &syclQueue);
120 
129 __SYCL_EXPORT_DEPRECATED("Distinct mipmap allocs are deprecated. "
130  "Instead use alloc_image_mem().")
132  const sycl::device &syclDevice,
133  const sycl::context &syclContext);
134 
142 __SYCL_EXPORT_DEPRECATED("Distinct mipmap allocs are deprecated. "
143  "Instead use alloc_image_mem().")
145  const sycl::device &syclQueue);
146 
154 __SYCL_EXPORT_DEPRECATED(
155  "Distinct mipmap frees are deprecated. "
156  "Instead use free_image_mem() that accepts image_type.")
157 void free_mipmap_mem(image_mem_handle handle, const sycl::device &syclDevice,
158  const sycl::context &syclContext);
159 
166 __SYCL_EXPORT_DEPRECATED(
167  "Distinct mipmap frees are deprecated. "
168  "Instead use free_image_mem() that accepts image_type.")
169 void free_mipmap_mem(image_mem_handle handle, const sycl::queue &syclQueue);
170 
181  const image_mem_handle mipMem, const unsigned int level,
182  const sycl::device &syclDevice, const sycl::context &syclContext);
183 
193  const image_mem_handle mipMem, const unsigned int level,
194  const sycl::device &syclQueue);
195 
208 template <typename ExternalMemHandleType>
210  external_mem_descriptor<ExternalMemHandleType> externalMem,
211  const sycl::device &syclDevice, const sycl::context &syclContext);
212 
224 template <typename ExternalMemHandleType>
226  external_mem_descriptor<ExternalMemHandleType> externalMem,
227  const sycl::queue &syclQueue);
228 
239 __SYCL_EXPORT_DEPRECATED("map_external_memory_array is deprecated."
242  const image_descriptor &desc,
243  const sycl::device &syclDevice,
244  const sycl::context &syclContext);
245 
255 __SYCL_EXPORT_DEPRECATED("map_external_memory_array is deprecated."
258  const image_descriptor &desc,
259  const sycl::queue &syclQueue);
260 
271 __SYCL_EXPORT
273  const image_descriptor &desc,
274  const sycl::device &syclDevice,
275  const sycl::context &syclContext);
276 
286 __SYCL_EXPORT
288  const image_descriptor &desc,
289  const sycl::queue &syclQueue);
290 
304 template <typename ExternalSemaphoreHandleType>
306  external_semaphore_descriptor<ExternalSemaphoreHandleType>
307  externalSemaphoreDesc,
308  const sycl::device &syclDevice, const sycl::context &syclContext);
309 
321 template <typename ExternalSemaphoreHandleType>
323  external_semaphore_descriptor<ExternalSemaphoreHandleType>
324  externalSemaphoreDesc,
325  const sycl::queue &syclQueue);
326 
336 __SYCL_EXPORT void
338  const sycl::device &syclDevice,
339  const sycl::context &syclContext);
340 
348 __SYCL_EXPORT void
350  const sycl::queue &syclQueue);
351 
361 __SYCL_EXPORT void release_external_memory(interop_mem_handle interopHandle,
362  const sycl::device &syclDevice,
363  const sycl::context &syclContext);
364 
372 __SYCL_EXPORT void release_external_memory(interop_mem_handle interopHandle,
373  const sycl::queue &syclQueue);
374 
384 __SYCL_EXPORT unsampled_image_handle
385 create_image(image_mem &memHandle, const image_descriptor &desc,
386  const sycl::device &syclDevice, const sycl::context &syclContext);
387 
396 __SYCL_EXPORT unsampled_image_handle create_image(image_mem &memHandle,
397  const image_descriptor &desc,
398  const sycl::queue &syclQueue);
399 
409 __SYCL_EXPORT unsampled_image_handle
410 create_image(image_mem_handle memHandle, const image_descriptor &desc,
411  const sycl::device &syclDevice, const sycl::context &syclContext);
412 
422  const image_descriptor &desc,
423  const sycl::queue &syclQueue);
424 
436 __SYCL_EXPORT sampled_image_handle
437 create_image(void *imgMem, size_t pitch, const bindless_image_sampler &sampler,
438  const image_descriptor &desc, const sycl::device &syclDevice,
439  const sycl::context &syclContext);
440 
451 __SYCL_EXPORT sampled_image_handle
452 create_image(void *imgMem, size_t pitch, const bindless_image_sampler &sampler,
453  const image_descriptor &desc, const sycl::queue &syclQueue);
454 
465 __SYCL_EXPORT sampled_image_handle
466 create_image(image_mem &memHandle, const bindless_image_sampler &sampler,
467  const image_descriptor &desc, const sycl::device &syclDevice,
468  const sycl::context &syclContext);
469 
479 __SYCL_EXPORT sampled_image_handle
480 create_image(image_mem &memHandle, const bindless_image_sampler &sampler,
481  const image_descriptor &desc, const sycl::queue &syclQueue);
482 
493 __SYCL_EXPORT sampled_image_handle
494 create_image(image_mem_handle memHandle, const bindless_image_sampler &sampler,
495  const image_descriptor &desc, const sycl::device &syclDevice,
496  const sycl::context &syclContext);
497 
507 __SYCL_EXPORT sampled_image_handle
508 create_image(image_mem_handle memHandle, const bindless_image_sampler &sampler,
509  const image_descriptor &desc, const sycl::queue &syclQueue);
510 
519 __SYCL_EXPORT void destroy_image_handle(unsampled_image_handle &imageHandle,
520  const sycl::device &syclDevice,
521  const sycl::context &syclContext);
522 
530 __SYCL_EXPORT void destroy_image_handle(unsampled_image_handle &imageHandle,
531  const sycl::queue &syclQueue);
532 
541 __SYCL_EXPORT void destroy_image_handle(sampled_image_handle &imageHandle,
542  const sycl::device &syclDevice,
543  const sycl::context &syclContext);
544 
552 __SYCL_EXPORT void destroy_image_handle(sampled_image_handle &imageHandle,
553  const sycl::queue &syclQueue);
554 
565 __SYCL_EXPORT void *pitched_alloc_device(size_t *resultPitch,
566  size_t widthInBytes, size_t height,
567  unsigned int elementSizeBytes,
568  const sycl::queue &syclQueue);
569 
581 __SYCL_EXPORT void *pitched_alloc_device(size_t *resultPitch,
582  size_t widthInBytes, size_t height,
583  unsigned int elementSizeBytes,
584  const sycl::device &syclDevice,
585  const sycl::context &syclContext);
586 
595 __SYCL_EXPORT void *pitched_alloc_device(size_t *resultPitch,
596  const image_descriptor &desc,
597  const sycl::queue &syclQueue);
598 
608 __SYCL_EXPORT void *pitched_alloc_device(size_t *resultPitch,
609  const image_descriptor &desc,
610  const sycl::device &syclDevice,
611  const sycl::context &syclContext);
612 
621 __SYCL_EXPORT sycl::range<3> get_image_range(const image_mem_handle memHandle,
622  const sycl::device &syclDevice,
623  const sycl::context &syclContext);
624 
632 __SYCL_EXPORT sycl::range<3> get_image_range(const image_mem_handle memHandle,
633  const sycl::queue &syclQueue);
634 
643 __SYCL_EXPORT sycl::image_channel_type
645  const sycl::device &syclDevice,
646  const sycl::context &syclContext);
647 
655 __SYCL_EXPORT sycl::image_channel_type
657  const sycl::queue &syclQueue);
658 
667 __SYCL_EXPORT unsigned int
669  const sycl::device &syclDevice,
670  const sycl::context &syclContext);
671 
679 __SYCL_EXPORT unsigned int
681  const sycl::queue &syclQueue);
682 
683 namespace detail {
684 
685 // is sycl::vec
686 template <typename T> struct is_vec {
687  static constexpr bool value = false;
688 };
689 template <typename T, int N> struct is_vec<sycl::vec<T, N>> {
690  static constexpr bool value = true;
691 };
692 template <typename T> inline constexpr bool is_vec_v = is_vec<T>::value;
693 
694 // Get the number of coordinates
695 template <typename CoordT> constexpr size_t coord_size() {
696  if constexpr (std::is_scalar_v<CoordT>) {
697  return 1;
698  } else {
699  return CoordT::size();
700  }
701 }
702 
703 // bit_cast Color to a type the backend is known to accept
704 template <typename DataT> constexpr auto convert_color(DataT Color) {
705  constexpr size_t dataSize = sizeof(DataT);
706  static_assert(
707  dataSize == 1 || dataSize == 2 || dataSize == 4 || dataSize == 8 ||
708  dataSize == 16,
709  "Expected input data type to be of size 1, 2, 4, 8, or 16 bytes.");
710 
711  if constexpr (dataSize == 1) {
712  return sycl::bit_cast<uint8_t>(Color);
713  } else if constexpr (dataSize == 2) {
714  return sycl::bit_cast<uint16_t>(Color);
715  } else if constexpr (dataSize == 4) {
716  return sycl::bit_cast<uint32_t>(Color);
717  } else if constexpr (dataSize == 8) {
718  return sycl::bit_cast<sycl::vec<uint32_t, 2>>(Color);
719  } else { // dataSize == 16
720  return sycl::bit_cast<sycl::vec<uint32_t, 4>>(Color);
721  }
722 }
723 
724 // assert coords or elements of coords is of an integer type
725 template <typename CoordT> constexpr void assert_unsampled_coords() {
726  if constexpr (std::is_scalar_v<CoordT>) {
727  static_assert(std::is_same_v<CoordT, int>,
728  "Expected integer coordinate data type");
729  } else {
730  static_assert(is_vec_v<CoordT>, "Expected sycl::vec coordinates");
731  static_assert(std::is_same_v<typename CoordT::element_type, int>,
732  "Expected integer coordinates data type");
733  }
734 }
735 
736 // assert coords or elements of coords is of a float type
737 template <typename CoordT> constexpr void assert_sampled_coords() {
738  if constexpr (std::is_scalar_v<CoordT>) {
739  static_assert(std::is_same_v<CoordT, float>,
740  "Expected float coordinate data type");
741  } else {
742  static_assert(is_vec_v<CoordT>, "Expected sycl::vec coordinates");
743  static_assert(std::is_same_v<typename CoordT::element_type, float>,
744  "Expected float coordinates data type");
745  }
746 }
747 
748 template <typename DataT> constexpr bool is_data_size_valid() {
749  return (sizeof(DataT) == 1) || (sizeof(DataT) == 2) || (sizeof(DataT) == 4) ||
750  (sizeof(DataT) == 8) || (sizeof(DataT) == 16);
751 }
752 
753 template <typename DataT> constexpr bool is_recognized_standard_type() {
754  return is_data_size_valid<DataT>() &&
755  (is_vec_v<DataT> || std::is_scalar_v<DataT> ||
756  std::is_floating_point_v<DataT> || std::is_same_v<DataT, sycl::half>);
757 }
758 
759 } // namespace detail
760 
781 template <typename DataT, typename HintT = DataT, typename CoordT>
782 __SYCL_DEPRECATED("read_image for standard unsampled images is deprecated. "
783  "Instead use fetch_image.")
784 DataT read_image(const unsampled_image_handle &imageHandle [[maybe_unused]],
785  const CoordT &coords [[maybe_unused]]) {
786  return fetch_image(imageHandle, coords);
787 }
788 
809 template <typename DataT, typename HintT = DataT, typename CoordT>
810 DataT fetch_image(const unsampled_image_handle &imageHandle [[maybe_unused]],
811  const CoordT &coords [[maybe_unused]]) {
812  detail::assert_unsampled_coords<CoordT>();
813  constexpr size_t coordSize = detail::coord_size<CoordT>();
814  static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
815  "Expected input coordinate to be have 1, 2, or 3 components "
816  "for 1D, 2D and 3D images, respectively.");
817 
818 #ifdef __SYCL_DEVICE_ONLY__
819  if constexpr (detail::is_recognized_standard_type<DataT>()) {
820  return __invoke__ImageRead<DataT>(imageHandle.raw_handle, coords);
821  } else {
822  static_assert(sizeof(HintT) == sizeof(DataT),
823  "When trying to read a user-defined type, HintT must be of "
824  "the same size as the user-defined DataT.");
825  static_assert(detail::is_recognized_standard_type<HintT>(),
826  "HintT must always be a recognized standard type");
827  return sycl::bit_cast<DataT>(
828  __invoke__ImageRead<HintT>(imageHandle.raw_handle, coords));
829  }
830 #else
831  assert(false); // Bindless images not yet implemented on host
832 #endif
833 }
834 
855 template <typename DataT, typename HintT = DataT, typename CoordT>
856 __SYCL_DEPRECATED("read_image for standard sampled images is deprecated. "
857  "Instead use sample_image.")
858 DataT read_image(const sampled_image_handle &imageHandle [[maybe_unused]],
859  const CoordT &coords [[maybe_unused]]) {
860  return sample_image(imageHandle, coords);
861 }
862 
883 template <typename DataT, typename HintT = DataT, typename CoordT>
884 DataT sample_image(const sampled_image_handle &imageHandle [[maybe_unused]],
885  const CoordT &coords [[maybe_unused]]) {
886  detail::assert_sampled_coords<CoordT>();
887  constexpr size_t coordSize = detail::coord_size<CoordT>();
888  static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
889  "Expected input coordinate to be have 1, 2, or 3 components "
890  "for 1D, 2D and 3D images, respectively.");
891 
892 #ifdef __SYCL_DEVICE_ONLY__
893  if constexpr (detail::is_recognized_standard_type<DataT>()) {
894  return __invoke__ImageRead<DataT>(imageHandle.raw_handle, coords);
895  } else {
896  static_assert(sizeof(HintT) == sizeof(DataT),
897  "When trying to read a user-defined type, HintT must be of "
898  "the same size as the user-defined DataT.");
899  static_assert(detail::is_recognized_standard_type<HintT>(),
900  "HintT must always be a recognized standard type");
901  return sycl::bit_cast<DataT>(
902  __invoke__ImageRead<HintT>(imageHandle.raw_handle, coords));
903  }
904 #else
905  assert(false); // Bindless images not yet implemented on host.
906 #endif
907 }
908 
925 template <typename DataT, typename HintT = DataT, typename CoordT>
926 __SYCL_DEPRECATED("read_mipmap has been deprecated. "
927  "Instead use sample_mipmap.")
928 DataT read_mipmap(const sampled_image_handle &imageHandle [[maybe_unused]],
929  const CoordT &coords [[maybe_unused]],
930  const float level [[maybe_unused]]) {
931  return sample_mipmap(imageHandle, coords, level);
932 }
933 
951 template <typename DataT, typename HintT = DataT, typename CoordT>
952 __SYCL_DEPRECATED("read_mipmap has been deprecated. "
953  "Instead use sample_mipmap.")
954 DataT read_mipmap(const sampled_image_handle &imageHandle [[maybe_unused]],
955  const CoordT &coords [[maybe_unused]],
956  const CoordT &dX [[maybe_unused]],
957  const CoordT &dY [[maybe_unused]]) {
958  return sample_mipmap(imageHandle, coords, dX, dY);
959 }
960 
976 template <typename DataT, typename HintT = DataT, typename CoordT>
977 DataT sample_mipmap(const sampled_image_handle &imageHandle [[maybe_unused]],
978  const CoordT &coords [[maybe_unused]],
979  const float level [[maybe_unused]]) {
980  detail::assert_sampled_coords<CoordT>();
981  constexpr size_t coordSize = detail::coord_size<CoordT>();
982  static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
983  "Expected input coordinate to be have 1, 2, or 3 components "
984  "for 1D, 2D and 3D images, respectively.");
985 
986 #ifdef __SYCL_DEVICE_ONLY__
987  if constexpr (detail::is_recognized_standard_type<DataT>()) {
988  return __invoke__ImageReadLod<DataT>(imageHandle.raw_handle, coords, level);
989  } else {
990  static_assert(sizeof(HintT) == sizeof(DataT),
991  "When trying to read a user-defined type, HintT must be of "
992  "the same size as the user-defined DataT.");
993  static_assert(detail::is_recognized_standard_type<HintT>(),
994  "HintT must always be a recognized standard type");
995  return sycl::bit_cast<DataT>(
996  __invoke__ImageReadLod<HintT>(imageHandle.raw_handle, coords, level));
997  }
998 #else
999  assert(false); // Bindless images not yet implemented on host
1000 #endif
1001 }
1002 
1019 template <typename DataT, typename HintT = DataT, typename CoordT>
1020 DataT sample_mipmap(const sampled_image_handle &imageHandle [[maybe_unused]],
1021  const CoordT &coords [[maybe_unused]],
1022  const CoordT &dX [[maybe_unused]],
1023  const CoordT &dY [[maybe_unused]]) {
1024  detail::assert_sampled_coords<CoordT>();
1025  constexpr size_t coordSize = detail::coord_size<CoordT>();
1026  static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
1027  "Expected input coordinates and gradients to have 1, 2, or 3 "
1028  "components for 1D, 2D, and 3D images, respectively.");
1029 
1030 #ifdef __SYCL_DEVICE_ONLY__
1031  if constexpr (detail::is_recognized_standard_type<DataT>()) {
1032  return __invoke__ImageReadGrad<DataT>(imageHandle.raw_handle, coords, dX,
1033  dY);
1034  } else {
1035  static_assert(sizeof(HintT) == sizeof(DataT),
1036  "When trying to read a user-defined type, HintT must be of "
1037  "the same size as the user-defined DataT.");
1038  static_assert(detail::is_recognized_standard_type<HintT>(),
1039  "HintT must always be a recognized standard type");
1040  return sycl::bit_cast<DataT>(
1041  __invoke__ImageReadGrad<HintT>(imageHandle.raw_handle, coords, dX, dY));
1042  }
1043 #else
1044  assert(false); // Bindless images not yet implemented on host
1045 #endif
1046 }
1047 
1064 template <typename DataT, typename HintT = DataT, typename CoordT>
1065 __SYCL_DEPRECATED("read_image for mipmaps is deprecated. "
1066  "Instead use sample_mipmap.")
1067 DataT read_image(const sampled_image_handle &imageHandle [[maybe_unused]],
1068  const CoordT &coords [[maybe_unused]],
1069  const float level [[maybe_unused]]) {
1070  return sample_mipmap(imageHandle, coords, level);
1071 }
1072 
1090 template <typename DataT, typename HintT = DataT, typename CoordT>
1091 __SYCL_DEPRECATED("read_image for mipmaps is deprecated. "
1092  "Instead use sample_mipmap.")
1093 DataT read_image(const sampled_image_handle &imageHandle [[maybe_unused]],
1094  const CoordT &coords [[maybe_unused]],
1095  const CoordT &dX [[maybe_unused]],
1096  const CoordT &dY [[maybe_unused]]) {
1097  return sample_mipmap(imageHandle, coords, dX, dY);
1098 }
1099 
1109 template <typename DataT, typename CoordT>
1110 void write_image(const unsampled_image_handle &imageHandle [[maybe_unused]],
1111  const CoordT &coords [[maybe_unused]],
1112  const DataT &color [[maybe_unused]]) {
1113  detail::assert_unsampled_coords<CoordT>();
1114  constexpr size_t coordSize = detail::coord_size<CoordT>();
1115  static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
1116  "Expected input coordinate to be have 1, 2, or 3 components "
1117  "for 1D, 2D and 3D images, respectively.");
1118 
1119 #ifdef __SYCL_DEVICE_ONLY__
1120  if constexpr (detail::is_recognized_standard_type<DataT>()) {
1121  __invoke__ImageWrite((uint64_t)imageHandle.raw_handle, coords, color);
1122  } else {
1123  // Convert DataT to a supported backend write type when user-defined type is
1124  // passed
1125  __invoke__ImageWrite((uint64_t)imageHandle.raw_handle, coords,
1126  detail::convert_color(color));
1127  }
1128 #else
1129  assert(false); // Bindless images not yet implemented on host
1130 #endif
1131 }
1132 
1133 } // namespace ext::oneapi::experimental
1134 } // namespace _V1
1135 } // namespace sycl
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:51
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:59
Defines a shared image data.
Definition: image.hpp:444
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition: queue.hpp:119
Defines the iteration domain of either a single work-group in a parallel dispatch,...
Definition: range.hpp:26
defined(__INTEL_PREVIEW_BREAKING_CHANGES)
Definition: types.hpp:346
image_mem_handle map_external_image_memory(interop_mem_handle memHandle, const image_descriptor &desc, const sycl::device &syclDevice, const sycl::context &syclContext)
Maps an interop memory handle to an image memory handle (which may have a device optimized memory lay...
sycl::range< 3 > get_image_range(const image_mem_handle memHandle, const sycl::device &syclDevice, const sycl::context &syclContext)
Get the range that describes the image's dimensions.
unsigned int get_image_num_channels(const image_mem_handle memHandle, const sycl::device &syclDevice, const sycl::context &syclContext)
Get the number of channels that describes the image memory.
void free_image_mem(image_mem_handle handle, const sycl::device &syclDevice, const sycl::context &syclContext)
[Deprecated] Free image memory
interop_mem_handle import_external_memory(external_mem_descriptor< ExternalMemHandleType > externalMem, const sycl::device &syclDevice, const sycl::context &syclContext)
Import external memory taking an external memory handle (the type of which is dependent on the OS & e...
DataT sample_image(const sampled_image_handle &imageHandle[[maybe_unused]], const CoordT &coords[[maybe_unused]])
Sample data from a sampled image using its handle.
unsampled_image_handle create_image(image_mem &memHandle, const image_descriptor &desc, const sycl::device &syclDevice, const sycl::context &syclContext)
Create an image and return the device image handle.
const CoordT const CoordT const CoordT & dY
void * pitched_alloc_device(size_t *resultPitch, size_t widthInBytes, size_t height, unsigned int elementSizeBytes, const sycl::queue &syclQueue)
Allocate pitched USM image memory.
image_mem_handle map_external_memory_array(interop_mem_handle memHandle, const image_descriptor &desc, const sycl::device &syclDevice, const sycl::context &syclContext)
[Deprecated] Maps an interop memory handle to an image memory handle (which may have a device optimiz...
DataT fetch_image(const unsampled_image_handle &imageHandle[[maybe_unused]], const CoordT &coords[[maybe_unused]])
Fetch data from an unsampled image using its handle.
void write_image(const unsampled_image_handle &imageHandle[[maybe_unused]], const CoordT &coords[[maybe_unused]], const DataT &color[[maybe_unused]])
Write to an unsampled image using its handle.
DataT sample_mipmap(const sampled_image_handle &imageHandle[[maybe_unused]], const CoordT &coords[[maybe_unused]], const float level[[maybe_unused]])
Sample a mipmap image using its handle with LOD filtering.
image_mem_handle alloc_image_mem(const image_descriptor &desc, const sycl::device &syclDevice, const sycl::context &syclContext)
Allocate image memory based on image_descriptor.
__SYCL_DEPRECATED("read_image for standard unsampled images is deprecated. " "Instead use fetch_image.") DataT read_image(const unsampled_image_handle &imageHandle
[Deprecated] Read an unsampled image using its handle
void release_external_memory(interop_mem_handle interopHandle, const sycl::device &syclDevice, const sycl::context &syclContext)
Release external memory.
void destroy_external_semaphore(interop_semaphore_handle semaphoreHandle, const sycl::device &syclDevice, const sycl::context &syclContext)
Destroy the external semaphore handle.
image_mem_handle get_mip_level_mem_handle(const image_mem_handle mipMem, const unsigned int level, const sycl::device &syclDevice, const sycl::context &syclContext)
Retrieve the memory handle to an individual mipmap image.
void free_mipmap_mem(image_mem_handle handle, const sycl::device &syclDevice, const sycl::context &syclContext)
[Deprecated] Free mipmap memory
interop_semaphore_handle import_external_semaphore(external_semaphore_descriptor< ExternalSemaphoreHandleType > externalSemaphoreDesc, const sycl::device &syclDevice, const sycl::context &syclContext)
Import external semaphore taking an external semaphore handle (the type of which is dependent on the ...
void destroy_image_handle(unsampled_image_handle &imageHandle, const sycl::device &syclDevice, const sycl::context &syclContext)
Destroy an unsampled image handle.
const CoordT const CoordT & dX
sycl::image_channel_type get_image_channel_type(const image_mem_handle memHandle, const sycl::device &syclDevice, const sycl::context &syclContext)
Get the channel type that describes the image memory.
image_mem_handle alloc_mipmap_mem(const image_descriptor &desc, const sycl::device &syclDevice, const sycl::context &syclContext)
[Deprecated] Allocate mipmap memory based on image_descriptor
image_channel_type
Definition: image.hpp:75
Definition: access.hpp:18
uint64_t pi_uint64
Definition: pi.h:203
A struct to describe the properties of an image.
sampled_image_handle(raw_image_handle_type raw_image_handle)
unsampled_image_handle(raw_image_handle_type raw_image_handle)