24 #include <type_traits>
26 #ifdef __SYCL_DEVICE_ONLY__
31 inline namespace _V1 {
32 namespace ext::oneapi::experimental {
138 template <
typename ExternalMemHandleType>
154 template <
typename ExternalMemHandleType>
202 template <
typename ExternalSemaphoreHandleType>
205 externalSemaphoreDesc,
219 template <
typename ExternalSemaphoreHandleType>
222 externalSemaphoreDesc,
464 size_t widthInBytes,
size_t height,
465 unsigned int elementSizeBytes,
480 size_t widthInBytes,
size_t height,
481 unsigned int elementSizeBytes,
565 __SYCL_EXPORT
unsigned int
577 __SYCL_EXPORT
unsigned int
585 static constexpr
bool value =
false;
594 if constexpr (std::is_scalar_v<CoordT>) {
597 return CoordT::size();
603 constexpr
size_t dataSize =
sizeof(DataT);
605 dataSize == 1 || dataSize == 2 || dataSize == 4 || dataSize == 8 ||
607 "Expected input data type to be of size 1, 2, 4, 8, or 16 bytes.");
609 if constexpr (dataSize == 1) {
610 return sycl::bit_cast<uint8_t>(Color);
611 }
else if constexpr (dataSize == 2) {
612 return sycl::bit_cast<uint16_t>(Color);
613 }
else if constexpr (dataSize == 4) {
614 return sycl::bit_cast<uint32_t>(Color);
615 }
else if constexpr (dataSize == 8) {
616 return sycl::bit_cast<sycl::vec<uint32_t, 2>>(Color);
618 return sycl::bit_cast<sycl::vec<uint32_t, 4>>(Color);
624 if constexpr (std::is_scalar_v<CoordT>) {
625 static_assert(std::is_same_v<CoordT, int>,
626 "Expected integer coordinate data type");
628 static_assert(is_vec_v<CoordT>,
"Expected sycl::vec coordinates");
629 static_assert(std::is_same_v<typename CoordT::element_type, int>,
630 "Expected integer coordinates data type");
635 if constexpr (is_vec_v<CoordT>) {
636 return std::is_same_v<typename CoordT::element_type, float>;
638 return std::is_same_v<CoordT, float>;
643 if constexpr (is_vec_v<CoordT>) {
644 return std::is_same_v<typename CoordT::element_type, int>;
646 return std::is_same_v<CoordT, int>;
651 static_assert(are_floating_coords<CoordT>() || are_integer_coords<CoordT>(),
652 "Expected coordinates to be of `float` or `int` type, or "
653 "vectors of these types.");
658 if constexpr (std::is_scalar_v<CoordT>) {
659 static_assert(std::is_same_v<CoordT, float>,
660 "Expected float coordinate data type");
662 static_assert(is_vec_v<CoordT>,
"Expected sycl::vec coordinates");
663 static_assert(std::is_same_v<typename CoordT::element_type, float>,
664 "Expected float coordinates data type");
670 if constexpr (std::is_scalar_v<CoordT>) {
671 static_assert(std::is_same_v<CoordT, int>,
672 "Expected int coordinate data type");
674 static_assert(is_vec_v<CoordT>,
"Expected sycl::vec coordinates");
675 static_assert(std::is_same_v<typename CoordT::element_type, int>,
676 "Expected int coordinates data type");
681 return (
sizeof(DataT) == 1) || (
sizeof(DataT) == 2) || (
sizeof(DataT) == 4) ||
682 (
sizeof(DataT) == 8) || (
sizeof(DataT) == 16);
686 return is_data_size_valid<DataT>() &&
687 (is_vec_v<DataT> || std::is_scalar_v<DataT> ||
688 std::is_floating_point_v<DataT> || std::is_same_v<DataT, sycl::half>);
691 #ifdef __SYCL_DEVICE_ONLY__
695 using OCLImageTyRead =
696 typename sycl::detail::opencl_image_type<NDims, sycl::access::mode::read,
697 sycl::access::target::image>::type;
700 using OCLImageTyWrite =
702 sycl::access::target::image>::type;
705 using OCLImageArrayTyRead =
typename sycl::detail::opencl_image_type<
706 NDims, sycl::access::mode::read, sycl::access::target::image_array>::type;
709 using OCLImageArrayTyWrite =
typename sycl::detail::opencl_image_type<
713 using OCLSampledImageArrayTyRead =
714 typename sycl::detail::sampled_opencl_image_type<
715 detail::OCLImageArrayTyRead<NDims>>::type;
719 #if defined(__SPIR__)
720 #define CONVERT_HANDLE_TO_IMAGE(raw_handle, ImageType) \
721 __spirv_ConvertHandleToImageINTEL<ImageType>(raw_handle)
723 #define CONVERT_HANDLE_TO_SAMPLED_IMAGE(raw_handle, NDims) \
724 __spirv_ConvertHandleToSampledImageINTEL< \
725 typename sycl::detail::sampled_opencl_image_type< \
726 detail::OCLImageTyRead<NDims>>::type>(raw_handle)
728 #define CONVERT_HANDLE_TO_SAMPLED_IMAGE_ARRAY(raw_handle, NDims) \
729 __spirv_ConvertHandleToSampledImageINTEL< \
730 typename sycl::detail::sampled_opencl_image_type< \
731 detail::OCLImageArrayTyRead<NDims>>::type>(raw_handle)
733 #define FETCH_UNSAMPLED_IMAGE(DataT, raw_handle, coords) \
734 __invoke__ImageRead<DataT>(raw_handle, coords)
736 #define FETCH_SAMPLED_IMAGE(DataT, raw_handle, coords) \
737 __invoke__ImageReadLod<DataT>(raw_handle, coords, 0.f)
739 #define SAMPLE_IMAGE_READ(DataT, raw_handle, coords) \
740 __invoke__ImageReadLod<DataT>(raw_handle, coords, 0.f)
742 #define FETCH_IMAGE_ARRAY(DataT, raw_handle, coords, arrayLayer, coordsLayer) \
743 __invoke__ImageRead<DataT>(raw_handle, coordsLayer)
745 #define WRITE_IMAGE_ARRAY(raw_handle, coords, arrayLayer, coordsLayer, color) \
746 __invoke__ImageWrite(raw_handle, coordsLayer, color)
748 #define FETCH_SAMPLED_IMAGE_ARRAY(DataT, raw_handle, coords, arrayLayer, \
750 __invoke__ImageReadLod<DataT>(raw_handle, coordsLayer, 0.f)
752 #define READ_SAMPLED_IMAGE_ARRAY(DataT, raw_handle, coords, arrayLayer, \
754 __invoke__ImageReadLod<DataT>(raw_handle, coordsLayer, 0.f)
757 #define CONVERT_HANDLE_TO_IMAGE(raw_handle, ImageType) raw_handle
759 #define CONVERT_HANDLE_TO_SAMPLED_IMAGE(raw_handle, NDims) raw_handle
761 #define CONVERT_HANDLE_TO_SAMPLED_IMAGE_ARRAY(raw_handle, NDims) raw_handle
763 #define FETCH_UNSAMPLED_IMAGE(DataT, raw_handle, coords) \
764 __invoke__ImageFetch<DataT>(raw_handle, coords)
766 #define FETCH_SAMPLED_IMAGE(DataT, raw_handle, coords) \
767 __invoke__SampledImageFetch<DataT>(raw_handle, coords)
769 #define SAMPLE_IMAGE_READ(DataT, raw_handle, coords) \
770 __invoke__ImageRead<DataT>(raw_handle, coords)
772 #define FETCH_IMAGE_ARRAY(DataT, raw_handle, coords, arrayLayer, coordsLayer) \
773 __invoke__ImageArrayFetch<DataT>(raw_handle, coords, arrayLayer)
775 #define WRITE_IMAGE_ARRAY(raw_handle, coords, arrayLayer, coordsLayer, color) \
776 __invoke__ImageArrayWrite(raw_handle, coords, arrayLayer, color)
778 #define FETCH_SAMPLED_IMAGE_ARRAY(DataT, raw_handle, coords, arrayLayer, \
780 __invoke__SampledImageArrayFetch<DataT>(raw_handle, coords, arrayLayer)
782 #define READ_SAMPLED_IMAGE_ARRAY(DataT, raw_handle, coords, arrayLayer, \
784 __invoke__ImageArrayRead<DataT>(raw_handle, coords, arrayLayer)
813 template <
typename DataT,
typename H
intT = DataT,
typename CoordT>
815 const CoordT &coords [[maybe_unused]]) {
816 detail::assert_fetch_coords<CoordT>();
817 constexpr
size_t coordSize = detail::coord_size<CoordT>();
818 static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
819 "Expected input coordinate to be have 1, 2, or 3 components "
820 "for 1D, 2D and 3D images, respectively.");
822 #ifdef __SYCL_DEVICE_ONLY__
823 if constexpr (detail::is_recognized_standard_type<DataT>()) {
824 return FETCH_UNSAMPLED_IMAGE(
826 CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle,
827 detail::OCLImageTyRead<coordSize>),
831 static_assert(
sizeof(HintT) ==
sizeof(DataT),
832 "When trying to read a user-defined type, HintT must be of "
833 "the same size as the user-defined DataT.");
834 static_assert(detail::is_recognized_standard_type<HintT>(),
835 "HintT must always be a recognized standard type");
836 return sycl::bit_cast<DataT>(FETCH_UNSAMPLED_IMAGE(
838 CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle,
839 detail::OCLImageTyRead<coordSize>),
868 template <
typename DataT,
typename H
intT = DataT,
typename CoordT>
870 const CoordT &coords [[maybe_unused]]) {
871 detail::assert_fetch_coords<CoordT>();
872 constexpr
size_t coordSize = detail::coord_size<CoordT>();
873 static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
874 "Expected input coordinate to be have 1, 2, or 3 components "
875 "for 1D, 2D and 3D images, respectively.");
876 static_assert(
sizeof(HintT) ==
sizeof(DataT),
877 "When trying to read a user-defined type, HintT must be of "
878 "the same size as the user-defined DataT.");
879 static_assert(detail::is_recognized_standard_type<HintT>(),
880 "HintT must always be a recognized standard type");
882 #ifdef __SYCL_DEVICE_ONLY__
883 if constexpr (detail::is_recognized_standard_type<DataT>()) {
884 return FETCH_SAMPLED_IMAGE(
886 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize),
889 return sycl::bit_cast<DataT>(FETCH_SAMPLED_IMAGE(
891 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize),
920 template <
typename DataT,
typename H
intT = DataT,
typename CoordT>
922 const CoordT &coords [[maybe_unused]]) {
923 detail::assert_sample_coords<CoordT>();
924 constexpr
size_t coordSize = detail::coord_size<CoordT>();
925 static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
926 "Expected input coordinate to be have 1, 2, or 3 components "
927 "for 1D, 2D and 3D images, respectively.");
928 static_assert(
sizeof(HintT) ==
sizeof(DataT),
929 "When trying to read a user-defined type, HintT must be of "
930 "the same size as the user-defined DataT.");
931 static_assert(detail::is_recognized_standard_type<HintT>(),
932 "HintT must always be a recognized standard type");
934 #ifdef __SYCL_DEVICE_ONLY__
935 if constexpr (detail::is_recognized_standard_type<DataT>()) {
936 return SAMPLE_IMAGE_READ(
938 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize),
941 return sycl::bit_cast<DataT>(SAMPLE_IMAGE_READ(
943 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize),
966 template <
typename DataT,
typename H
intT = DataT,
typename CoordT>
968 const CoordT &coords [[maybe_unused]],
969 const float level [[maybe_unused]]) {
970 detail::assert_sample_coords<CoordT>();
971 constexpr
size_t coordSize = detail::coord_size<CoordT>();
972 static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
973 "Expected input coordinate to be have 1, 2, or 3 components "
974 "for 1D, 2D and 3D images, respectively.");
976 #ifdef __SYCL_DEVICE_ONLY__
977 if constexpr (detail::is_recognized_standard_type<DataT>()) {
978 return __invoke__ImageReadLod<DataT>(
979 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize),
982 static_assert(
sizeof(HintT) ==
sizeof(DataT),
983 "When trying to read a user-defined type, HintT must be of "
984 "the same size as the user-defined DataT.");
985 static_assert(detail::is_recognized_standard_type<HintT>(),
986 "HintT must always be a recognized standard type");
987 return sycl::bit_cast<DataT>(__invoke__ImageReadLod<HintT>(
988 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize),
1012 template <
typename DataT,
typename H
intT = DataT,
typename CoordT>
1014 const CoordT &coords [[maybe_unused]],
1015 const CoordT &dX [[maybe_unused]],
1016 const CoordT &dY [[maybe_unused]]) {
1017 detail::assert_sample_coords<CoordT>();
1018 constexpr
size_t coordSize = detail::coord_size<CoordT>();
1019 static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
1020 "Expected input coordinates and gradients to have 1, 2, or 3 "
1021 "components for 1D, 2D, and 3D images, respectively.");
1023 #ifdef __SYCL_DEVICE_ONLY__
1024 if constexpr (detail::is_recognized_standard_type<DataT>()) {
1025 return __invoke__ImageReadGrad<DataT>(
1026 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize),
1029 static_assert(
sizeof(HintT) ==
sizeof(DataT),
1030 "When trying to read a user-defined type, HintT must be of "
1031 "the same size as the user-defined DataT.");
1032 static_assert(detail::is_recognized_standard_type<HintT>(),
1033 "HintT must always be a recognized standard type");
1034 return sycl::bit_cast<DataT>(__invoke__ImageReadGrad<HintT>(
1035 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize),
1058 template <
typename DataT,
typename H
intT = DataT,
typename CoordT>
1061 const CoordT &coords [[maybe_unused]],
1062 unsigned int arrayLayer [[maybe_unused]]) {
1063 detail::assert_unsampled_coords<CoordT>();
1064 constexpr
size_t coordSize = detail::coord_size<CoordT>();
1065 static_assert(coordSize == 1 || coordSize == 2,
1066 "Expected input coordinate to be have 1 or 2 components for 1D "
1067 "and 2D images respectively.");
1069 #ifdef __SYCL_DEVICE_ONLY__
1071 if constexpr (detail::is_recognized_standard_type<DataT>()) {
1072 return FETCH_IMAGE_ARRAY(
1074 CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle,
1075 detail::OCLImageArrayTyRead<coordSize>),
1076 coords, arrayLayer, coordsLayer);
1078 static_assert(
sizeof(HintT) ==
sizeof(DataT),
1079 "When trying to fetch a user-defined type, HintT must be of "
1080 "the same size as the user-defined DataT.");
1081 static_assert(detail::is_recognized_standard_type<HintT>(),
1082 "HintT must always be a recognized standard type");
1083 return sycl::bit_cast<DataT>(FETCH_IMAGE_ARRAY(
1085 CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle,
1086 detail::OCLImageArrayTyRead<coordSize>),
1087 coords, arrayLayer, coordsLayer));
1108 template <
typename DataT,
typename H
intT = DataT>
1110 const int2 &coords,
unsigned int face) {
1111 return fetch_image_array<DataT, HintT>(imageHandle, coords, face);
1128 template <
typename DataT,
typename H
intT = DataT>
1130 const sycl::float3 &dirVec [[maybe_unused]]) {
1131 [[maybe_unused]] constexpr
size_t NDims = 2;
1133 #ifdef __SYCL_DEVICE_ONLY__
1134 if constexpr (detail::is_recognized_standard_type<DataT>()) {
1135 return __invoke__ImageReadCubemap<DataT, uint64_t>(
1136 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, NDims), dirVec);
1138 static_assert(
sizeof(HintT) ==
sizeof(DataT),
1139 "When trying to read a user-defined type, HintT must be of "
1140 "the same size as the user-defined DataT.");
1141 static_assert(detail::is_recognized_standard_type<HintT>(),
1142 "HintT must always be a recognized standard type");
1143 return sycl::bit_cast<DataT>(__invoke__ImageReadCubemap<HintT, uint64_t>(
1144 CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, NDims),
1167 template <
typename DataT,
typename H
intT = DataT,
typename CoordT>
1170 const CoordT &coords [[maybe_unused]],
1171 unsigned int arrayLayer [[maybe_unused]]) {
1172 detail::assert_unsampled_coords<CoordT>();
1173 constexpr
size_t coordSize = detail::coord_size<CoordT>();
1174 static_assert(coordSize == 1 || coordSize == 2,
1175 "Expected input coordinate to be have 1 or 2 components for 1D "
1176 "and 2D images respectively.");
1178 #ifdef __SYCL_DEVICE_ONLY__
1180 if constexpr (detail::is_recognized_standard_type<DataT>()) {
1181 return FETCH_SAMPLED_IMAGE_ARRAY(DataT,
1182 CONVERT_HANDLE_TO_SAMPLED_IMAGE_ARRAY(
1183 imageHandle.raw_handle, coordSize),
1184 coords, arrayLayer, coordsLayer);
1186 static_assert(
sizeof(HintT) ==
sizeof(DataT),
1187 "When trying to fetch a user-defined type, HintT must be of "
1188 "the same size as the user-defined DataT.");
1189 static_assert(detail::is_recognized_standard_type<HintT>(),
1190 "HintT must always be a recognized standard type");
1191 return sycl::bit_cast<DataT>(
1192 FETCH_SAMPLED_IMAGE_ARRAY(HintT,
1193 CONVERT_HANDLE_TO_SAMPLED_IMAGE_ARRAY(
1194 imageHandle.raw_handle, coordSize),
1195 coords, arrayLayer, coordsLayer));
1217 template <
typename DataT,
typename H
intT = DataT,
typename CoordT>
1220 const CoordT &coords [[maybe_unused]],
1221 unsigned int arrayLayer [[maybe_unused]]) {
1222 detail::assert_sample_coords<CoordT>();
1223 constexpr
size_t coordSize = detail::coord_size<CoordT>();
1224 static_assert(coordSize == 1 || coordSize == 2,
1225 "Expected input coordinate to be have 1 or 2 components for 1D "
1226 "and 2D images respectively.");
1228 #ifdef __SYCL_DEVICE_ONLY__
1230 if constexpr (detail::is_recognized_standard_type<DataT>()) {
1231 return READ_SAMPLED_IMAGE_ARRAY(DataT,
1232 CONVERT_HANDLE_TO_SAMPLED_IMAGE_ARRAY(
1233 imageHandle.raw_handle, coordSize),
1234 coords, arrayLayer, coordsLayer);
1236 static_assert(
sizeof(HintT) ==
sizeof(DataT),
1237 "When trying to fetch a user-defined type, HintT must be of "
1238 "the same size as the user-defined DataT.");
1239 static_assert(detail::is_recognized_standard_type<HintT>(),
1240 "HintT must always be a recognized standard type");
1241 return sycl::bit_cast<DataT>(
1242 READ_SAMPLED_IMAGE_ARRAY(HintT,
1243 CONVERT_HANDLE_TO_SAMPLED_IMAGE_ARRAY(
1244 imageHandle.raw_handle, coordSize),
1245 coords, arrayLayer, coordsLayer));
1262 template <
typename DataT,
typename CoordT>
1264 const CoordT &coords [[maybe_unused]],
1265 const DataT &color [[maybe_unused]]) {
1266 detail::assert_unsampled_coords<CoordT>();
1267 constexpr
size_t coordSize = detail::coord_size<CoordT>();
1268 static_assert(coordSize == 1 || coordSize == 2 || coordSize == 3,
1269 "Expected input coordinate to be have 1, 2, or 3 components "
1270 "for 1D, 2D and 3D images, respectively.");
1272 #ifdef __SYCL_DEVICE_ONLY__
1273 if constexpr (detail::is_recognized_standard_type<DataT>()) {
1274 __invoke__ImageWrite(
1275 CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle,
1276 detail::OCLImageTyWrite<coordSize>),
1281 __invoke__ImageWrite(
1282 CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle,
1283 detail::OCLImageTyWrite<coordSize>),
1302 template <
typename DataT,
typename CoordT>
1304 const CoordT &coords [[maybe_unused]],
1305 unsigned int arrayLayer [[maybe_unused]],
1306 const DataT &color [[maybe_unused]]) {
1307 detail::assert_unsampled_coords<CoordT>();
1308 constexpr
size_t coordSize = detail::coord_size<CoordT>();
1309 static_assert(coordSize == 1 || coordSize == 2,
1310 "Expected input coordinate to be have 1 or 2 components for 1D "
1311 "and 2D images respectively.");
1313 #ifdef __SYCL_DEVICE_ONLY__
1315 if constexpr (detail::is_recognized_standard_type<DataT>()) {
1317 CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle,
1318 detail::OCLImageArrayTyWrite<coordSize>),
1319 coords, arrayLayer, coordsLayer, color);
1324 CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle,
1325 detail::OCLImageArrayTyWrite<coordSize>),
1343 template <
typename DataT>
1345 int face,
const DataT &color) {
1370 DestImgDesc, CopyExtent);
1399 DestImgDesc, CopyExtent);
1428 DestImgDesc, CopyExtent);
1453 DestExtent, CopyExtent);
1483 DestExtent, CopyExtent);
1513 DestExtent, CopyExtent);
1519 const void *Src,
void *Dest,
1540 DeviceRowPitch, HostExtent, CopyExtent);
1546 const void *Src,
void *Dest,
1548 size_t DeviceRowPitch,
event DepEvent,
1609 DeviceRowPitch, HostExtent, CopyExtent);
1615 const void *Src,
void *Dest,
1617 size_t DeviceRowPitch,
const std::vector<event> &DepEvents,
1639 DeviceRowPitch, HostExtent, CopyExtent);
1693 uint64_t WaitValue,
const std::vector<event> &DepEvents,
1752 uint64_t SignalValue,
event DepEvent,
1765 uint64_t SignalValue,
const std::vector<event> &DepEvents,
The context class represents a SYCL context on which kernel functions may be executed.
Data type that manages the code_location information in TLS.
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
A class that represents image memory.
Command group handler class.
void depends_on(event Event)
Registers event dependencies on this command group.
void ext_oneapi_signal_external_semaphore(ext::oneapi::experimental::interop_semaphore_handle SemaphoreHandle)
Instruct the queue to signal the external semaphore once all previous commands submitted to the queue...
void ext_oneapi_wait_external_semaphore(ext::oneapi::experimental::interop_semaphore_handle SemaphoreHandle)
Submit a non-blocking device-side wait on an external.
void ext_oneapi_copy(const void *Src, ext::oneapi::experimental::image_mem_handle Dest, const ext::oneapi::experimental::image_descriptor &DestImgDesc)
Copies data from one memory region to another, where Src is a USM pointer and Dest is an opaque image...
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
event ext_oneapi_wait_external_semaphore(sycl::ext::oneapi::experimental::interop_semaphore_handle SemaphoreHandle, const detail::code_location &CodeLoc=detail::code_location::current())
Instruct the queue with a non-blocking wait on an external semaphore.
event ext_oneapi_signal_external_semaphore(sycl::ext::oneapi::experimental::interop_semaphore_handle SemaphoreHandle, const detail::code_location &CodeLoc=detail::code_location::current())
Instruct the queue to signal the external semaphore once all previous commands have completed executi...
event ext_oneapi_copy(const void *Src, ext::oneapi::experimental::image_mem_handle Dest, const ext::oneapi::experimental::image_descriptor &DestImgDesc, const detail::code_location &CodeLoc=detail::code_location::current())
Copies data from one memory region to another, where Src is a USM pointer and Dest is an opaque image...
std::enable_if_t< std::is_invocable_r_v< void, T, handler & >, event > submit(T CGF, const detail::code_location &CodeLoc=detail::code_location::current())
Submits a command group function object to the queue, in order to be scheduled for execution on the d...
Defines the iteration domain of either a single work-group in a parallel dispatch,...
void write(GlobalBufAccessorT &GlobalFlushBuf, size_t FlushBufferSize, unsigned WIOffset, const char *Str, unsigned Len, unsigned Padding=0)
constexpr size_t coord_size()
constexpr bool is_data_size_valid()
constexpr bool is_recognized_standard_type()
constexpr void assert_fetch_coords()
constexpr bool are_floating_coords()
constexpr void assert_sample_coords()
constexpr void assert_unsampled_coords()
constexpr auto convert_color(DataT Color)
constexpr void assert_coords_type()
constexpr bool are_integer_coords()
void release_external_semaphore(interop_semaphore_handle semaphoreHandle, const sycl::device &syclDevice, const sycl::context &syclContext)
Release the external semaphore.
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.
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.
DataT sample_cubemap(const sampled_image_handle &imageHandle[[maybe_unused]], const sycl::float3 &dirVec[[maybe_unused]])
Sample a cubemap 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.
DataT fetch_image_array(const unsampled_image_handle &imageHandle[[maybe_unused]], const CoordT &coords[[maybe_unused]], unsigned int arrayLayer[[maybe_unused]])
Fetch data from an unsampled image array using its handle.
void free_image_mem(image_mem_handle handle, image_type imageType, const sycl::device &syclDevice, const sycl::context &syclContext)
Free image memory.
image_mem_handle get_mip_level_mem_handle(const image_mem_handle mipMem, unsigned int level, const sycl::device &syclDevice, const sycl::context &syclContext)
Retrieve the memory handle to an individual mipmap image.
void write_cubemap(unsampled_image_handle imageHandle, const sycl::int2 &coords, int face, const DataT &color)
Write to an unsampled cubemap using its handle.
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.
void write_image_array(unsampled_image_handle imageHandle[[maybe_unused]], const CoordT &coords[[maybe_unused]], unsigned int arrayLayer[[maybe_unused]], const DataT &color[[maybe_unused]])
Write to an unsampled image array using its handle.
DataT fetch_image(const unsampled_image_handle &imageHandle[[maybe_unused]], const CoordT &coords[[maybe_unused]])
Fetch data from 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.
void release_external_memory(interop_mem_handle interopHandle, const sycl::device &syclDevice, const sycl::context &syclContext)
Release external memory.
DataT sample_image_array(const sampled_image_handle &imageHandle[[maybe_unused]], const CoordT &coords[[maybe_unused]], unsigned int arrayLayer[[maybe_unused]])
Sample data from a sampled image array using its handle.
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.
DataT fetch_cubemap(const unsampled_image_handle &imageHandle, const int2 &coords, unsigned int face)
Fetch data from an unsampled cubemap image using its handle.
image_type
image type enum
void write_image(unsampled_image_handle imageHandle[[maybe_unused]], const CoordT &coords[[maybe_unused]], const DataT &color[[maybe_unused]])
Write to an unsampled image using its handle.
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.
static constexpr bool value
Opaque external memory descriptor type.
A struct to describe the properties of an image.
Opaque image memory handle type.
Opaque interop memory handle type.
Opaque interop semaphore handle type.
Opaque sampled image handle type.
raw_image_handle_type raw_handle
sampled_image_handle(raw_image_handle_type handle)
uint64_t raw_image_handle_type
Opaque unsampled image handle type.
raw_image_handle_type raw_handle
unsampled_image_handle(raw_image_handle_type raw_image_handle)
uint64_t raw_image_handle_type