holoscan::HoloIpcCudaNativeBufferAdapterBase
holoscan::HoloIpcCudaNativeBufferAdapterBase
Shared CUDA IPC + holoipc lifecycle adapter core, parameterized on the holoipc transport.
Owns all transport-independent logic: GPU info caching, CudaTensorDescriptor conversion, CUDA IPC export/import via GXF helpers, holoipc share_pointer/acquire_pointer lifecycle, DNBX (Descriptor Native Buffer eXport) wire-format encode/decode, pending-export tracking, and deferred destruction.
Subclasses provide only the initialize() signature and ipc::Context<Transport> creation.
Threading: three threads access this object –
- GXF scheduler (export_tensor, evict_stale_exports)
- sidecar dispatch (import_tensor)
- IpcCore io_context (handle_last_release callback) exports_mutex_ protects pending_exports_, lifecycle_key_to_seq_, released_entries_.
ExportEntry destruction must happen outside both exports_mutex_ and the io_context thread because the ipc_descriptor deleter takes IpcCore::mutex_ and may re-enter the io_context. The solution is deferred destruction: handle_last_release queues entries into released_entries_; the next export_tensor call drains them on the worker thread, freeing GPU memory inline and moving ipc_descriptors to a background thread.
Template parameters
Inherits from: holoscan::NativeBufferProtocolAdapter (public)
Constructors
HoloIpcCudaNativeBufferAdapterBase
Overload 1
Copy (deleted)
Destructor
~HoloIpcCudaNativeBufferAdapterBase
Assignment operators
operator=
Methods
shutdown
is_initialized
policy
set_acquire_timeout
set_export_ttl
set_use_eager_acquire
default_protocol_name
supports_protocol
can_export_tensor
descriptor_format_version
export_tensor
Overload 1
Export a GPU tensor for CUDA IPC transfer
NativeBufferProtocolAdapter interface: converts NativeTensorMetadata to CudaTensorDescriptor and delegates to the CudaTensorDescriptor overload.
import_tensor_generic
NativeBufferProtocolAdapter interface: delegates to import_tensor() and converts the NativeBufferHolder into a generic ImportedNativeTensor.
import_tensor
Decode a DNBX payload and acquire the CUDA IPC mapping via holoipc.
In strict mode (default): sends ACQUIRED, waits for ACK, then opens handle. In eager mode: opens handle locally first, then sends ACQUIRED (no ACK wait). Returns an RAII NativeBufferHolder whose destruction sends RELEASED.
pending_export_count
set_on_pending_export_count_changed
evict_stale_exports
initialize_common
Called by derived-class initialize() after creating the ipc::Context.
append_bytes
append_buffer
encode_exported_tensor
Serialize GXF CudaIpcDescriptor + holoipc lifecycle metadata into DNBX wire format.
ensure_gpu_info_initialized
handle_last_release
holoipc on_last_release callback (runs on io_context thread).
Moves the released entry to released_entries_ for deferred destruction; must not destroy ExportEntry here (would deadlock the io_context).
evict_stale_exports_locked
Move exports older than max_age into deferred_destroy. Caller holds exports_mutex_.
cleanup_exports
Drain all pending exports during shutdown, waiting up to shutdown_grace_period for subscribers to send RELEASED before force-evicting.
Static methods
decode_exported_tensor
Overload 1
Single item
Parse DNBX wire format back into ExportedTensorDescriptor.
Wire layout: magic | version | handle_type | ipc_version | hipc_blob | key | reply_topic
Types
Typedefs
Member variables
Inner classes
NativeBufferHolder
RAII holder for a lifecycle-managed CUDA IPC mapping.
ExportedTensorDescriptor
Decoded DNBX payload: GXF CUDA IPC descriptor + holoipc lifecycle metadata.
ExportEntry
Tracks a single exported tensor for lifecycle management.
Holds the holoipc descriptor (controls RELEASED on drop), the GPU memory owner (prevents cudaFree while subscribers hold the mapping), and timing for TTL eviction.