Skip to navigation

holoscan::BlockMemoryPool

Beta
View as Markdown

Fixed-size block memory pool independent of GXF entities and parameters.

#include <holoscan/block_memory_pool.hpp>

Inherits from: holoscan::CudaStreamAllocator (public)

This class is marked final.


Constructors

BlockMemoryPool

holoscan::BlockMemoryPool::BlockMemoryPool() = default

Destructor

~BlockMemoryPool

HOLOSCAN_CORE_EXPORT holoscan::BlockMemoryPool::~BlockMemoryPool() override

Assignment operators

operator=

The following overloads are deleted to prevent misuse:

BlockMemoryPool & holoscan::BlockMemoryPool::operator=(const BlockMemoryPool &) = delete;
BlockMemoryPool & holoscan::BlockMemoryPool::operator=(BlockMemoryPool &&) = delete;

Methods

initialize_pool

HOLOSCAN_CORE_EXPORT expected<void, Error> holoscan::BlockMemoryPool::initialize_pool()

deinitialize_pool

HOLOSCAN_CORE_EXPORT expected<void, Error> holoscan::BlockMemoryPool::deinitialize_pool()

is_available

expected<void, Error> holoscan::BlockMemoryPool::is_available(
uint64_t size,
MemoryStorageType storage_type
) override

allocate

expected<std::byte *, Error> holoscan::BlockMemoryPool::allocate(
uint64_t size,
MemoryStorageType storage_type
) override

free

expected<void, Error> holoscan::BlockMemoryPool::free(
std::byte *pointer
) override

block_size

uint64_t holoscan::BlockMemoryPool::block_size(
MemoryStorageType storage_type
) const override

storage_type

MemoryStorageType holoscan::BlockMemoryPool::storage_type() const noexcept

num_blocks

uint64_t holoscan::BlockMemoryPool::num_blocks() const noexcept

config

const Config & holoscan::BlockMemoryPool::config() const noexcept

stats

HOLOSCAN_CORE_EXPORT Stats holoscan::BlockMemoryPool::stats()

device_id

int32_t holoscan::BlockMemoryPool::device_id(
MemoryStorageType storage_type
) const override

allocate_async

expected<std::byte *, Error> holoscan::BlockMemoryPool::allocate_async(
uint64_t size,
MemoryStorageType storage_type,
cudaStream_t stream
)

free_async

expected<void, Error> holoscan::BlockMemoryPool::free_async(
std::byte *pointer,
cudaStream_t stream
)

allocate_async_impl

expected<std::byte *, Error> holoscan::BlockMemoryPool::allocate_async_impl(
uint64_t size,
MemoryStorageType storage_type,
cudaStream_t stream
) override

free_async_impl

expected<void, Error> holoscan::BlockMemoryPool::free_async_impl(
std::byte *pointer,
cudaStream_t stream
) override

pointer_to_index

HOLOSCAN_CORE_EXPORT int64_t holoscan::BlockMemoryPool::pointer_to_index(
std::byte *pointer
) const

initialize_block_events

HOLOSCAN_CORE_EXPORT expected<void, Error> holoscan::BlockMemoryPool::initialize_block_events()

destroy_block_events

HOLOSCAN_CORE_EXPORT void holoscan::BlockMemoryPool::destroy_block_events()

reclaim_completed_deferred_blocks

HOLOSCAN_CORE_EXPORT void holoscan::BlockMemoryPool::reclaim_completed_deferred_blocks()

checked_out_blocks_locked

HOLOSCAN_CORE_EXPORT uint64_t holoscan::BlockMemoryPool::checked_out_blocks_locked() const

update_high_water_locked

HOLOSCAN_CORE_EXPORT void holoscan::BlockMemoryPool::update_high_water_locked()

record_failed_acquisition

HOLOSCAN_CORE_EXPORT void holoscan::BlockMemoryPool::record_failed_acquisition()

allocator_stage_str

static const char * holoscan::BlockMemoryPool::allocator_stage_str(
)

Types

AllocatorStage

NameValueDescription
kUninitialized= 0
kInitializationInProgress= 1
kInitialized= 2
kDeinitializationInProgress= 3

Member variables

NameTypeDescription
config_Config
pointer_std::byte *
stack_std::unique_ptr< FixedPoolUint64 >
stack_mutex_std::mutex
stage_std::atomic< AllocatorStage >
deferred_blocks_std::vector< DeferredBlock >
block_events_std::vector< cudaEvent_t >
block_deferred_std::vector< uint8_t >
high_water_used_std::atomic< uint64_t >
failed_acquisitions_std::atomic< uint64_t >
kUnknownDeviceId static constexprint32_t

Inner classes

Config

struct holoscan::BlockMemoryPool::Config
NameTypeDescription
storage_typeMemoryStorageType
block_sizeuint64_t
num_blocksuint64_t
device_idint32_t
enable_statsbool

Stats

struct holoscan::BlockMemoryPool::Stats
NameTypeDescription
capacityuint64_t
availableuint64_t
useduint64_t
deferreduint64_t
high_water_useduint64_t
failed_acquisitionsuint64_t
initializedbool
counters_enabledbool

DeferredBlock

struct holoscan::BlockMemoryPool::DeferredBlock
NameTypeDescription
indexuint64_t