Halide 22.0.0 Halide compiler and libraries

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator Class Reference

Vulkan Memory Allocator class interface for managing large memory requests stored as contiguous blocks of memory, which are then sub-allocated into smaller regions of memory to avoid the excessive cost of vkAllocate and the limited number of available allocation calls through the API. More...

`#include <vulkan_memory.h>`

## Public Member Functions
| VulkanMemoryAllocator (const VulkanMemoryAllocator &)=delete
VulkanMemoryAllocator & | operator= (const VulkanMemoryAllocator &)=delete
| VulkanMemoryAllocator ()=delete
| ~VulkanMemoryAllocator ()=delete
MemoryRegion * | reserve (void *user_context, const MemoryRequest &request)
int | conform (void *user_context, 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)
void * | map (void *user_context, MemoryRegion *region)
int | unmap (void *user_context, MemoryRegion *region)
MemoryRegion * | create_crop (void *user_context, MemoryRegion *region, uint64_t offset)
int | destroy_crop (void *user_context, MemoryRegion *region)
MemoryRegion * | owner_of (void *user_context, MemoryRegion *region)
VkDevice | current_device () const
VkPhysicalDevice | current_physical_device () const
VkPhysicalDeviceLimits | current_physical_device_limits () const
const VkAllocationCallbacks * | callbacks () const
size_t | bytes_allocated_for_blocks () const
size_t | blocks_allocated () const
size_t | bytes_allocated_for_regions () const
size_t | regions_allocated () const

## Static Public Member Functions
static VulkanMemoryAllocator * | create (void *user_context, const VulkanMemoryConfig &config, VkDevice dev, VkPhysicalDevice phys_dev, const SystemMemoryAllocatorFns &system_allocator, const VkAllocationCallbacks *alloc_callbacks=nullptr)
static int | destroy (void *user_context, VulkanMemoryAllocator *allocator)
static const VulkanMemoryConfig & | default_config ()
static int | allocate_block (void *instance_ptr, MemoryBlock *block)
static int | deallocate_block (void *instance_ptr, MemoryBlock *block)
static int | conform_block_request (void *instance_ptr, MemoryRequest *request)
static int | allocate_region (void *instance_ptr, MemoryRegion *region)
static int | deallocate_region (void *instance_ptr, MemoryRegion *region)
static int | conform_region_request (void *instance_ptr, MemoryRequest *request)

## Detailed Description

Vulkan Memory Allocator class interface for managing large memory requests stored as contiguous blocks of memory, which are then sub-allocated into smaller regions of memory to avoid the excessive cost of vkAllocate and the limited number of available allocation calls through the API.

Definition at line 42 of file vulkan_memory.h.

## Constructor & Destructor Documentation

## ◆ VulkanMemoryAllocator() [1/2]

Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::VulkanMemoryAllocator | ( | const VulkanMemoryAllocator & |  | ) |
| delete

## ◆ VulkanMemoryAllocator() [2/2]

Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::VulkanMemoryAllocator | ( |  | ) |
| delete

## ◆ ~VulkanMemoryAllocator()

Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::~VulkanMemoryAllocator | ( |  | ) |
| delete

## Member Function Documentation

## ◆ operator=()

VulkanMemoryAllocator & Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::operator= | ( | const VulkanMemoryAllocator & |  | ) |
| delete

## ◆ create()

VulkanMemoryAllocator * Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::create | ( | void * | user_context,
|  | const VulkanMemoryConfig & | config,
|  | VkDevice | dev,
|  | VkPhysicalDevice | phys_dev,
|  | const SystemMemoryAllocatorFns & | system_allocator,
|  | const VkAllocationCallbacks * | alloc_callbacks = `nullptr`
| ) |  |
| static

Definition at line 152 of file vulkan_memory.h.

References Halide::cast(), and user_context.

## ◆ destroy() [1/2]

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::destroy | ( | void * | user_context,
|  | VulkanMemoryAllocator * | allocator
| ) |  |
| static

Definition at line 174 of file vulkan_memory.h.

References Halide::Runtime::Internal::BlockAllocator::current_allocators(), Halide::Runtime::Internal::SystemMemoryAllocatorFns::deallocate, destroy(), halide_error_code_internal_error, halide_error_code_success, Halide::Runtime::Internal::BlockAllocator::MemoryAllocators::system, and user_context.

Referenced by destroy().

## ◆ reserve()

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

Definition at line 227 of file vulkan_memory.h.

References Halide::cast(), debug, Halide::Runtime::Internal::BlockAllocator::reserve(), and user_context.

## ◆ conform()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::conform | ( | void * | user_context,
|  | MemoryRequest * | request
| ) |  |

Definition at line 983 of file vulkan_memory.h.

References Halide::Runtime::Internal::aligned_offset(), Halide::cast(), Halide::Runtime::Internal::conform_alignment(), Halide::Runtime::Internal::conform_size(), debug, error_code, halide_error_code_success, Halide::Runtime::Internal::Vulkan::VulkanMemoryConfig::nearest_multiple, and user_context.

Referenced by conform_region_request().

## ◆ release() [1/2]

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::release | ( | void * | user_context,
|  | MemoryRegion * | region
| ) |  |

Definition at line 447 of file vulkan_memory.h.

References debug, halide_error_code_generic_error, Halide::Runtime::Internal::MemoryRegion::offset, Halide::Runtime::Internal::BlockAllocator::release(), Halide::Runtime::Internal::MemoryRegion::size, and user_context.

## ◆ reclaim()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::reclaim | ( | void * | user_context,
|  | MemoryRegion * | region
| ) |  |

Definition at line 466 of file vulkan_memory.h.

References debug, halide_error_code_generic_error, Halide::Runtime::Internal::MemoryRegion::offset, Halide::Runtime::Internal::BlockAllocator::reclaim(), Halide::Runtime::Internal::MemoryRegion::size, and user_context.

## ◆ retain()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::retain | ( | void * | user_context,
|  | MemoryRegion * | region
| ) |  |

Definition at line 485 of file vulkan_memory.h.

References debug, halide_error_code_generic_error, Halide::Runtime::Internal::MemoryRegion::offset, Halide::Runtime::Internal::BlockAllocator::retain(), Halide::Runtime::Internal::MemoryRegion::size, and user_context.

## ◆ collect()

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

Definition at line 504 of file vulkan_memory.h.

References Halide::Runtime::Internal::BlockAllocator::collect(), debug, and user_context.

Referenced by allocate_region().

## ◆ release() [2/2]

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

Definition at line 515 of file vulkan_memory.h.

References debug, halide_error_code_generic_error, Halide::Runtime::Internal::BlockAllocator::release(), and user_context.

## ◆ destroy() [2/2]

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

Definition at line 532 of file vulkan_memory.h.

References debug, Halide::Runtime::Internal::BlockAllocator::destroy(), halide_error_code_success, and user_context.

## ◆ map()

void * Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::map | ( | void * | user_context,
|  | MemoryRegion * | region
| ) |  |

Definition at line 250 of file vulkan_memory.h.

References Halide::cast(), debug, Halide::Runtime::Internal::RegionAllocator::find_allocator(), Halide::Runtime::Internal::MemoryBlock::handle, Halide::Runtime::Internal::MemoryRange::head_offset, Halide::Runtime::Internal::BlockResource::memory, Halide::Runtime::Internal::MemoryRegion::offset, owner_of(), Halide::Runtime::Internal::MemoryRegion::range, Halide::Runtime::Internal::MemoryRegion::size, Halide::Runtime::Internal::MemoryRange::tail_offset, and user_context.

## ◆ unmap()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::unmap | ( | void * | user_context,
|  | MemoryRegion * | region
| ) |  |

Definition at line 316 of file vulkan_memory.h.

References Halide::cast(), debug, Halide::Runtime::Internal::RegionAllocator::find_allocator(), halide_error_code_generic_error, halide_error_code_internal_error, halide_error_code_success, Halide::Runtime::Internal::MemoryBlock::handle, Halide::Runtime::Internal::MemoryRange::head_offset, Halide::Runtime::Internal::BlockResource::memory, Halide::Runtime::Internal::MemoryRegion::offset, owner_of(), Halide::Runtime::Internal::MemoryRegion::range, Halide::Runtime::Internal::MemoryRegion::size, and user_context.

## ◆ create_crop()

MemoryRegion * Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::create_crop | ( | void * | user_context,
|  | MemoryRegion * | region,
|  | uint64_t | offset
| ) |  |

Definition at line 355 of file vulkan_memory.h.

References Halide::Runtime::Internal::SystemMemoryAllocatorFns::allocate, Halide::cast(), Halide::Runtime::Internal::BlockAllocator::current_allocators(), debug, error_code, Halide::Runtime::Internal::RegionAllocator::find_allocator(), halide_error_code_success, memcpy(), Halide::Runtime::Internal::MemoryRegion::offset, owner_of(), Halide::Runtime::Internal::MemoryRegion::size, Halide::Runtime::Internal::BlockAllocator::MemoryAllocators::system, and user_context.

## ◆ destroy_crop()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::destroy_crop | ( | void * | user_context,
|  | MemoryRegion * | region
| ) |  |

Definition at line 408 of file vulkan_memory.h.

References Halide::cast(), Halide::Runtime::Internal::BlockAllocator::current_allocators(), Halide::Runtime::Internal::SystemMemoryAllocatorFns::deallocate, error_code, Halide::Runtime::Internal::RegionAllocator::find_allocator(), halide_error_code_generic_error, halide_error_code_internal_error, halide_error_code_success, owner_of(), Halide::Runtime::Internal::BlockAllocator::MemoryAllocators::system, and user_context.

## ◆ owner_of()

MemoryRegion * Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::owner_of | ( | void * | user_context,
|  | MemoryRegion * | region
| ) |  |

Definition at line 438 of file vulkan_memory.h.

References Halide::Runtime::Internal::MemoryRegion::handle, and Halide::Runtime::Internal::MemoryRegion::is_owner.

Referenced by create_crop(), destroy_crop(), map(), and unmap().

## ◆ current_device()

VkDevice Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::current_device | ( |  | ) | const
| inline

Definition at line 76 of file vulkan_memory.h.

## ◆ current_physical_device()

VkPhysicalDevice Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::current_physical_device | ( |  | ) | const
| inline

Definition at line 79 of file vulkan_memory.h.

## ◆ current_physical_device_limits()

VkPhysicalDeviceLimits Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::current_physical_device_limits | ( |  | ) | const
| inline

Definition at line 82 of file vulkan_memory.h.

## ◆ callbacks()

const VkAllocationCallbacks * Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::callbacks | ( |  | ) | const
| inline

Definition at line 85 of file vulkan_memory.h.

## ◆ default_config()

const VulkanMemoryConfig & Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::default_config | ( |  | ) |
| static

Definition at line 549 of file vulkan_memory.h.

## ◆ allocate_block()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::allocate_block | ( | void * | instance_ptr,
|  | MemoryBlock * | block
| ) |  |
| static

Definition at line 630 of file vulkan_memory.h.

References blocks_allocated(), bytes_allocated_for_blocks(), bytes_allocated_for_regions(), Halide::Runtime::Internal::MemoryProperties::caching, Halide::cast(), debug, Halide::Runtime::Internal::MemoryBlock::dedicated, halide_error_code_device_malloc_failed, halide_error_code_internal_error, halide_error_code_out_of_memory, halide_error_code_success, halide_memory_caching_name(), halide_memory_usage_name(), halide_memory_visibility_name(), Halide::Runtime::Internal::MemoryBlock::handle, Halide::Runtime::Internal::MemoryBlock::properties, regions_allocated(), Halide::Runtime::Internal::MemoryBlock::size, Halide::Runtime::Internal::MemoryProperties::usage, user_context, and Halide::Runtime::Internal::MemoryProperties::visibility.

## ◆ deallocate_block()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::deallocate_block | ( | void * | instance_ptr,
|  | MemoryBlock * | block
| ) |  |
| static

Definition at line 776 of file vulkan_memory.h.

References Halide::Runtime::Internal::MemoryProperties::caching, Halide::cast(), debug, Halide::Runtime::Internal::MemoryBlock::dedicated, halide_error_code_internal_error, halide_error_code_success, halide_memory_caching_name(), halide_memory_usage_name(), halide_memory_visibility_name(), Halide::Runtime::Internal::MemoryBlock::handle, Halide::Runtime::Internal::MemoryBlock::properties, Halide::Runtime::Internal::MemoryBlock::size, Halide::Runtime::Internal::MemoryProperties::usage, user_context, and Halide::Runtime::Internal::MemoryProperties::visibility.

## ◆ conform_block_request()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::conform_block_request | ( | void * | instance_ptr,
|  | MemoryRequest * | request
| ) |  |
| static

Definition at line 588 of file vulkan_memory.h.

References Halide::cast(), debug, error_code, halide_error_code_internal_error, halide_error_code_success, and user_context.

## ◆ allocate_region()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::allocate_region | ( | void * | instance_ptr,
|  | MemoryRegion * | region
| ) |  |
| static

Definition at line 1075 of file vulkan_memory.h.

References Halide::Runtime::Internal::MemoryProperties::caching, Halide::cast(), collect(), debug, Halide::Runtime::Internal::MemoryRegion::dedicated, Halide::Runtime::Internal::RegionAllocator::find_allocator(), halide_error_code_device_malloc_failed, halide_error_code_generic_error, halide_error_code_internal_error, halide_error_code_out_of_memory, halide_error_code_success, halide_memory_caching_name(), halide_memory_usage_name(), halide_memory_visibility_name(), Halide::Runtime::Internal::MemoryBlock::handle, Halide::Runtime::Internal::MemoryRegion::handle, Halide::Runtime::Internal::MemoryRegion::is_owner, Halide::Runtime::Internal::BlockResource::memory, Halide::Runtime::Internal::MemoryRegion::offset, Halide::Runtime::Internal::MemoryRegion::properties, Halide::Runtime::Internal::MemoryRegion::size, Halide::Runtime::Internal::MemoryProperties::usage, user_context, and Halide::Runtime::Internal::MemoryProperties::visibility.

## ◆ deallocate_region()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::deallocate_region | ( | void * | instance_ptr,
|  | MemoryRegion * | region
| ) |  |
| static

Definition at line 1207 of file vulkan_memory.h.

References Halide::Runtime::Internal::MemoryProperties::caching, Halide::cast(), debug, Halide::Runtime::Internal::MemoryRegion::dedicated, error_code, halide_error_code_internal_error, halide_error_code_success, halide_memory_caching_name(), halide_memory_usage_name(), halide_memory_visibility_name(), Halide::Runtime::Internal::MemoryRegion::handle, Halide::Runtime::Internal::MemoryRegion::offset, Halide::Runtime::Internal::MemoryRegion::properties, Halide::Runtime::Internal::MemoryRegion::size, Halide::Runtime::Internal::MemoryProperties::usage, user_context, and Halide::Runtime::Internal::MemoryProperties::visibility.

## ◆ conform_region_request()

int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::conform_region_request | ( | void * | instance_ptr,
|  | MemoryRequest * | request
| ) |  |
| static

Definition at line 1043 of file vulkan_memory.h.

References Halide::cast(), conform(), debug, halide_error_code_internal_error, halide_error_code_success, halide_memory_caching_name(), halide_memory_usage_name(), halide_memory_visibility_name(), and user_context.

## ◆ bytes_allocated_for_blocks()

size_t Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::bytes_allocated_for_blocks | ( |  | ) | const

Definition at line 848 of file vulkan_memory.h.

Referenced by allocate_block().

## ◆ blocks_allocated()

size_t Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::blocks_allocated | ( |  | ) | const

Definition at line 844 of file vulkan_memory.h.

Referenced by allocate_block().

## ◆ bytes_allocated_for_regions()

size_t Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::bytes_allocated_for_regions | ( |  | ) | const

Definition at line 1281 of file vulkan_memory.h.

Referenced by allocate_block().

## ◆ regions_allocated()

size_t Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::regions_allocated | ( |  | ) | const

Definition at line 1277 of file vulkan_memory.h.

Referenced by allocate_block().

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

- src/runtime/vulkan_memory.h