Skip to content

[SYCL][Bindless] Change the name of map_external_memory_array #11681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1238,12 +1238,12 @@ interop_mem_handle import_external_memory(
external_mem_descriptor<external_mem_handle_type> externalMemDescriptor,
const sycl::queue &syclQueue);

image_mem_handle map_external_memory_array(
image_mem_handle map_external_image_memory(
interop_mem_handle interopMemHandle,
const image_descriptor &imageDescriptor,
const sycl::device &syclDevice,
const sycl::context &syclContext);
image_mem_handle map_external_memory_array(
image_mem_handle map_external_image_memory(
interop_mem_handle interopMemHandle,
const image_descriptor &imageDescriptor,
const sycl::queue &syclQueue);
Expand Down Expand Up @@ -1784,10 +1784,10 @@ try {

// Extension: map imported external memory to image memory
sycl::ext::oneapi::experimental::image_mem_handle input_mapped_mem_handle =
sycl::ext::oneapi::experimental::map_external_memory_array(
sycl::ext::oneapi::experimental::map_external_image_memory(
input_interop_mem_handle, desc, queue);
sycl::ext::oneapi::experimental::image_mem_handle output_mapped_mem_handle =
sycl::ext::oneapi::experimental::map_external_memory_array(
sycl::ext::oneapi::experimental::map_external_image_memory(
output_interop_mem_handle, desc, queue);

// Extension: create images from mapped memory and return the handles
Expand Down Expand Up @@ -1995,4 +1995,6 @@ These features still need to be handled:
|4.6|2023-09-19| - Clarify restrictions on reading/writing coordinate types
|4.7|2023-10-16| - Introduce `read_mipmap` for mipmap access and clarify reading
restrictions on image types
|4.8|2023-10-25| - Change the name of `map_external_memory_array` to
`map_external_image_memory` to avoid CUDA terminology
|======================
47 changes: 41 additions & 6 deletions sycl/include/sycl/ext/oneapi/bindless_images.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,38 @@ __SYCL_EXPORT interop_mem_handle import_external_memory(
external_mem_descriptor<ExternalMemHandleType> externalMem,
const sycl::queue &syclQueue);

/**
* @brief [Deprecated] Maps an interop memory handle to an image memory
* handle (which may have a device optimized memory layout)
*
* @param memHandle Interop memory handle
* @param desc The image descriptor
* @param syclDevice The device in which we create our image memory handle
* @param syclContext The conext in which we create our image memory handle
* @return Memory handle to externally allocated memory on the device
*/
__SYCL_EXPORT_DEPRECATED("map_external_memory_array is deprecated."
"use map_external_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);

/**
* @brief [Deprecated] Maps an interop memory handle to an image memory
* handle (which may have a device optimized memory layout)
*
* @param memHandle Interop memory handle
* @param desc The image descriptor
* @param syclQueue The queue in which we create our image memory handle
* @return Memory handle to externally allocated memory on the device
*/
__SYCL_EXPORT_DEPRECATED("map_external_memory_array is deprecated."
"use map_external_image_memory")
image_mem_handle map_external_memory_array(interop_mem_handle memHandle,
const image_descriptor &desc,
const sycl::queue &syclQueue);

/**
* @brief Maps an interop memory handle to an image memory handle (which may
* have a device optimized memory layout)
Expand All @@ -223,9 +255,11 @@ __SYCL_EXPORT interop_mem_handle import_external_memory(
* @param syclContext The conext in which we create our image memory handle
* @return Memory handle to externally allocated memory on the device
*/
__SYCL_EXPORT image_mem_handle map_external_memory_array(
interop_mem_handle memHandle, const image_descriptor &desc,
const sycl::device &syclDevice, const sycl::context &syclContext);
__SYCL_EXPORT
image_mem_handle map_external_image_memory(interop_mem_handle memHandle,
const image_descriptor &desc,
const sycl::device &syclDevice,
const sycl::context &syclContext);

/**
* @brief Maps an interop memory handle to an image memory handle (which may
Expand All @@ -236,9 +270,10 @@ __SYCL_EXPORT image_mem_handle map_external_memory_array(
* @param syclQueue The queue in which we create our image memory handle
* @return Memory handle to externally allocated memory on the device
*/
__SYCL_EXPORT image_mem_handle map_external_memory_array(
interop_mem_handle memHandle, const image_descriptor &desc,
const sycl::queue &syclQueue);
__SYCL_EXPORT
image_mem_handle map_external_image_memory(interop_mem_handle memHandle,
const image_descriptor &desc,
const sycl::queue &syclQueue);

/**
* @brief Import external semaphore taking an external semaphore handle (the
Expand Down
33 changes: 27 additions & 6 deletions sycl/source/detail/bindless_images.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,11 @@ __SYCL_EXPORT interop_mem_handle import_external_memory<external_mem_fd>(
externalMem, syclQueue.get_device(), syclQueue.get_context());
}

__SYCL_EXPORT image_mem_handle map_external_memory_array(
interop_mem_handle memHandle, const image_descriptor &desc,
const sycl::device &syclDevice, const sycl::context &syclContext) {
__SYCL_EXPORT
image_mem_handle map_external_image_memory(interop_mem_handle memHandle,
const image_descriptor &desc,
const sycl::device &syclDevice,
const sycl::context &syclContext) {
std::shared_ptr<sycl::detail::context_impl> CtxImpl =
sycl::detail::getSyclObjImpl(syclContext);
pi_context C = CtxImpl->getHandleRef();
Expand All @@ -551,9 +553,28 @@ __SYCL_EXPORT image_mem_handle map_external_memory_array(
return image_mem_handle{retHandle};
}

__SYCL_EXPORT image_mem_handle map_external_memory_array(
interop_mem_handle memHandle, const image_descriptor &desc,
const sycl::queue &syclQueue) {
__SYCL_EXPORT
image_mem_handle map_external_image_memory(interop_mem_handle memHandle,
const image_descriptor &desc,
const sycl::queue &syclQueue) {
return map_external_image_memory(memHandle, desc, syclQueue.get_device(),
syclQueue.get_context());
}

__SYCL_EXPORT_DEPRECATED("map_external_memory_array is deprecated."
"use map_external_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) {
return map_external_image_memory(memHandle, desc, syclDevice, syclContext);
}

__SYCL_EXPORT_DEPRECATED("map_external_memory_array is deprecated."
"use map_external_image_memory")
image_mem_handle map_external_memory_array(interop_mem_handle memHandle,
const image_descriptor &desc,
const sycl::queue &syclQueue) {
return map_external_memory_array(memHandle, desc, syclQueue.get_device(),
syclQueue.get_context());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ handles_t create_test_handles(

// Extension: interop mem handle imported from file descriptor
syclexp::image_mem_handle inputMappedMemHandle =
syclexp::map_external_memory_array(inputInteropMemHandle, desc, dev,
syclexp::map_external_image_memory(inputInteropMemHandle, desc, dev,
ctxt);

// Extension: create the image and return the handle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ create_test_handles(sycl::context &ctxt, sycl::device &dev,

// Extension: map image memory handles
syclexp::image_mem_handle input_mapped_mem_handle_1 =
syclexp::map_external_memory_array(input_interop_mem_handle_1, desc, dev,
syclexp::map_external_image_memory(input_interop_mem_handle_1, desc, dev,
ctxt);
syclexp::image_mem_handle input_mapped_mem_handle_2 =
syclexp::map_external_memory_array(input_interop_mem_handle_2, desc, dev,
syclexp::map_external_image_memory(input_interop_mem_handle_2, desc, dev,
ctxt);
syclexp::image_mem_handle output_mapped_mem_handle =
syclexp::map_external_memory_array(output_interop_mem_handle, desc, dev,
syclexp::map_external_image_memory(output_interop_mem_handle, desc, dev,
ctxt);

// Extension: create the image and return the handle
Expand Down
2 changes: 2 additions & 0 deletions sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
Expand Up @@ -3707,6 +3707,8 @@ _ZN4sycl3_V13ext6oneapi12experimental24release_from_device_copyEPKvRKNS0_5queueE
_ZN4sycl3_V13ext6oneapi12experimental24release_from_device_copyEPKvRKNS0_7contextE
_ZN4sycl3_V13ext6oneapi12experimental25import_external_semaphoreINS3_21external_semaphore_fdEEENS3_24interop_semaphore_handleENS3_29external_semaphore_descriptorIT_EERKNS0_5queueE
_ZN4sycl3_V13ext6oneapi12experimental25import_external_semaphoreINS3_21external_semaphore_fdEEENS3_24interop_semaphore_handleENS3_29external_semaphore_descriptorIT_EERKNS0_6deviceERKNS0_7contextE
_ZN4sycl3_V13ext6oneapi12experimental25map_external_image_memoryENS3_18interop_mem_handleERKNS3_16image_descriptorERKNS0_5queueE
_ZN4sycl3_V13ext6oneapi12experimental25map_external_image_memoryENS3_18interop_mem_handleERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE
_ZN4sycl3_V13ext6oneapi12experimental25map_external_memory_arrayENS3_18interop_mem_handleERKNS3_16image_descriptorERKNS0_5queueE
_ZN4sycl3_V13ext6oneapi12experimental25map_external_memory_arrayENS3_18interop_mem_handleERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE
_ZN4sycl3_V13ext6oneapi12experimental26destroy_external_semaphoreENS3_24interop_semaphore_handleERKNS0_5queueE
Expand Down
2 changes: 2 additions & 0 deletions sycl/test/abi/sycl_symbols_windows.dump
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,8 @@
?malloc_shared@_V1@sycl@@YAPEAX_KAEBVqueue@12@AEBUcode_location@detail@12@@Z
?malloc_shared@_V1@sycl@@YAPEAX_KAEBVqueue@12@AEBVproperty_list@12@AEBUcode_location@detail@12@@Z
?map@MemoryManager@detail@_V1@sycl@@SAPEAXPEAVSYCLMemObjI@234@PEAXV?$shared_ptr@Vqueue_impl@detail@_V1@sycl@@@std@@W4mode@access@34@IV?$range@$02@34@4V?$id@$02@34@IV?$vector@PEAU_pi_event@@V?$allocator@PEAU_pi_event@@@std@@@7@AEAPEAU_pi_event@@@Z
?map_external_image_memory@experimental@oneapi@ext@_V1@sycl@@YA?AUimage_mem_handle@12345@Uinterop_mem_handle@12345@AEBUimage_descriptor@12345@AEBVdevice@45@AEBVcontext@45@@Z
?map_external_image_memory@experimental@oneapi@ext@_V1@sycl@@YA?AUimage_mem_handle@12345@Uinterop_mem_handle@12345@AEBUimage_descriptor@12345@AEBVqueue@45@@Z
?map_external_memory_array@experimental@oneapi@ext@_V1@sycl@@YA?AUimage_mem_handle@12345@Uinterop_mem_handle@12345@AEBUimage_descriptor@12345@AEBVdevice@45@AEBVcontext@45@@Z
?map_external_memory_array@experimental@oneapi@ext@_V1@sycl@@YA?AUimage_mem_handle@12345@Uinterop_mem_handle@12345@AEBUimage_descriptor@12345@AEBVqueue@45@@Z
?markAsInternal@SYCLMemObjT@detail@_V1@sycl@@QEAAXXZ
Expand Down