Skip to navigation

holoscan::DLManagedMemoryBufferVersioned

Beta
View as Markdown

Wraps the deleter of a DLManagedTensorVersioned.

Versioned (DLPack >= 1.0) counterpart of DLManagedMemoryBuffer.

#include <holoscan/dlpack.hpp>

Inherits from: holoscan::TensorMemoryReference (public)


Constructors

DLManagedMemoryBufferVersioned

DLManagedTensorVersioned *self
)

Destructor

~DLManagedMemoryBufferVersioned


Methods

retain_tensor_handle

virtual void holoscan::DLManagedMemoryBufferVersioned::retain_tensor_handle() noexcept

Retain one live Tensor-handle claim on this backing allocation.

Pool-backed references may override this no-throw hook to prevent reuse while a Tensor handle or exported DLPack owner still names the allocation. The default is a no-op for references whose shared ownership already supplies the complete lifetime contract. Overrides must be thread-safe, allocation-free, and non-blocking after resource warm-up.

release_tensor_handle

virtual void holoscan::DLManagedMemoryBufferVersioned::release_tensor_handle() noexcept

Release one live Tensor-handle claim on this backing allocation.

Every successful retain is paired with exactly one release. Implementations must remain no-throw because Tensor destruction and move assignment invoke this hook. Overrides must be thread-safe, allocation-free, and non-blocking after resource warm-up.

set_deallocation_stream

virtual bool holoscan::DLManagedMemoryBufferVersioned::set_deallocation_stream(
cudaStream_t stream
)

Record the CUDA stream after which the backing memory may be safely reused by an allocator.

tracks_deallocation_stream

virtual bool holoscan::DLManagedMemoryBufferVersioned::tracks_deallocation_stream() const noexcept

Return whether this memory reference tracks CUDA use before storage reuse.

set_readiness_stream

virtual bool holoscan::DLManagedMemoryBufferVersioned::set_readiness_stream(
cudaStream_t stream
)

Record the CUDA stream that last made this Tensor’s data ready to read.

The readiness stream is independent from the deallocation stream: readiness drives producer-to-consumer synchronization for DLPack export, while deallocation drives allocator reuse after the final owner releases the memory.

has_readiness_stream_contract

virtual bool holoscan::DLManagedMemoryBufferVersioned::has_readiness_stream_contract() const noexcept

Return whether this memory reference can order producer readiness against consumers.

Imported DLPack ownership wrappers generally do not know the producer stream that made the tensor data ready, so they return false; Tensor then reports unsupported readiness synchronization distinctly instead of treating it as a successful no-op.

readiness_stream

virtual cudaStream_t holoscan::DLManagedMemoryBufferVersioned::readiness_stream() const noexcept

Return the retained producer-readiness stream when its identity is locally meaningful.

Runtime-owned references may expose this source-private ordering coordinate so a bounded materialization path can enqueue work after the producer without inventing another stream. Imported cross-process references return null because CUDA stream handles are process-local.

Returns: Borrowed producer stream, or null when no process-local stream identity is available.

synchronize_for_consumer

virtual expected<void, Error> holoscan::DLManagedMemoryBufferVersioned::synchronize_for_consumer(
cudaStream_t consumer_stream
)

Make this Tensor’s data safe to consume on the provided CUDA stream.

References that know their producer/ready stream should record an event on it and make consumer_stream wait. References that do not own stream state leave the default no-op.

synchronize_for_host

virtual expected<void, Error> holoscan::DLManagedMemoryBufferVersioned::synchronize_for_host()

Block the calling host thread until this Tensor’s producer stream is ready.

This is an ordering primitive only; it does not make device memory CPU-addressable.


Member variables

NameTypeDescription
self_DLManagedTensorVersioned *