Loading...
Searching...
No Matches
VkCudaSemaphore.hpp File Reference
Exportable Vulkan timeline semaphore + CUDA-side import pair. More...
Detailed Description
Exportable Vulkan timeline semaphore + CUDA-side import pair.
The canonical sync primitive for capture flows that span the Vulkan and CUDA worlds:
- Rivermax: NIC writes into a CUDA-allocated VRAM region; the score render graph then samples that region from a Vulkan- imported QRhiTexture. The Vulkan side needs to wait for the CUDA-stream signalling that the NIC has finished. Inversely, score may signal a Vulkan semaphore after rendering completes, and the CUDA stream waits before reusing the buffer.
- AJA-RDMA via Vulkan QRhi: same shape — AJA's
WaitForOutputcompletion sets a CUDA event; Vulkan must wait.
The class wraps the setup:
- Create a Vulkan exportable VK_SEMAPHORE_TYPE_TIMELINE semaphore with VkExportSemaphoreCreateInfo + the OS-appropriate handle type (OPAQUE_FD on Linux, OPAQUE_WIN32 on Windows).
- Export an FD / HANDLE via vkGetSemaphoreFdKHR / vkGetSemaphoreWin32HandleKHR.
- cuImportExternalSemaphore on the CUDA side, through the
CudaInterop::cuda_interop_import_vulkan_semaphoreshim.
This file owns the Vulkan-side creation; the CUDA-side handle stays with CudaInterop so consumers can call cuda_interop_wait_semaphore / cuda_interop_signal_semaphore against it.