pub unsafe extern "C" fn cudaSignalExternalSemaphoresAsync_v2(
extSemArray: *const cudaExternalSemaphore_t,
paramsArray: *const cudaExternalSemaphoreSignalParams,
numExtSems: c_uint,
stream: cudaStream_t,
) -> cudaError_t
Expand description
\brief Signals a set of external semaphore objects
Enqueues a signal operation on a set of externally allocated semaphore object in the specified stream. The operations will be executed when all prior operations in the stream complete.
The exact semantics of signaling a semaphore depends on the type of the object.
If the semaphore object is any one of the following types: ::cudaExternalSemaphoreHandleTypeOpaqueFd, ::cudaExternalSemaphoreHandleTypeOpaqueWin32, ::cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt then signaling the semaphore will set it to the signaled state.
If the semaphore object is any one of the following types: ::cudaExternalSemaphoreHandleTypeD3D12Fence, ::cudaExternalSemaphoreHandleTypeD3D11Fence, ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd, ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 then the semaphore will be set to the value specified in ::cudaExternalSemaphoreSignalParams::params::fence::value.
If the semaphore object is of the type ::cudaExternalSemaphoreHandleTypeNvSciSync this API sets ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence to a value that can be used by subsequent waiters of the same NvSciSync object to order operations with those currently submitted in \p stream. Such an update will overwrite previous contents of ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence. By default, signaling such an external semaphore object causes appropriate memory synchronization operations to be performed over all the external memory objects that are imported as ::cudaExternalMemoryHandleTypeNvSciBuf. This ensures that any subsequent accesses made by other importers of the same set of NvSciBuf memory object(s) are coherent. These operations can be skipped by specifying the flag ::cudaExternalSemaphoreSignalSkipNvSciBufMemSync, which can be used as a performance optimization when data coherency is not required. But specifying this flag in scenarios where data coherency is required results in undefined behavior. Also, for semaphore object of the type ::cudaExternalSemaphoreHandleTypeNvSciSync, if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in ::cudaDeviceGetNvSciSyncAttributes to cudaNvSciSyncAttrSignal, this API will return cudaErrorNotSupported.
::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence associated with semaphore object of the type ::cudaExternalSemaphoreHandleTypeNvSciSync can be deterministic. For this the NvSciSyncAttrList used to create the semaphore object must have value of NvSciSyncAttrKey_RequireDeterministicFences key set to true. Deterministic fences allow users to enqueue a wait over the semaphore object even before corresponding signal is enqueued. For such a semaphore object, CUDA guarantees that each signal operation will increment the fence value by ‘1’. Users are expected to track count of signals enqueued on the semaphore object and insert waits accordingly. When such a semaphore object is signaled from multiple streams, due to concurrent stream execution, it is possible that the order in which the semaphore gets signaled is indeterministic. This could lead to waiters of the semaphore getting unblocked incorrectly. Users are expected to handle such situations, either by not using the same semaphore object with deterministic fence support enabled in different streams or by adding explicit dependency amongst such streams so that the semaphore is signaled in order.
If the semaphore object is any one of the following types: ::cudaExternalSemaphoreHandleTypeKeyedMutex, ::cudaExternalSemaphoreHandleTypeKeyedMutexKmt, then the keyed mutex will be released with the key specified in ::cudaExternalSemaphoreSignalParams::params::keyedmutex::key.
\param extSemArray - Set of external semaphores to be signaled \param paramsArray - Array of semaphore parameters \param numExtSems - Number of semaphores to signal \param stream - Stream to enqueue the signal operations in
\return ::cudaSuccess, ::cudaErrorInvalidResourceHandle \notefnerr \note_init_rt \note_callback
\sa ::cudaImportExternalSemaphore, ::cudaDestroyExternalSemaphore, ::cudaWaitExternalSemaphoresAsync