Wait for an NvSciSyncFence#
VkFence (CPU Wait Only)#
Use vkImportFenceSciSyncFenceNV
to import an NvSciSyncFence
to the VkFence
. This API takes a valid NvSciSyncFence
as a parameter to VkImportFenceSciSyncInfoNV::handle
. The applications must specifyVkImportFenceSciSyncInfoNV::handleType
to VK_EXTERNAL_FENCE_HANDLE_TYPE_SCI_SYNC_FENCE_BIT_NV
. On completion, use thevkWaitForFences
API to perform the CPU wait until the imported NvSciSyncFence
is signaled by the relevant signaler or timeout occurs.
VkSemaphore#
Use the vkCreateSemaphore
API to retrieve a VkSemaphore
object from the VkSemaphoreSciSyncPoolNV
object according to the input NvSciSyncFence
. This API takes a valid VkSemaphoreCreateInfo
struct as a parameter. Application must chain a VkSemaphoreSciSyncCreateInfoNV
struct to the VkSemaphoreCreateInfo::pNext
with VkSemaphoreSciSyncCreateInfoNV::semaphorePool
of a valid VkSemaphoreSciSyncPoolNV
object and VkSemaphoreSciSyncCreateInfoNV::pFence
of a valid NvSciSyncFence
. In addition, application must chain VkSemaphoreTypeCreateInfo
struct with VkSemaphoreTypeCreateInfo::semaphoreType
of VK_SEMAPHORE_TYPE_TIMELINE to the VkSemaphoreCreateInfo::pNext
.
GPU Wait
Use the vkQueueSubmit
API to submit jobs enqueued on the Vulkan SC queue. This API takes VkSubmitInfo::pWaitSemaphores
as a parameter. In addition, application must chain a valid VkTimelineSemaphoreSubmitInfo
struct to the VkSubmitInfo::pNext
, where VkTimelineSemaphoreSubmitInfo::pWaitSemaphoreValues
can be retrieved using the NvSciSync
API NvSciSyncFenceExtractFence
. The jobs submitted to the Vulkan SC queue wait until the NvSciSyncFence
is signaled by the relevant signaler. The wait occurs asynchronously on the GPU.
CPU Wait
Use the vkWaitSemaphores
API to wait NvSciSyncFence
on the CPU. The application must provide a valid VkSemaphore
as a parameter to VkSemaphoreWaitInfo::pSemaphores
and a semaphore value extracted fromNvSciSyncFenceExtractFence
to VkSemaphoreWaitInfo::pValues
. The wait is blocked on the CPU until the NvSciSyncFence
is signaled by the relevant signaler or timeout occurs.
Deterministic Fence
Vulkan SC supports Deterministic Fence in VkSemaphore. When Deterministic Fence is enabled in NvSciSync
via NvSciSyncAttrKey_RequireDeterministicFences
, Vulkan SC waiter does not need to import NvSciSyncFence
from NvSciIPC
. Instead, applications must always construct a new NvSciSyncFence
by using 0
as the fence id. Increment the counter value by one from the previous semaphore wait operation at each semaphore wait operation. The initial counter value is 0
.