Halide 18.0.0
Halide compiler and libraries
|
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>
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) |
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.
|
delete |
|
delete |
|
delete |
|
delete |
|
static |
Definition at line 137 of file vulkan_memory.h.
References Halide::cast().
|
static |
Definition at line 159 of file vulkan_memory.h.
References Halide::Runtime::Internal::BlockAllocator::current_allocators(), Halide::Runtime::Internal::SystemMemoryAllocatorFns::deallocate, Halide::Runtime::Internal::BlockAllocator::destroy(), destroy(), halide_error_code_internal_error, halide_error_code_success, and Halide::Runtime::Internal::BlockAllocator::MemoryAllocators::system.
Referenced by destroy().
MemoryRegion * Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::reserve | ( | void * | user_context, |
const MemoryRequest & | request | ||
) |
Definition at line 213 of file vulkan_memory.h.
References Halide::cast(), and Halide::Runtime::Internal::BlockAllocator::reserve().
int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::conform | ( | void * | user_context, |
MemoryRequest * | request | ||
) |
Definition at line 852 of file vulkan_memory.h.
References Halide::Runtime::Internal::aligned_offset(), Halide::cast(), Halide::Runtime::Internal::conform_alignment(), Halide::Runtime::Internal::conform_size(), halide_error_code_success, VkPhysicalDeviceLimits::minStorageBufferOffsetAlignment, VkPhysicalDeviceLimits::minUniformBufferOffsetAlignment, Halide::Runtime::Internal::Vulkan::VulkanMemoryConfig::nearest_multiple, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, and VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT.
Referenced by conform_region_request().
int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::release | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 433 of file vulkan_memory.h.
References halide_error_code_generic_error, Halide::Runtime::Internal::MemoryRegion::offset, Halide::Runtime::Internal::BlockAllocator::release(), and Halide::Runtime::Internal::MemoryRegion::size.
int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::reclaim | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 452 of file vulkan_memory.h.
References halide_error_code_generic_error, Halide::Runtime::Internal::MemoryRegion::offset, Halide::Runtime::Internal::BlockAllocator::reclaim(), and Halide::Runtime::Internal::MemoryRegion::size.
int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::retain | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 471 of file vulkan_memory.h.
References halide_error_code_generic_error, Halide::Runtime::Internal::MemoryRegion::offset, Halide::Runtime::Internal::BlockAllocator::retain(), and Halide::Runtime::Internal::MemoryRegion::size.
bool Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::collect | ( | void * | user_context | ) |
Definition at line 490 of file vulkan_memory.h.
References Halide::Runtime::Internal::BlockAllocator::collect().
int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::release | ( | void * | user_context | ) |
Definition at line 501 of file vulkan_memory.h.
References halide_error_code_generic_error, and Halide::Runtime::Internal::BlockAllocator::release().
int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::destroy | ( | void * | user_context | ) |
Definition at line 518 of file vulkan_memory.h.
References Halide::Runtime::Internal::BlockAllocator::destroy(), and halide_error_code_success.
void * Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::map | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 236 of file vulkan_memory.h.
References Halide::cast(), 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, VK_SUCCESS, and vkMapMemory().
int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::unmap | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 302 of file vulkan_memory.h.
References Halide::cast(), 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 vkUnmapMemory().
MemoryRegion * Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::create_crop | ( | void * | user_context, |
MemoryRegion * | region, | ||
uint64_t | offset | ||
) |
Definition at line 341 of file vulkan_memory.h.
References Halide::Runtime::Internal::SystemMemoryAllocatorFns::allocate, Halide::cast(), Halide::Runtime::Internal::BlockAllocator::current_allocators(), Halide::Runtime::Internal::RegionAllocator::find_allocator(), halide_error_code_success, memcpy(), Halide::Runtime::Internal::MemoryRegion::offset, owner_of(), Halide::Runtime::Internal::MemoryRegion::size, and Halide::Runtime::Internal::BlockAllocator::MemoryAllocators::system.
int Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::destroy_crop | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 394 of file vulkan_memory.h.
References Halide::cast(), Halide::Runtime::Internal::BlockAllocator::current_allocators(), Halide::Runtime::Internal::SystemMemoryAllocatorFns::deallocate, Halide::Runtime::Internal::RegionAllocator::find_allocator(), halide_error_code_generic_error, halide_error_code_internal_error, halide_error_code_success, owner_of(), and Halide::Runtime::Internal::BlockAllocator::MemoryAllocators::system.
MemoryRegion * Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::owner_of | ( | void * | user_context, |
MemoryRegion * | region | ||
) |
Definition at line 424 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().
|
inline |
Definition at line 76 of file vulkan_memory.h.
|
inline |
Definition at line 79 of file vulkan_memory.h.
|
inline |
Definition at line 82 of file vulkan_memory.h.
|
inline |
Definition at line 85 of file vulkan_memory.h.
|
static |
Definition at line 534 of file vulkan_memory.h.
|
static |
Definition at line 614 of file vulkan_memory.h.
References Halide::Runtime::Internal::MemoryProperties::caching, Halide::cast(), Halide::Runtime::Internal::MemoryBlock::dedicated, 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::MemoryBlock::properties, Halide::Runtime::Internal::MemoryBlock::size, Halide::Runtime::Internal::MemoryProperties::usage, Halide::Runtime::Internal::MemoryProperties::visibility, VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, VK_SUCCESS, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT, and vkAllocateMemory().
|
static |
Definition at line 678 of file vulkan_memory.h.
References Halide::Runtime::Internal::MemoryProperties::caching, Halide::cast(), 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, Halide::Runtime::Internal::MemoryProperties::visibility, and vkFreeMemory().
|
static |
Definition at line 572 of file vulkan_memory.h.
References Halide::cast(), halide_error_code_internal_error, halide_error_code_success, VkPhysicalDeviceLimits::minStorageBufferOffsetAlignment, and VkPhysicalDeviceLimits::minUniformBufferOffsetAlignment.
|
static |
Definition at line 944 of file vulkan_memory.h.
References Halide::Runtime::Internal::MemoryProperties::caching, Halide::cast(), 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, Halide::Runtime::Internal::MemoryProperties::visibility, VK_SHARING_MODE_EXCLUSIVE, VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, VK_SUCCESS, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT, vkBindBufferMemory(), vkCreateBuffer(), vkDestroyBuffer(), and vkGetBufferMemoryRequirements().
|
static |
Definition at line 1069 of file vulkan_memory.h.
References Halide::Runtime::Internal::MemoryProperties::caching, Halide::cast(), Halide::Runtime::Internal::MemoryRegion::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::MemoryRegion::handle, Halide::Runtime::Internal::MemoryRegion::offset, Halide::Runtime::Internal::MemoryRegion::properties, Halide::Runtime::Internal::MemoryRegion::size, Halide::Runtime::Internal::MemoryProperties::usage, Halide::Runtime::Internal::MemoryProperties::visibility, and vkDestroyBuffer().
|
static |
Definition at line 912 of file vulkan_memory.h.
References Halide::cast(), conform(), halide_error_code_internal_error, halide_memory_caching_name(), halide_memory_usage_name(), and halide_memory_visibility_name().
size_t Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::bytes_allocated_for_blocks | ( | ) | const |
Definition at line 750 of file vulkan_memory.h.
size_t Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::blocks_allocated | ( | ) | const |
Definition at line 746 of file vulkan_memory.h.
size_t Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::bytes_allocated_for_regions | ( | ) | const |
Definition at line 1142 of file vulkan_memory.h.
size_t Halide::Runtime::Internal::Vulkan::VulkanMemoryAllocator::regions_allocated | ( | ) | const |
Definition at line 1138 of file vulkan_memory.h.