Skip to main content

Module external

Module external 

Source
Expand description

External memory / semaphore interop — import buffers and sync primitives from Vulkan, D3D11, D3D12, NvSci, and OpaqueFd sources.

A typical pipeline is:

  1. A graphics API (Vulkan, D3D12) exports a buffer or image and a timeline fence as OS-level handles (file descriptor on Linux, NT HANDLE on Windows).
  2. CUDA imports those handles via ExternalMemory::import and ExternalSemaphore::import.
  3. CUDA obtains a device pointer into the shared buffer with ExternalMemory::mapped_buffer.
  4. Each frame, CUDA ExternalSemaphore::wait_fence_asyncs on the graphics-API fence, does compute, then ExternalSemaphore::signal_fence_asyncs a fence value the graphics API is waiting on.

Testing note: the baracuda crate ships these APIs but cannot end-to-end test them without a live Vulkan/D3D12 context. Layout and symbol-resolution are verified via unit tests in this module; a matching external-memory/-semaphore example belongs in an examples/external_interop crate (not yet present).

Structs§

ExternalMemory
An imported external-memory handle (Vulkan VkDeviceMemory, D3D12 heap, NvSciBuf, …). Destroyed on drop.
ExternalSemaphore
An imported external-semaphore handle (Vulkan VkSemaphore / timeline, D3D12 fence, NvSciSync, keyed mutex). Destroyed on drop.