1#ifndef HALIDE_RUNTIME_VULKAN_MEMORY_H
2#define HALIDE_RUNTIME_VULKAN_MEMORY_H
80 return this->physical_device;
83 return this->physical_device_limits;
86 return this->alloc_callbacks;
126 bool is_preferred_memory_type_for_flags(
void *
user_context,
139 size_t block_byte_count = 0;
140 size_t block_count = 0;
141 size_t region_byte_count = 0;
142 size_t region_count = 0;
143 void *owner_context =
nullptr;
158 error(
user_context) <<
"VulkanBlockAllocator: Unable to create instance! Missing system allocator interface!\n";
165 if (result ==
nullptr) {
166 error(
user_context) <<
"VulkanMemoryAllocator: Failed to create instance! Out of memory!\n";
175 if (instance ==
nullptr) {
176 error(
user_context) <<
"VulkanBlockAllocator: Unable to destroy instance! Invalide instance pointer!\n";
182 error(
user_context) <<
"VulkanBlockAllocator: Unable to destroy instance! Missing system allocator interface!\n";
189int VulkanMemoryAllocator::initialize(
void *
user_context,
200 region_byte_count = 0;
202 block_byte_count = 0;
214 if (block_allocator ==
nullptr) {
215 error(
user_context) <<
"VulkanMemoryAllocator: Failed to create BlockAllocator! Out of memory?!\n";
228#if defined(HL_VK_DEBUG_MEM)
229 debug(
nullptr) <<
"VulkanMemoryAllocator: Reserving memory ("
231 <<
"block_allocator=" << (
void *)(block_allocator) <<
" "
233 <<
"device=" << (
void *)(device) <<
" "
234 <<
"physical_device=" << (
void *)(physical_device) <<
") ...\n";
237 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
238 error(
user_context) <<
"VulkanMemoryAllocator: Unable to reserve memory! Invalid device handle!\n";
242 if (block_allocator ==
nullptr) {
243 error(
user_context) <<
"VulkanMemoryAllocator: Unable to reserve memory! Invalid block allocator!\n";
251#if defined(HL_VK_DEBUG_MEM)
252 debug(
nullptr) <<
"VulkanMemoryAllocator: Mapping region ("
254 <<
"device=" << (
void *)(device) <<
" "
255 <<
"physical_device=" << (
void *)(physical_device) <<
" "
256 <<
"region=" << (
void *)(region) <<
" "
261 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
262 error(
user_context) <<
"VulkanMemoryAllocator: Unable to map memory! Invalid device handle!\n";
266 if (block_allocator ==
nullptr) {
267 error(
user_context) <<
"VulkanMemoryAllocator: Unable to map memory! Invalid block allocator!\n";
274 error(
user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid region allocator handle!\n";
279 if (block_resource ==
nullptr) {
280 error(
user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid block resource handle!\n";
286 error(
user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid device memory handle!\n";
294 error(
user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid memory range !\n";
297#if defined(HL_VK_DEBUG_MEM)
298 debug(
nullptr) <<
"VulkanMemoryAllocator: MapMemory ("
309 error(
user_context) <<
"VulkanMemoryAllocator: Mapping region failed! vkMapMemory returned error code: " <<
vk_get_error_name(result) <<
"\n";
317#if defined(HL_VK_DEBUG_MEM)
318 debug(
nullptr) <<
"VulkanMemoryAllocator: Unmapping region ("
320 <<
"device=" << (
void *)(device) <<
" "
321 <<
"physical_device=" << (
void *)(physical_device) <<
" "
322 <<
"region=" << (
void *)(region) <<
" "
327 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
328 error(
user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid device handle!\n";
335 error(
user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid region allocator handle!\n";
340 if (block_resource ==
nullptr) {
341 error(
user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid block resource handle!\n";
347 error(
user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid device memory handle!\n";
356#if defined(HL_VK_DEBUG_MEM)
357 debug(
nullptr) <<
"VulkanMemoryAllocator: Cropping region ("
359 <<
"device=" << (
void *)(device) <<
" "
360 <<
"physical_device=" << (
void *)(physical_device) <<
" "
361 <<
"region=" << (
void *)(region) <<
" "
364 <<
"crop_offset=" << (
int64_t)offset <<
") ...\n";
366 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
367 error(
user_context) <<
"VulkanMemoryAllocator: Unable to crop region! Invalid device handle!\n";
374 error(
user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid region allocator handle!\n";
381 error(
user_context) <<
"VulkanMemoryAllocator: Unable to crop region! Failed to retain memory region!\n";
388 error(
user_context) <<
"VulkanMemoryAllocator: Unable to create crop! Missing system allocator interface!\n";
396 error(
user_context) <<
"VulkanMemoryAllocator: Failed to allocate memory region! Out of memory!\n";
409 if (region ==
nullptr) {
410 error(
user_context) <<
"VulkanMemoryAllocator: Failed to destroy crop! Invalid memory region!\n";
417 error(
user_context) <<
"VulkanMemoryAllocator: Unable to destroy crop region! Invalid region allocator handle!\n";
424 error(
user_context) <<
"VulkanBlockAllocator: Unable to destroy crop region! Region allocator failed to release memory region!\n";
431 error(
user_context) <<
"VulkanBlockAllocator: Unable to destroy crop region! Missing system allocator interface!\n";
448#if defined(HL_VK_DEBUG_MEM)
449 debug(
nullptr) <<
"VulkanMemoryAllocator: Releasing region ("
451 <<
"region=" << (
void *)(region) <<
" "
455 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
456 error(
user_context) <<
"VulkanMemoryAllocator: Unable to release region! Invalid device handle!\n";
459 if (block_allocator ==
nullptr) {
460 error(
user_context) <<
"VulkanMemoryAllocator: Unable to release region! Invalid block allocator!\n";
463 return block_allocator->
release(
this, region);
467#if defined(HL_VK_DEBUG_MEM)
468 debug(
nullptr) <<
"VulkanMemoryAllocator: Reclaiming region ("
470 <<
"region=" << (
void *)(region) <<
" "
474 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
475 error(
user_context) <<
"VulkanMemoryAllocator: Unable to reclaim region! Invalid device handle!\n";
478 if (block_allocator ==
nullptr) {
479 error(
user_context) <<
"VulkanMemoryAllocator: Unable to reclaim region! Invalid block allocator!\n";
482 return block_allocator->
reclaim(
this, region);
486#if defined(HL_VK_DEBUG_MEM)
487 debug(
nullptr) <<
"VulkanMemoryAllocator: Retaining region ("
489 <<
"region=" << (
void *)(region) <<
" "
493 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
494 error(
user_context) <<
"VulkanMemoryAllocator: Unable to retain region! Invalid device handle!\n";
497 if (block_allocator ==
nullptr) {
498 error(
user_context) <<
"VulkanMemoryAllocator: Unable to retain region! Invalid block allocator!\n";
501 return block_allocator->
retain(
this, region);
505#if defined(HL_VK_DEBUG_MEM)
506 debug(
nullptr) <<
"VulkanMemoryAllocator: Collecting unused memory ("
509 if ((device ==
nullptr) || (physical_device ==
nullptr) || (block_allocator ==
nullptr)) {
512 return block_allocator->
collect(
this);
516#if defined(HL_VK_DEBUG_MEM)
517 debug(
nullptr) <<
"VulkanMemoryAllocator: Releasing block allocator ("
520 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
521 error(
user_context) <<
"VulkanMemoryAllocator: Unable to release allocator! Invalid device handle!\n";
524 if (block_allocator ==
nullptr) {
525 error(
user_context) <<
"VulkanMemoryAllocator: Unable to release allocator! Invalid block allocator!\n";
529 return block_allocator->
release(
this);
533#if defined(HL_VK_DEBUG_MEM)
534 debug(
nullptr) <<
"VulkanMemoryAllocator: Destroying allocator ("
537 if (block_allocator !=
nullptr) {
539 block_allocator =
nullptr;
542 region_byte_count = 0;
544 block_byte_count = 0;
556#if defined(HL_VK_DEBUG_MEM)
557 debug(
nullptr) <<
"VulkanMemoryAllocator: Looking up requirements ("
559 <<
"size=" << (
uint32_t)block->size <<
", "
575#if defined(HL_VK_DEBUG_MEM)
576 debug(
nullptr) <<
"VulkanMemoryAllocator: Failed to create buffer to find requirements!\n\t"
579 error(
user_context) <<
"VulkanRegionAllocator: Failed to create buffer to gather memory requirements!\n";
591 if (instance ==
nullptr) {
596#if defined(HL_VK_DEBUG_MEM)
597 debug(
nullptr) <<
"VulkanMemoryAllocator: Conforming block request ("
599 <<
"request=" << (
void *)(
request) <<
") ... \n";
602 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
603 error(
user_context) <<
"VulkanRegionAllocator: Unable to conform block request! Invalid device handle!\n";
611 error(
user_context) <<
"VulkanRegionAllocator: Failed to conform block request! Unable to lookup requirements!\n";
615#if defined(HL_VK_DEBUG_MEM)
616 debug(
nullptr) <<
"VulkanMemoryAllocator: Block allocated ("
620 <<
"uniform_buffer_offset_alignment=" << (
uint32_t)instance->physical_device_limits.minUniformBufferOffsetAlignment <<
", "
621 <<
"storage_buffer_offset_alignment=" << (
uint32_t)instance->physical_device_limits.minStorageBufferOffsetAlignment <<
", "
622 <<
"dedicated=" << (
request->dedicated ?
"true" :
"false") <<
")\n";
632 if (instance ==
nullptr) {
637 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
638 error(
user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid device handle!\n";
642 if (block ==
nullptr) {
643 error(
user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid pointer!\n";
647#if defined(HL_VK_DEBUG_MEM)
648 debug(
nullptr) <<
"VulkanMemoryAllocator: Allocating block ("
650 <<
"block=" << (
void *)(block) <<
" "
652 <<
"dedicated=" << (block->
dedicated ?
"true" :
"false") <<
" "
660 error(
user_context) <<
"VulkanBlockAllocator: Unable to allocate block! Failed to allocate device memory handle!\n";
692#if defined(HL_VK_DEBUG_MEM)
693 debug(
user_context) <<
"VulkanMemoryAllocator: Allocation request for preferred flags was not successful (\n"
694 <<
"\tblock=" << (
void *)(block) <<
"\n"
697 <<
"\tdedicated=" << (block->
dedicated ?
"true" :
"false") <<
"\n"
705 <<
"vkAllocateMemory returned: "
730#if defined(HL_VK_DEBUG_MEM)
731 debug(
user_context) <<
"VulkanMemoryAllocator: Allocation request for valid flags was not successful (\n"
732 <<
"\tblock=" << (
void *)(block) <<
"\n"
735 <<
"\tdedicated=" << (block->
dedicated ?
"true" :
"false") <<
"\n"
743 <<
"vkAllocateMemory returned: "
752 error(
user_context) <<
"VulkanMemoryAllocator: Allocation failed for block (\n"
753 <<
"\tblock=" << (
void *)(block) <<
"\n"
755 <<
"\tdedicated=" << (block->
dedicated ?
"true" :
"false") <<
"\n"
767 debug(
nullptr) <<
"vkAllocateMemory: Allocated memory for device region (" << (
uint64_t)block->
size <<
" bytes) ...\n";
771 instance->block_byte_count += block->
size;
772 instance->block_count++;
778 if (instance ==
nullptr) {
783#if defined(HL_VK_DEBUG_MEM)
784 debug(
nullptr) <<
"VulkanMemoryAllocator: Deallocating block ("
786 <<
"block=" << (
void *)(block) <<
") ... \n";
789 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
790 error(
user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid device handle!\n";
794 if (block ==
nullptr) {
795 error(
user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid pointer!\n";
799#if defined(HL_VK_DEBUG_MEM)
800 debug(
nullptr) <<
"VulkanBlockAllocator: deallocating block ("
802 <<
"dedicated=" << (block->
dedicated ?
"true" :
"false") <<
" "
809 if (block->
handle ==
nullptr) {
815 error(
user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid device memory handle!\n";
821 debug(
nullptr) <<
"vkFreeMemory: Deallocated memory for device region (" << (
uint64_t)block->
size <<
" bytes) ...\n";
824 if (instance->block_count > 0) {
825 instance->block_count--;
827 error(
nullptr) <<
"VulkanRegionAllocator: Block counter invalid ... reseting to zero!\n";
828 instance->block_count = 0;
832 instance->block_byte_count -= block->
size;
834 error(
nullptr) <<
"VulkanRegionAllocator: Block byte counter invalid ... reseting to zero!\n";
835 instance->block_byte_count = 0;
849 return block_byte_count;
852uint32_t VulkanMemoryAllocator::required_flags_for_memory_properties(
870 error(
user_context) <<
"VulkanMemoryAllocator: Unable to convert type! Invalid memory visibility request!\n\t"
872 return invalid_memory_type;
877uint32_t VulkanMemoryAllocator::preferred_flags_for_memory_properties(
893 error(
user_context) <<
"VulkanMemoryAllocator: Unable to convert type! Invalid memory visibility request!\n\t"
895 return invalid_memory_type;
920 error(
user_context) <<
"VulkanMemoryAllocator: Unable to convert type! Invalid memory caching request!\n\t"
922 return invalid_memory_type;
927bool VulkanMemoryAllocator::is_valid_memory_type_for_heap(
void *
user_context,
940bool VulkanMemoryAllocator::is_valid_memory_type_for_flags(
void *
user_context,
957bool VulkanMemoryAllocator::is_preferred_memory_type_for_flags(
void *
user_context,
995 error(
user_context) <<
"VulkanRegionAllocator: Failed to conform block request! Unable to lookup requirements!\n";
999#if defined(HL_VK_DEBUG_MEM)
1000 debug(
nullptr) <<
"VulkanMemoryAllocator: Buffer requirements ("
1001 <<
"requested_size=" << (
uint32_t)region->size <<
", "
1008 if ((
request->alignment %
this->physical_device_limits.minStorageBufferOffsetAlignment) != 0) {
1009 request->alignment = this->physical_device_limits.minStorageBufferOffsetAlignment;
1012 if ((
request->alignment %
this->physical_device_limits.minUniformBufferOffsetAlignment) != 0) {
1013 request->alignment = this->physical_device_limits.minUniformBufferOffsetAlignment;
1026#if defined(HL_VK_DEBUG_MEM)
1028 debug(
nullptr) <<
"VulkanMemoryAllocator: Adjusting request to match requirements (\n"
1046 if (instance ==
nullptr) {
1051#if defined(HL_VK_DEBUG_MEM)
1052 debug(
nullptr) <<
"VulkanMemoryAllocator: Conforming region request ("
1054 <<
"request=" << (
void *)(region) <<
") ... \n";
1057 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
1058 error(
user_context) <<
"VulkanRegionAllocator: Unable to conform region request! Invalid device handle!\n";
1062#if defined(HL_VK_DEBUG_MEM)
1063 debug(
nullptr) <<
"VulkanRegionAllocator: Conforming region request ("
1066 <<
"dedicated=" << (
request->dedicated ?
"true" :
"false") <<
" "
1078 if (instance ==
nullptr) {
1083#if defined(HL_VK_DEBUG_MEM)
1084 debug(
nullptr) <<
"VulkanMemoryAllocator: Allocating region ("
1086 <<
"region=" << (
void *)(region) <<
") ... \n";
1089 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
1090 error(
user_context) <<
"VulkanRegionAllocator: Unable to allocate region! Invalid device handle!\n";
1094 if (region ==
nullptr) {
1095 error(
user_context) <<
"VulkanRegionAllocator: Unable to allocate region! Invalid pointer!\n";
1099#if defined(HL_VK_DEBUG_MEM)
1100 debug(
nullptr) <<
"VulkanRegionAllocator: Allocating region ("
1103 <<
"dedicated=" << (region->
dedicated ?
"true" :
"false") <<
" "
1121 if (buffer ==
nullptr) {
1122 error(
user_context) <<
"VulkanRegionAllocator: Unable to allocate region! Failed to allocate buffer handle!\n";
1133 vk_host_free(
nullptr, buffer, instance->alloc_callbacks);
1135 error(
user_context) <<
"VulkanRegionAllocator: Failed to create buffer!\n\t"
1148#if defined(HL_VK_DEBUG_MEM)
1149 debug(
nullptr) <<
"VulkanMemoryAllocator: Buffer requirements ("
1156 vkDestroyBuffer(instance->device, *buffer, instance->alloc_callbacks);
1158 debug(
nullptr) <<
"VulkanMemoryAllocator: Reallocating buffer to match required size ("
1164 error(
user_context) <<
"VulkanRegionAllocator: Failed to recreate buffer!\n\t"
1171 debug(
nullptr) <<
"vkCreateBuffer: Created buffer for device region (" << (
uint64_t)region->
size <<
" bytes) ...\n";
1176 error(
user_context) <<
"VulkanBlockAllocator: Unable to allocate region! Invalid region allocator!\n";
1181 if (block_resource ==
nullptr) {
1182 error(
user_context) <<
"VulkanBlockAllocator: Unable to allocate region! Invalid block resource handle!\n";
1188 error(
user_context) <<
"VulkanBlockAllocator: Unable to allocate region! Invalid device memory handle!\n";
1195 error(
user_context) <<
"VulkanRegionAllocator: Failed to bind buffer!\n\t"
1200 region->
handle = (
void *)buffer;
1202 instance->region_byte_count += region->
size;
1203 instance->region_count++;
1209 if (instance ==
nullptr) {
1214#if defined(HL_VK_DEBUG_MEM)
1215 debug(
nullptr) <<
"VulkanMemoryAllocator: Deallocating region ("
1217 <<
"region=" << (
void *)(region) <<
") ... \n";
1220 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
1221 error(
user_context) <<
"VulkanRegionAllocator: Unable to deallocate region! Invalid device handle!\n";
1225 if (region ==
nullptr) {
1226 error(
user_context) <<
"VulkanRegionAllocator: Unable to deallocate region! Invalid pointer!\n";
1230#if defined(HL_VK_DEBUG_MEM)
1231 debug(
nullptr) <<
"VulkanRegionAllocator: Deallocating region ("
1234 <<
"dedicated=" << (region->
dedicated ?
"true" :
"false") <<
" "
1240 if (region->
handle ==
nullptr) {
1241 error(
user_context) <<
"VulkanRegionAllocator: Unable to deallocate region! Invalid handle!\n";
1246 if (buffer ==
nullptr) {
1247 error(
user_context) <<
"VulkanRegionAllocator: Unable to deallocate region! Invalid buffer handle!\n";
1251 vkDestroyBuffer(instance->device, *buffer, instance->alloc_callbacks);
1253 debug(
nullptr) <<
"vkDestroyBuffer: Destroyed buffer for device region (" << (
uint64_t)region->
size <<
" bytes) ...\n";
1256 region->
handle =
nullptr;
1257 if (instance->region_count > 0) {
1258 instance->region_count--;
1260 error(
user_context) <<
"VulkanRegionAllocator: Region counter invalid ... reseting to zero!\n";
1261 instance->region_count = 0;
1266 instance->region_byte_count -= region->
size;
1268 error(
user_context) <<
"VulkanRegionAllocator: Region byte counter invalid ... reseting to zero!\n";
1269 instance->region_byte_count = 0;
1272 vk_host_free(
nullptr, buffer, instance->alloc_callbacks);
1278 return region_count;
1282 return region_byte_count;
1287 switch (properties.
usage) {
1307 error(
user_context) <<
"VulkanRegionAllocator: Unable to convert type! Invalid memory usage request!\n\t"
1309 return invalid_usage_flags;
1312 if (result == invalid_usage_flags) {
1313 error(
user_context) <<
"VulkanRegionAllocator: Failed to find appropriate memory usage for given properties:\n\t"
1317 return invalid_usage_flags;
1340 return callbacks->pfnAllocation(
user_context, size, alignment, scope);
1375 print(
user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.maximum_pool_size <<
" for maximum pool size (in bytes)\n";
1379 print(
user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.minimum_block_size <<
" for minimum block size (in bytes)\n";
1383 print(
user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.maximum_block_size <<
" for maximum block size (in bytes)\n";
1387 print(
user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.maximum_block_count <<
" for maximum block count\n";
1391 print(
user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.nearest_multiple <<
" for nearest multiple\n";
1396 config, device, physical_device,
1419 <<
" vk_clear_device_buffer (user_context: " <<
user_context <<
", "
1420 <<
"allocator: " << (
void *)
allocator <<
", "
1498 custom_allocation_callbacks = callbacks;
1504 return custom_allocation_callbacks;
halide_error_code_t
The error codes that may be returned by a Halide pipeline.
@ halide_error_code_internal_error
There is a bug in the Halide compiler.
@ halide_error_code_generic_error
An uncategorized error occurred.
@ halide_error_code_success
There was no error.
@ halide_error_code_device_malloc_failed
The Halide runtime encountered an error while trying to allocate memory on device.
@ halide_error_code_out_of_memory
A call to halide_malloc returned NULL.
Allocator class interface for managing large contiguous blocks of memory, which are then sub-allocate...
bool collect(void *user_context)
MemoryRegion * reserve(void *user_context, const MemoryRequest &request)
int release(void *user_context, MemoryRegion *region)
int retain(void *user_context, MemoryRegion *region)
static void destroy(void *user_context, BlockAllocator *block_allocator)
static BlockAllocator * create(void *user_context, const Config &config, const MemoryAllocators &allocators)
int reclaim(void *user_context, MemoryRegion *region)
const MemoryAllocators & current_allocators() const
Allocator class interface for sub-allocating a contiguous memory block into smaller regions of memory...
static RegionAllocator * find_allocator(void *user_context, MemoryRegion *memory_region)
Vulkan Memory Allocator class interface for managing large memory requests stored as contiguous block...
int reclaim(void *user_context, MemoryRegion *region)
static const VulkanMemoryConfig & default_config()
MemoryRegion * reserve(void *user_context, const MemoryRequest &request)
VulkanMemoryAllocator(const VulkanMemoryAllocator &)=delete
int release(void *user_context, MemoryRegion *region)
static int allocate_block(void *instance_ptr, MemoryBlock *block)
int conform(void *user_context, MemoryRequest *request)
static int deallocate_region(void *instance_ptr, MemoryRegion *region)
VulkanMemoryAllocator & operator=(const VulkanMemoryAllocator &)=delete
static int destroy(void *user_context, VulkanMemoryAllocator *allocator)
int unmap(void *user_context, MemoryRegion *region)
static int conform_region_request(void *instance_ptr, MemoryRequest *request)
~VulkanMemoryAllocator()=delete
MemoryRegion * create_crop(void *user_context, MemoryRegion *region, uint64_t offset)
int destroy_crop(void *user_context, MemoryRegion *region)
size_t regions_allocated() const
size_t blocks_allocated() const
static int allocate_region(void *instance_ptr, MemoryRegion *region)
static int conform_block_request(void *instance_ptr, MemoryRequest *request)
MemoryRegion * owner_of(void *user_context, MemoryRegion *region)
VkDevice current_device() const
VkPhysicalDeviceLimits current_physical_device_limits() const
bool collect(void *user_context)
size_t bytes_allocated_for_blocks() const
const VkAllocationCallbacks * callbacks() const
static int deallocate_block(void *instance_ptr, MemoryBlock *block)
VulkanMemoryAllocator()=delete
void * map(void *user_context, MemoryRegion *region)
VkPhysicalDevice current_physical_device() const
size_t bytes_allocated_for_regions() const
int retain(void *user_context, MemoryRegion *region)
static VulkanMemoryAllocator * create(void *user_context, const VulkanMemoryConfig &config, VkDevice dev, VkPhysicalDevice phys_dev, const SystemMemoryAllocatorFns &system_allocator, const VkAllocationCallbacks *alloc_callbacks=nullptr)
WEAK const char * halide_memory_caching_name(MemoryCaching value)
WEAK const char * halide_memory_usage_name(MemoryUsage value)
WEAK const char * halide_memory_visibility_name(MemoryVisibility value)
WEAK VulkanMemoryConfig memory_allocator_config
WEAK const VkAllocationCallbacks * custom_allocation_callbacks
WEAK ScopedSpinLock::AtomicFlag custom_allocation_callbacks_lock
WEAK char alloc_config[1024]
ALWAYS_INLINE size_t conform_alignment(size_t requested, size_t required)
ALWAYS_INLINE size_t conform_size(size_t offset, size_t size, size_t alignment, size_t nearest_multiple)
ALWAYS_INLINE size_t aligned_offset(size_t offset, size_t alignment)
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.
Expr print(const std::vector< Expr > &values)
Create an Expr that prints out its value whenever it is evaluated.
unsigned __INT64_TYPE__ uint64_t
signed __INT64_TYPE__ int64_t
void * memcpy(void *s1, const void *s2, size_t n)
void * memset(void *s, int val, size_t n)
unsigned __INT32_TYPE__ uint32_t
MemoryRegionAllocatorFns region
MemoryBlockAllocatorFns block
SystemMemoryAllocatorFns system
MemoryProperties properties
MemoryVisibility visibility
MemoryProperties properties
static bool is_empty(const char *str)
DeallocateSystemFn deallocate
AllocateSystemFn allocate
size_t maximum_block_size
size_t minimum_block_size
size_t maximum_block_count
WEAK void halide_vulkan_set_allocation_callbacks(const VkAllocationCallbacks *callbacks)
WEAK const VkAllocationCallbacks * halide_vulkan_get_allocation_callbacks(void *user_context)
VkCommandBuffer command_buffer
VulkanMemoryAllocator * allocator