Skip to content
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

[SYCL][Bindless][Doc][ABI-Break] Rename external semaphore destroy to release #14535

Merged
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -1903,17 +1903,18 @@ the `ext_oneapi_signal_external_semaphore` call complete.
`ext_oneapi_wait_external_semaphore` and `ext_oneapi_signal_external_semaphore`
are non-blocking, asynchronous operations.

The user must ensure to destroy all external semaphore objects once they are no
longer required through `destroy_external_semaphore`.
The user must ensure to destroy all SYCL external semaphore objects used to
access the external semaphore once they are no longer required through
`release_external_semaphore`.

```cpp
namespace sycl::ext::oneapi::experimental {

void destroy_external_semaphore(interop_semaphore_handle semaphoreHandle,
void release_external_semaphore(interop_semaphore_handle semaphoreHandle,
const sycl::device &syclDevice,
const sycl::context &syclContext);

void destroy_external_semaphore(interop_semaphore_handle semaphoreHandle,
void release_external_semaphore(interop_semaphore_handle semaphoreHandle,
const sycl::queue &syclQueue);

}
Expand Down Expand Up @@ -2579,9 +2580,9 @@ try {
input_interop_mem_handle, queue);
sycl::ext::oneapi::experimental::release_external_memory(
output_interop_mem_handle, queue);
sycl::ext::oneapi::experimental::destroy_external_semaphore(
sycl::ext::oneapi::experimental::release_external_semaphore(
wait_interop_semaphore_handle, queue);
sycl::ext::oneapi::experimental::destroy_external_semaphore(
sycl::ext::oneapi::experimental::release_external_semaphore(
done_interop_semaphore_handle, queue);
sycl::ext::oneapi::experimental::destroy_image_handle(img_input, queue);
sycl::ext::oneapi::experimental::destroy_image_handle(img_output, queue);
Expand Down Expand Up @@ -2806,4 +2807,6 @@ These features still need to be handled:
|5.12|2024-06-19| - Add support for sampled image arrays.
- Sample image arrays with `sample_image_array` API.
- Fetch sampled image arrays with `fetch_image_array` API.
|5.13|2024-07-10| - Rename `destroy_external_semaphore` to
`release_external_semaphore`.
|======================
2 changes: 1 addition & 1 deletion sycl/include/sycl/detail/pi.def
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ _PI_API(piextMemReleaseInterop)
_PI_API(piextMemMapExternalArray)
_PI_API(piextImportExternalSemaphoreOpaqueFD)
_PI_API(piextImportExternalSemaphore)
_PI_API(piextDestroyExternalSemaphore)
_PI_API(piextReleaseExternalSemaphore)
_PI_API(piextWaitExternalSemaphore)
_PI_API(piextSignalExternalSemaphore)

Expand Down
9 changes: 5 additions & 4 deletions sycl/include/sycl/detail/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,10 @@
// 16.56 Replaced piextUSMEnqueueMemset with piextUSMEnqueueFill
// 16.57 Added mappings to UR launch properties extension
// (piextEnqueueKernelLaunchCustom)
// 17.58 Rename piextDestroyExternalSemaphore to piextReleaseExternalSemaphore

#define _PI_H_VERSION_MAJOR 16
#define _PI_H_VERSION_MINOR 57
#define _PI_H_VERSION_MAJOR 17
#define _PI_H_VERSION_MINOR 58

#define _PI_STRING_HELPER(a) #a
#define _PI_CONCAT(a, b) _PI_STRING_HELPER(a.b)
Expand Down Expand Up @@ -3190,14 +3191,14 @@ piextImportExternalSemaphore(pi_context context, pi_device device,
pi_external_semaphore_descriptor *sem_descriptor,
pi_interop_semaphore_handle *ret_handle);

/// API to destroy the external semaphore handle.
/// API to release the external semaphore.
///
/// \param context is the pi_context
/// \param device is the pi_device
/// \param sem_handle is the interop semaphore handle to the external semaphore
/// to be destroyed
__SYCL_EXPORT pi_result
piextDestroyExternalSemaphore(pi_context context, pi_device device,
piextReleaseExternalSemaphore(pi_context context, pi_device device,
pi_interop_semaphore_handle sem_handle);

/// API to instruct the queue with a non-blocking wait on an external semaphore.
Expand Down
8 changes: 4 additions & 4 deletions sycl/include/sycl/ext/oneapi/bindless_images.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ __SYCL_EXPORT interop_semaphore_handle import_external_semaphore(
const sycl::queue &syclQueue);

/**
* @brief Destroy the external semaphore handle
* @brief Release the external semaphore
*
* @param semaphoreHandle The interop semaphore handle to destroy
* @param syclDevice The device in which the interop semaphore handle was
Expand All @@ -337,19 +337,19 @@ __SYCL_EXPORT interop_semaphore_handle import_external_semaphore(
* created
*/
__SYCL_EXPORT void
destroy_external_semaphore(interop_semaphore_handle semaphoreHandle,
release_external_semaphore(interop_semaphore_handle semaphoreHandle,
const sycl::device &syclDevice,
const sycl::context &syclContext);

/**
* @brief Destroy the external semaphore handle
* @brief Release the external semaphore
*
* @param semaphoreHandle The interop semaphore handle to destroy
* @param syclQueue The queue in which the interop semaphore handle was
* created
*/
__SYCL_EXPORT void
destroy_external_semaphore(interop_semaphore_handle semaphoreHandle,
release_external_semaphore(interop_semaphore_handle semaphoreHandle,
const sycl::queue &syclQueue);

/**
Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,9 @@ piextImportExternalSemaphore(pi_context Context, pi_device Device,
}

__SYCL_EXPORT pi_result
piextDestroyExternalSemaphore(pi_context Context, pi_device Device,
piextReleaseExternalSemaphore(pi_context Context, pi_device Device,
pi_interop_semaphore_handle SemHandle) {
return pi2ur::piextDestroyExternalSemaphore(Context, Device, SemHandle);
return pi2ur::piextReleaseExternalSemaphore(Context, Device, SemHandle);
}

__SYCL_EXPORT pi_result piextWaitExternalSemaphore(
Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/hip/pi_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@ piextImportExternalSemaphore(pi_context Context, pi_device Device,
}

__SYCL_EXPORT pi_result
piextDestroyExternalSemaphore(pi_context Context, pi_device Device,
piextReleaseExternalSemaphore(pi_context Context, pi_device Device,
pi_interop_semaphore_handle SemHandle) {
return pi2ur::piextDestroyExternalSemaphore(Context, Device, SemHandle);
return pi2ur::piextReleaseExternalSemaphore(Context, Device, SemHandle);
}

__SYCL_EXPORT pi_result piextWaitExternalSemaphore(
Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,9 @@ piextImportExternalSemaphore(pi_context Context, pi_device Device,
}

__SYCL_EXPORT pi_result
piextDestroyExternalSemaphore(pi_context Context, pi_device Device,
piextReleaseExternalSemaphore(pi_context Context, pi_device Device,
pi_interop_semaphore_handle SemHandle) {
return pi2ur::piextDestroyExternalSemaphore(Context, Device, SemHandle);
return pi2ur::piextReleaseExternalSemaphore(Context, Device, SemHandle);
}

__SYCL_EXPORT pi_result piextWaitExternalSemaphore(
Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/native_cpu/pi_native_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,9 @@ piextImportExternalSemaphore(pi_context Context, pi_device Device,
}

__SYCL_EXPORT pi_result
piextDestroyExternalSemaphore(pi_context Context, pi_device Device,
piextReleaseExternalSemaphore(pi_context Context, pi_device Device,
pi_interop_semaphore_handle SemHandle) {
return pi2ur::piextDestroyExternalSemaphore(Context, Device, SemHandle);
return pi2ur::piextReleaseExternalSemaphore(Context, Device, SemHandle);
}

__SYCL_EXPORT pi_result piextWaitExternalSemaphore(
Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/opencl/pi_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,9 @@ piextImportExternalSemaphore(pi_context Context, pi_device Device,
RetHandle);
}

pi_result piextDestroyExternalSemaphore(pi_context Context, pi_device Device,
pi_result piextReleaseExternalSemaphore(pi_context Context, pi_device Device,
pi_interop_semaphore_handle SemHandle) {
return pi2ur::piextDestroyExternalSemaphore(Context, Device, SemHandle);
return pi2ur::piextReleaseExternalSemaphore(Context, Device, SemHandle);
}

__SYCL_EXPORT pi_result piextWaitExternalSemaphore(
Expand Down
14 changes: 7 additions & 7 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
CACHE PATH "Path to external '${name}' adapter source dir" FORCE)
endfunction()

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
# commit 529e8b9c34acd231eb5b829f6af8123e5f09c974
# Merge: 6b33a1bb 5dc794cb
set(UNIFIED_RUNTIME_REPO "https://github.com/Seanst98/unified-runtime.git")
# commit 9d3bce6ad92e6f0a4af0139f9744584b5a402827
# Merge: e0775441 1c9c2d0b
# Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
# Date: Wed Jul 10 15:05:31 2024 +0100
# Merge pull request #1816 from nrspruit/l0_intel_driver_version
# [L0] Use Intel Level Zero Driver String extension
set(UNIFIED_RUNTIME_TAG 529e8b9c34acd231eb5b829f6af8123e5f09c974)
# Date: Tue Jul 9 15:57:44 2024 +0100
# Merge pull request #1822 from JackAKirk/cuda-cubemap-driver-fix
# [cuda][bindless_images][2025.0 req] Fix for cuda < 11.6 support.
set(UNIFIED_RUNTIME_TAG e7e465f59c7a76d2be0d1144521820853ca90b58)

fetch_adapter_source(level_zero
${UNIFIED_RUNTIME_REPO}
Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/unified_runtime/pi2ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5674,7 +5674,7 @@ piextImportExternalSemaphore(pi_context Context, pi_device Device,
}

inline pi_result
piextDestroyExternalSemaphore(pi_context Context, pi_device Device,
piextReleaseExternalSemaphore(pi_context Context, pi_device Device,
pi_interop_semaphore_handle SemHandle) {
PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
Expand All @@ -5684,7 +5684,7 @@ piextDestroyExternalSemaphore(pi_context Context, pi_device Device,
auto UrSemHandle =
reinterpret_cast<ur_exp_interop_semaphore_handle_t>(SemHandle);

HANDLE_ERRORS(urBindlessImagesDestroyExternalSemaphoreExp(UrContext, UrDevice,
HANDLE_ERRORS(urBindlessImagesReleaseExternalSemaphoreExp(UrContext, UrDevice,
UrSemHandle));

return PI_SUCCESS;
Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/unified_runtime/pi_unified_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1437,9 +1437,9 @@ piextImportExternalSemaphore(pi_context Context, pi_device Device,
}

__SYCL_EXPORT pi_result
piextDestroyExternalSemaphore(pi_context Context, pi_device Device,
piextReleaseExternalSemaphore(pi_context Context, pi_device Device,
pi_interop_semaphore_handle SemHandle) {
return pi2ur::piextDestroyExternalSemaphore(Context, Device, SemHandle);
return pi2ur::piextReleaseExternalSemaphore(Context, Device, SemHandle);
}

__SYCL_EXPORT pi_result piextWaitExternalSemaphore(
Expand Down
8 changes: 4 additions & 4 deletions sycl/source/detail/bindless_images.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ interop_semaphore_handle import_external_semaphore(
}

__SYCL_EXPORT void
destroy_external_semaphore(interop_semaphore_handle semaphoreHandle,
release_external_semaphore(interop_semaphore_handle semaphoreHandle,
const sycl::device &syclDevice,
const sycl::context &syclContext) {
std::shared_ptr<sycl::detail::context_impl> CtxImpl =
Expand All @@ -779,14 +779,14 @@ destroy_external_semaphore(interop_semaphore_handle semaphoreHandle,
pi_device Device = DevImpl->getHandleRef();

Plugin->call<sycl::errc::invalid,
sycl::detail::PiApiKind::piextDestroyExternalSemaphore>(
sycl::detail::PiApiKind::piextReleaseExternalSemaphore>(
C, Device, (pi_interop_semaphore_handle)semaphoreHandle.raw_handle);
}

__SYCL_EXPORT void
destroy_external_semaphore(interop_semaphore_handle semaphoreHandle,
release_external_semaphore(interop_semaphore_handle semaphoreHandle,
const sycl::queue &syclQueue) {
destroy_external_semaphore(semaphoreHandle, syclQueue.get_device(),
release_external_semaphore(semaphoreHandle, syclQueue.get_device(),
syclQueue.get_context());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ create_test_handles(sycl::context &ctxt, sycl::device &dev,
}

void cleanup_test(sycl::context &ctxt, sycl::device &dev, handles_t handles) {
syclexp::destroy_external_semaphore(
syclexp::release_external_semaphore(
handles.sycl_wait_interop_semaphore_handle, dev, ctxt);
syclexp::destroy_external_semaphore(
syclexp::release_external_semaphore(
handles.sycl_done_interop_semaphore_handle, dev, ctxt);
syclexp::destroy_image_handle(handles.input_1, dev, ctxt);
syclexp::destroy_image_handle(handles.input_2, dev, ctxt);
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/abi/pi_cuda_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ piextCommandBufferUpdateKernelLaunch
piextContextCreateWithNativeHandle
piextContextGetNativeHandle
piextContextSetExtendedDeleter
piextDestroyExternalSemaphore
piextDeviceCreateWithNativeHandle
piextDeviceGetNativeHandle
piextDeviceSelectBinary
piextDisablePeerAccess
piextEnablePeerAccess
piextEnqueueCommandBuffer
piextEnqueueCooperativeKernelLaunch
piextEnqueueKernelLaunchCustom
piextEnqueueNativeCommand
piextEnqueueReadHostPipe
piextEnqueueWriteHostPipe
Expand Down Expand Up @@ -159,6 +159,7 @@ piextProgramSetSpecializationConstant
piextQueueCreate
piextQueueCreateWithNativeHandle
piextQueueGetNativeHandle
piextReleaseExternalSemaphore
piextSignalExternalSemaphore
piextUSMDeviceAlloc
piextUSMEnqueueFill
Expand All @@ -183,4 +184,3 @@ piextVirtualMemReserve
piextVirtualMemSetAccess
piextVirtualMemUnmap
piextWaitExternalSemaphore
piextEnqueueKernelLaunchCustom
2 changes: 1 addition & 1 deletion sycl/test/abi/pi_hip_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ piextCommandBufferUpdateKernelLaunch
piextContextCreateWithNativeHandle
piextContextGetNativeHandle
piextContextSetExtendedDeleter
piextDestroyExternalSemaphore
piextReleaseExternalSemaphore
piextDeviceCreateWithNativeHandle
piextDeviceGetNativeHandle
piextDeviceSelectBinary
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/abi/pi_level_zero_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ piextCommandBufferUpdateKernelLaunch
piextContextCreateWithNativeHandle
piextContextGetNativeHandle
piextContextSetExtendedDeleter
piextDestroyExternalSemaphore
piextDeviceCreateWithNativeHandle
piextDeviceGetNativeHandle
piextDeviceSelectBinary
piextDisablePeerAccess
piextEnablePeerAccess
piextEnqueueCommandBuffer
piextEnqueueCooperativeKernelLaunch
piextEnqueueKernelLaunchCustom
piextEnqueueNativeCommand
piextEnqueueReadHostPipe
piextEnqueueWriteHostPipe
Expand Down Expand Up @@ -158,6 +158,7 @@ piextProgramSetSpecializationConstant
piextQueueCreate
piextQueueCreateWithNativeHandle
piextQueueGetNativeHandle
piextReleaseExternalSemaphore
piextSignalExternalSemaphore
piextUSMDeviceAlloc
piextUSMEnqueueFill
Expand All @@ -182,4 +183,3 @@ piextVirtualMemReserve
piextVirtualMemSetAccess
piextVirtualMemUnmap
piextWaitExternalSemaphore
piextEnqueueKernelLaunchCustom
2 changes: 1 addition & 1 deletion sycl/test/abi/pi_nativecpu_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ piextCommandBufferUpdateKernelLaunch
piextContextCreateWithNativeHandle
piextContextGetNativeHandle
piextContextSetExtendedDeleter
piextDestroyExternalSemaphore
piextReleaseExternalSemaphore
piextDeviceCreateWithNativeHandle
piextDeviceGetNativeHandle
piextDeviceSelectBinary
Expand Down
10 changes: 5 additions & 5 deletions sycl/test/abi/pi_opencl_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ piextCommandBufferUpdateKernelLaunch
piextContextCreateWithNativeHandle
piextContextGetNativeHandle
piextContextSetExtendedDeleter
piextDestroyExternalSemaphore
piextDeviceCreateWithNativeHandle
piextDeviceGetNativeHandle
piextDeviceSelectBinary
piextDisablePeerAccess
piextEnablePeerAccess
piextEnqueueCommandBuffer
piextEnqueueCooperativeKernelLaunch
piextEnqueueKernelLaunchCustom
piextEnqueueNativeCommand
piextEnqueueReadHostPipe
piextEnqueueWriteHostPipe
Expand All @@ -134,9 +134,6 @@ piextMemGetNativeHandle
piextMemImageAllocate
piextMemImageCopy
piextMemImageCreateWithNativeHandle
piextPhysicalMemCreate
piextPhysicalMemRelease
piextPhysicalMemRetain
piextMemImageFree
piextMemImageGetInfo
piextMemImportOpaqueFD
Expand All @@ -149,6 +146,9 @@ piextMemSampledImageHandleDestroy
piextMemUnsampledImageCreate
piextMemUnsampledImageHandleDestroy
piextPeerAccessGetInfo
piextPhysicalMemCreate
piextPhysicalMemRelease
piextPhysicalMemRetain
piextPlatformCreateWithNativeHandle
piextPlatformGetNativeHandle
piextPluginGetOpaqueData
Expand All @@ -158,6 +158,7 @@ piextProgramSetSpecializationConstant
piextQueueCreate
piextQueueCreateWithNativeHandle
piextQueueGetNativeHandle
piextReleaseExternalSemaphore
piextSignalExternalSemaphore
piextUSMDeviceAlloc
piextUSMEnqueueFill
Expand All @@ -182,4 +183,3 @@ piextVirtualMemReserve
piextVirtualMemSetAccess
piextVirtualMemUnmap
piextWaitExternalSemaphore
piextEnqueueKernelLaunchCustom
Loading