Halide 17.0.1
Halide compiler and libraries
|
Allocator class interface for managing large contiguous blocks of memory, which are then sub-allocated into smaller regions of memory. More...
#include <block_allocator.h>
Classes | |
struct | Config |
struct | MemoryAllocators |
Public Member Functions | |
BlockAllocator (const BlockAllocator &)=delete | |
BlockAllocator & | operator= (const BlockAllocator &)=delete |
BlockAllocator ()=delete | |
~BlockAllocator ()=delete | |
MemoryRegion * | reserve (void *user_context, const MemoryRequest &request) |
int | release (void *user_context, MemoryRegion *region) |
int | reclaim (void *user_context, MemoryRegion *region) |
int | retain (void *user_context, MemoryRegion *region) |
bool | collect (void *user_context) |
int | release (void *user_context) |
int | destroy (void *user_context) |
const MemoryAllocators & | current_allocators () const |
const Config & | current_config () const |
const Config & | default_config () const |
size_t | block_count () const |
size_t | pool_size () const |
Static Public Member Functions | |
static BlockAllocator * | create (void *user_context, const Config &config, const MemoryAllocators &allocators) |
static void | destroy (void *user_context, BlockAllocator *block_allocator) |
Allocator class interface for managing large contiguous blocks of memory, which are then sub-allocated into smaller regions of memory.
This class only manages the address creation for the regions – allocation callback functions are used to request the memory from the necessary system or API calls. This class is intended to be used inside of a higher level memory management class that provides thread safety, policy management and API integration for a specific runtime API (eg Vulkan, OpenCL, etc)
Definition at line 25 of file block_allocator.h.
|
delete |
|
delete |
|
delete |
|
delete |
|
static |
Definition at line 123 of file block_allocator.h.
References Halide::Runtime::Internal::SystemMemoryAllocatorFns::allocate, Halide::cast(), halide_abort_if_false, and Halide::Runtime::Internal::BlockAllocator::MemoryAllocators::system.
|
static |
Definition at line 137 of file block_allocator.h.
References Halide::Runtime::Internal::SystemMemoryAllocatorFns::deallocate, destroy(), halide_abort_if_false, and Halide::Runtime::Internal::BlockAllocator::MemoryAllocators::system.
Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::destroy(), destroy(), and Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::destroy().
MemoryRegion * Halide::Runtime::Internal::BlockAllocator::reserve | ( | void * | user_context, |
const MemoryRequest & | request | ||
) |
Definition at line 154 of file block_allocator.h.
References Halide::Runtime::Internal::BlockResource::allocator, Halide::cast(), halide_abort_if_false, halide_memory_caching_name(), halide_memory_usage_name(), and halide_memory_visibility_name().
Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::reserve().
int Halide::Runtime::Internal::BlockAllocator::release | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 197 of file block_allocator.h.
References Halide::cast(), Halide::Runtime::Internal::RegionAllocator::find_allocator(), halide_error_code_internal_error, and Halide::Runtime::Internal::RegionAllocator::release().
Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::release(), and Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::release().
int Halide::Runtime::Internal::BlockAllocator::reclaim | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 208 of file block_allocator.h.
References Halide::cast(), Halide::Runtime::Internal::RegionAllocator::find_allocator(), halide_error_code_internal_error, and Halide::Runtime::Internal::RegionAllocator::reclaim().
Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::reclaim().
int Halide::Runtime::Internal::BlockAllocator::retain | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 219 of file block_allocator.h.
References Halide::cast(), Halide::Runtime::Internal::RegionAllocator::find_allocator(), halide_error_code_internal_error, and Halide::Runtime::Internal::RegionAllocator::retain().
Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::retain().
bool Halide::Runtime::Internal::BlockAllocator::collect | ( | void * | user_context | ) |
Definition at line 230 of file block_allocator.h.
References Halide::Runtime::Internal::BlockResource::allocator, Halide::Runtime::Internal::LinkedList::back(), Halide::cast(), Halide::Runtime::Internal::RegionAllocator::collect(), and Halide::Runtime::Internal::BlockResource::reserved.
Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::collect().
int Halide::Runtime::Internal::BlockAllocator::release | ( | void * | user_context | ) |
Definition at line 265 of file block_allocator.h.
References Halide::Runtime::Internal::LinkedList::back(), and Halide::cast().
int Halide::Runtime::Internal::BlockAllocator::destroy | ( | void * | user_context | ) |
Definition at line 275 of file block_allocator.h.
References Halide::Runtime::Internal::LinkedList::back(), Halide::cast(), and Halide::Runtime::Internal::LinkedList::destroy().
const BlockAllocator::MemoryAllocators & Halide::Runtime::Internal::BlockAllocator::current_allocators | ( | ) | const |
const BlockAllocator::Config & Halide::Runtime::Internal::BlockAllocator::current_config | ( | ) | const |
Definition at line 590 of file block_allocator.h.
const BlockAllocator::Config & Halide::Runtime::Internal::BlockAllocator::default_config | ( | ) | const |
Definition at line 594 of file block_allocator.h.
size_t Halide::Runtime::Internal::BlockAllocator::block_count | ( | ) | const |
Definition at line 599 of file block_allocator.h.
References Halide::Runtime::Internal::LinkedList::size().
size_t Halide::Runtime::Internal::BlockAllocator::pool_size | ( | ) | const |
Definition at line 603 of file block_allocator.h.
References Halide::cast(), Halide::Runtime::Internal::LinkedList::front(), Halide::Runtime::Internal::BlockResource::memory, and Halide::Runtime::Internal::MemoryBlock::size.