Loading...
Searching...
No Matches
Halide::Runtime::Internal::RegionAllocator Class Reference

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)

## Detailed Description

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.

## Constructor & Destructor Documentation

## RegionAllocator() [1/2]

Halide::Runtime::Internal::RegionAllocator::RegionAllocator | ( | const RegionAllocator & |  | ) |

delete

References RegionAllocator().

Referenced by create(), destroy(), find_allocator(), operator=(), and RegionAllocator().

## RegionAllocator() [2/2]

Halide::Runtime::Internal::RegionAllocator::RegionAllocator | ( |  | ) |

delete

## ~RegionAllocator()

Halide::Runtime::Internal::RegionAllocator::~RegionAllocator | ( |  | ) |

delete

## Member Function Documentation

## operator=()

RegionAllocator & Halide::Runtime::Internal::RegionAllocator::operator= | ( | const RegionAllocator & |  | ) |

delete

References RegionAllocator().

## create()

RegionAllocator * Halide::Runtime::Internal::RegionAllocator::create | ( | void * | user_context,
|  | BlockResource * | block,
|  | const MemoryAllocators & | ma )

static

Definition at line 114 of file region_allocator.h.

References block_resource(), halide_abort_if_false, and RegionAllocator().

## destroy() [1/2]

int Halide::Runtime::Internal::RegionAllocator::destroy | ( | void * | user_context,
|  | RegionAllocator * | region_allocator )

static

Definition at line 127 of file region_allocator.h.

References destroy(), halide_abort_if_false, and RegionAllocator().

Referenced by destroy().

## find_allocator()

RegionAllocator * Halide::Runtime::Internal::RegionAllocator::find_allocator | ( | void * | user_context,
|  | MemoryRegion * | memory_region )

static

Definition at line 240 of file region_allocator.h.

References Halide::Runtime::Internal::BlockResource::allocator, Halide::Runtime::Internal::BlockRegion::block_ptr, and RegionAllocator().

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().

## reserve()

MemoryRegion * Halide::Runtime::Internal::RegionAllocator::reserve | ( | void * | user_context,
|  | const MemoryRequest & | request )

Definition at line 166 of file region_allocator.h.

References conform(), debug, halide_abort_if_false, Halide::Runtime::Internal::BlockRegion::memory, Halide::Runtime::Internal::MemoryRegion::size, and Halide::Runtime::Internal::MemoryRequest::size.

## conform()

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::MemoryRequest::alignment, Halide::Runtime::Internal::conform_alignment(), Halide::Runtime::Internal::conform_size(), Halide::Runtime::Internal::MemoryRequest::offset, and Halide::Runtime::Internal::MemoryRequest::size.

Referenced by reserve().

## release() [1/2]

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().

## reclaim()

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().

## retain()

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().

## collect()

bool Halide::Runtime::Internal::RegionAllocator::collect | ( | void * | user_context | ) |

Definition at line 692 of file region_allocator.h.

References Halide::Runtime::Internal::BlockRegion::block_ptr, debug, Halide::Runtime::Internal::BlockRegion::memory, Halide::Runtime::Internal::BlockRegion::next_ptr, Halide::Runtime::Internal::MemoryRegion::size, Halide::Runtime::Internal::BlockRegion::status, and Halide::Runtime::Internal::BlockRegion::usage_count.

Referenced by Halide::Runtime::Internal::BlockAllocator::collect().

## release() [2/2]

int Halide::Runtime::Internal::RegionAllocator::release | ( | void * | user_context | ) |

Definition at line 675 of file region_allocator.h.

References debug, and Halide::Runtime::Internal::BlockRegion::next_ptr.

## destroy() [2/2]

int Halide::Runtime::Internal::RegionAllocator::destroy | ( | void * | user_context | ) |

Definition at line 771 of file region_allocator.h.

References debug, Halide::Runtime::Internal::MemoryArena::destroy(), and Halide::Runtime::Internal::BlockRegion::next_ptr.

## block_resource()

BlockResource * Halide::Runtime::Internal::RegionAllocator::block_resource | ( |  | ) | const

Definition at line 832 of file region_allocator.h.

Referenced by Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::allocate_region(), create(), Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::map(), and Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::unmap().

The documentation for this class was generated from the following file:

- src/runtime/internal/region_allocator.h