Halide 19.0.0
Halide compiler and libraries
|
Allocator class interface for sub-allocating a contiguous memory block into smaller regions of memory. More...
#include <region_allocator.h>
Classes | |
struct | MemoryAllocators |
Public Member Functions | |
RegionAllocator (const RegionAllocator &)=delete | |
RegionAllocator & | operator= (const RegionAllocator &)=delete |
RegionAllocator ()=delete | |
~RegionAllocator ()=delete | |
MemoryRegion * | reserve (void *user_context, const MemoryRequest &request) |
int | conform (void *user_context, MemoryRequest *request) const |
int | release (void *user_context, MemoryRegion *memory_region) |
int | reclaim (void *user_context, MemoryRegion *memory_region) |
int | retain (void *user_context, MemoryRegion *memory_region) |
bool | collect (void *user_context) |
int | release (void *user_context) |
int | destroy (void *user_context) |
BlockResource * | block_resource () const |
Static Public Member Functions | |
static RegionAllocator * | create (void *user_context, BlockResource *block, const MemoryAllocators &ma) |
static int | destroy (void *user_context, RegionAllocator *region_allocator) |
static RegionAllocator * | find_allocator (void *user_context, MemoryRegion *memory_region) |
Allocator class interface for sub-allocating a contiguous memory block 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 24 of file region_allocator.h.
|
delete |
|
delete |
|
delete |
|
delete |
|
static |
Definition at line 114 of file region_allocator.h.
References Halide::Runtime::Internal::SystemMemoryAllocatorFns::allocate, block_resource(), halide_abort_if_false, and Halide::Runtime::Internal::RegionAllocator::MemoryAllocators::system.
|
static |
Definition at line 127 of file region_allocator.h.
References Halide::Runtime::Internal::SystemMemoryAllocatorFns::deallocate, destroy(), halide_abort_if_false, and Halide::Runtime::Internal::RegionAllocator::MemoryAllocators::system.
Referenced by destroy().
|
static |
Definition at line 240 of file region_allocator.h.
References Halide::Runtime::Internal::BlockResource::allocator, and Halide::Runtime::Internal::BlockRegion::block_ptr.
Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::allocate_region(), Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::create_crop(), Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::destroy_crop(), Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::map(), Halide::Runtime::Internal::BlockAllocator::reclaim(), Halide::Runtime::Internal::BlockAllocator::release(), Halide::Runtime::Internal::BlockAllocator::retain(), and Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::unmap().
MemoryRegion * Halide::Runtime::Internal::RegionAllocator::reserve | ( | void * | user_context, |
const MemoryRequest & | request ) |
Definition at line 166 of file region_allocator.h.
References conform(), halide_abort_if_false, Halide::Runtime::Internal::BlockRegion::memory, Halide::Runtime::Internal::BlockResource::memory, Halide::Runtime::Internal::BlockResource::reserved, Halide::Runtime::Internal::MemoryBlock::size, Halide::Runtime::Internal::MemoryRegion::size, and Halide::Runtime::Internal::MemoryRequest::size.
int Halide::Runtime::Internal::RegionAllocator::conform | ( | void * | user_context, |
MemoryRequest * | request ) const |
Definition at line 152 of file region_allocator.h.
References Halide::Runtime::Internal::aligned_offset(), Halide::Runtime::Internal::MemoryProperties::alignment, Halide::Runtime::Internal::MemoryRequest::alignment, Halide::Runtime::Internal::MemoryRegionAllocatorFns::conform, Halide::Runtime::Internal::conform_alignment(), Halide::Runtime::Internal::conform_size(), Halide::Runtime::Internal::BlockResource::memory, Halide::Runtime::Internal::MemoryProperties::nearest_multiple, Halide::Runtime::Internal::MemoryRequest::offset, Halide::Runtime::Internal::MemoryBlock::properties, Halide::Runtime::Internal::RegionAllocator::MemoryAllocators::region, and Halide::Runtime::Internal::MemoryRequest::size.
Referenced by reserve().
int Halide::Runtime::Internal::RegionAllocator::release | ( | void * | user_context, |
MemoryRegion * | memory_region ) |
Definition at line 210 of file region_allocator.h.
References Halide::Runtime::Internal::BlockRegion::block_ptr, halide_abort_if_false, and Halide::Runtime::Internal::BlockRegion::usage_count.
Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::destroy_crop(), and Halide::Runtime::Internal::BlockAllocator::release().
int Halide::Runtime::Internal::RegionAllocator::reclaim | ( | void * | user_context, |
MemoryRegion * | memory_region ) |
Definition at line 220 of file region_allocator.h.
References Halide::Runtime::Internal::BlockRegion::block_ptr, halide_abort_if_false, and Halide::Runtime::Internal::BlockRegion::usage_count.
Referenced by Halide::Runtime::Internal::BlockAllocator::reclaim().
int Halide::Runtime::Internal::RegionAllocator::retain | ( | void * | user_context, |
MemoryRegion * | memory_region ) |
Definition at line 232 of file region_allocator.h.
References Halide::Runtime::Internal::BlockRegion::block_ptr, halide_abort_if_false, and Halide::Runtime::Internal::BlockRegion::usage_count.
Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::create_crop(), and Halide::Runtime::Internal::BlockAllocator::retain().
bool Halide::Runtime::Internal::RegionAllocator::collect | ( | void * | user_context | ) |
Definition at line 689 of file region_allocator.h.
References Halide::Runtime::Internal::BlockRegion::block_ptr, Halide::Runtime::Internal::BlockRegion::memory, Halide::Runtime::Internal::BlockRegion::next_ptr, Halide::Runtime::Internal::BlockResource::regions, Halide::Runtime::Internal::BlockResource::reserved, Halide::Runtime::Internal::MemoryRegion::size, Halide::Runtime::Internal::BlockRegion::status, and Halide::Runtime::Internal::BlockRegion::usage_count.
Referenced by Halide::Runtime::Internal::BlockAllocator::collect().
int Halide::Runtime::Internal::RegionAllocator::release | ( | void * | user_context | ) |
Definition at line 672 of file region_allocator.h.
References Halide::Runtime::Internal::BlockRegion::next_ptr, and Halide::Runtime::Internal::BlockResource::regions.
int Halide::Runtime::Internal::RegionAllocator::destroy | ( | void * | user_context | ) |
Definition at line 768 of file region_allocator.h.
References Halide::Runtime::Internal::BlockResource::allocator, Halide::Runtime::Internal::MemoryArena::destroy(), Halide::Runtime::Internal::BlockRegion::next_ptr, Halide::Runtime::Internal::BlockResource::regions, and Halide::Runtime::Internal::BlockResource::reserved.
BlockResource * Halide::Runtime::Internal::RegionAllocator::block_resource | ( | ) | const |