1#ifndef HALIDE_RUNTIME_VULKAN_MEMORY_H
2#define HALIDE_RUNTIME_VULKAN_MEMORY_H
65 bool collect(
void *user_context);
66 int release(
void *user_context);
67 int destroy(
void *user_context);
79 return this->physical_device;
82 return this->alloc_callbacks;
111 uint32_t select_memory_type(
void *user_context,
116 size_t block_byte_count = 0;
117 size_t block_count = 0;
118 size_t region_byte_count = 0;
119 size_t region_count = 0;
120 void *owner_context =
nullptr;
135 error(user_context) <<
"VulkanBlockAllocator: Unable to create instance! Missing system allocator interface!\n";
142 if (result ==
nullptr) {
143 error(user_context) <<
"VulkanMemoryAllocator: Failed to create instance! Out of memory!\n";
152 if (instance ==
nullptr) {
153 error(user_context) <<
"VulkanBlockAllocator: Unable to destroy instance! Invalide instance pointer!\n";
157 instance->
destroy(user_context);
160 error(user_context) <<
"VulkanBlockAllocator: Unable to destroy instance! Missing system allocator interface!\n";
167int VulkanMemoryAllocator::initialize(
void *user_context,
172 owner_context = user_context;
178 region_byte_count = 0;
180 block_byte_count = 0;
192 if (block_allocator ==
nullptr) {
193 error(user_context) <<
"VulkanMemoryAllocator: Failed to create BlockAllocator! Out of memory?!\n";
206#if defined(HL_VK_DEBUG_MEM)
207 debug(
nullptr) <<
"VulkanMemoryAllocator: Reserving memory ("
208 <<
"user_context=" << user_context <<
" "
209 <<
"block_allocator=" << (
void *)(block_allocator) <<
" "
211 <<
"device=" << (
void *)(device) <<
" "
212 <<
"physical_device=" << (
void *)(physical_device) <<
") ...\n";
215 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
216 error(user_context) <<
"VulkanMemoryAllocator: Unable to reserve memory! Invalid device handle!\n";
220 if (block_allocator ==
nullptr) {
221 error(user_context) <<
"VulkanMemoryAllocator: Unable to reserve memory! Invalid block allocator!\n";
229#if defined(HL_VK_DEBUG_MEM)
230 debug(
nullptr) <<
"VulkanMemoryAllocator: Mapping region ("
231 <<
"user_context=" << user_context <<
" "
232 <<
"device=" << (
void *)(device) <<
" "
233 <<
"physical_device=" << (
void *)(physical_device) <<
" "
234 <<
"region=" << (
void *)(region) <<
" "
239 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
240 error(user_context) <<
"VulkanMemoryAllocator: Unable to map memory! Invalid device handle!\n";
244 if (block_allocator ==
nullptr) {
245 error(user_context) <<
"VulkanMemoryAllocator: Unable to map memory! Invalid block allocator!\n";
252 error(user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid region allocator handle!\n";
257 if (block_resource ==
nullptr) {
258 error(user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid block resource handle!\n";
264 error(user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid device memory handle!\n";
272 error(user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid memory range !\n";
275 debug(
nullptr) <<
"VulkanMemoryAllocator: MapMemory ("
276 <<
"user_context=" << user_context <<
"\n"
286 error(user_context) <<
"VulkanMemoryAllocator: Mapping region failed! vkMapMemory returned error code: " <<
vk_get_error_name(result) <<
"\n";
294#if defined(HL_VK_DEBUG_MEM)
295 debug(
nullptr) <<
"VulkanMemoryAllocator: Unmapping region ("
296 <<
"user_context=" << user_context <<
" "
297 <<
"device=" << (
void *)(device) <<
" "
298 <<
"physical_device=" << (
void *)(physical_device) <<
" "
299 <<
"region=" << (
void *)(region) <<
" "
304 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
305 error(user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid device handle!\n";
312 error(user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid region allocator handle!\n";
317 if (block_resource ==
nullptr) {
318 error(user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid block resource handle!\n";
324 error(user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid device memory handle!\n";
333#if defined(HL_VK_DEBUG_MEM)
334 debug(
nullptr) <<
"VulkanMemoryAllocator: Cropping region ("
335 <<
"user_context=" << user_context <<
" "
336 <<
"device=" << (
void *)(device) <<
" "
337 <<
"physical_device=" << (
void *)(physical_device) <<
" "
338 <<
"region=" << (
void *)(region) <<
" "
341 <<
"crop_offset=" << (
int64_t)offset <<
") ...\n";
343 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
344 error(user_context) <<
"VulkanMemoryAllocator: Unable to crop region! Invalid device handle!\n";
351 error(user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid region allocator handle!\n";
358 error(user_context) <<
"VulkanMemoryAllocator: Unable to crop region! Failed to retain memory region!\n";
365 error(user_context) <<
"VulkanMemoryAllocator: Unable to create crop! Missing system allocator interface!\n";
373 error(user_context) <<
"VulkanMemoryAllocator: Failed to allocate memory region! Out of memory!\n";
386 if (region ==
nullptr) {
387 error(user_context) <<
"VulkanMemoryAllocator: Failed to destroy crop! Invalid memory region!\n";
394 error(user_context) <<
"VulkanMemoryAllocator: Unable to destroy crop region! Invalid region allocator handle!\n";
401 error(user_context) <<
"VulkanBlockAllocator: Unable to destroy crop region! Region allocator failed to release memory region!\n";
408 error(user_context) <<
"VulkanBlockAllocator: Unable to destroy crop region! Missing system allocator interface!\n";
425#if defined(HL_VK_DEBUG_MEM)
426 debug(
nullptr) <<
"VulkanMemoryAllocator: Releasing region ("
427 <<
"user_context=" << user_context <<
" "
428 <<
"region=" << (
void *)(region) <<
" "
432 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
433 error(user_context) <<
"VulkanMemoryAllocator: Unable to release region! Invalid device handle!\n";
436 if (block_allocator ==
nullptr) {
437 error(user_context) <<
"VulkanMemoryAllocator: Unable to release region! Invalid block allocator!\n";
440 return block_allocator->
release(
this, region);
444#if defined(HL_VK_DEBUG_MEM)
445 debug(
nullptr) <<
"VulkanMemoryAllocator: Reclaiming region ("
446 <<
"user_context=" << user_context <<
" "
447 <<
"region=" << (
void *)(region) <<
" "
451 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
452 error(user_context) <<
"VulkanMemoryAllocator: Unable to reclaim region! Invalid device handle!\n";
455 if (block_allocator ==
nullptr) {
456 error(user_context) <<
"VulkanMemoryAllocator: Unable to reclaim region! Invalid block allocator!\n";
459 return block_allocator->
reclaim(
this, region);
463#if defined(HL_VK_DEBUG_MEM)
464 debug(
nullptr) <<
"VulkanMemoryAllocator: Retaining region ("
465 <<
"user_context=" << user_context <<
" "
466 <<
"region=" << (
void *)(region) <<
" "
470 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
471 error(user_context) <<
"VulkanMemoryAllocator: Unable to retain region! Invalid device handle!\n";
474 if (block_allocator ==
nullptr) {
475 error(user_context) <<
"VulkanMemoryAllocator: Unable to retain region! Invalid block allocator!\n";
478 return block_allocator->
retain(
this, region);
482#if defined(HL_VK_DEBUG_MEM)
483 debug(
nullptr) <<
"VulkanMemoryAllocator: Collecting unused memory ("
484 <<
"user_context=" << user_context <<
") ... \n";
486 if ((device ==
nullptr) || (physical_device ==
nullptr) || (block_allocator ==
nullptr)) {
489 return block_allocator->
collect(
this);
493#if defined(HL_VK_DEBUG_MEM)
494 debug(
nullptr) <<
"VulkanMemoryAllocator: Releasing block allocator ("
495 <<
"user_context=" << user_context <<
") ... \n";
497 if ((device ==
nullptr) || (physical_device ==
nullptr)) {
498 error(user_context) <<
"VulkanMemoryAllocator: Unable to release allocator! Invalid device handle!\n";
501 if (block_allocator ==
nullptr) {
502 error(user_context) <<
"VulkanMemoryAllocator: Unable to release allocator! Invalid block allocator!\n";
506 return block_allocator->
release(
this);
510#if defined(HL_VK_DEBUG_MEM)
511 debug(
nullptr) <<
"VulkanMemoryAllocator: Destroying allocator ("
512 <<
"user_context=" << user_context <<
") ... \n";
514 if (block_allocator !=
nullptr) {
515 block_allocator->
destroy(
this);
518 region_byte_count = 0;
520 block_byte_count = 0;
534 if (instance ==
nullptr) {
538 void *user_context = instance->owner_context;
539 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
540 error(user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid device handle!\n";
544 if (block ==
nullptr) {
545 error(user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid pointer!\n";
549#if defined(HL_VK_DEBUG_MEM)
550 debug(
nullptr) <<
"VulkanMemoryAllocator: Allocating block ("
551 <<
"user_context=" << user_context <<
" "
552 <<
"block=" << (
void *)(block) <<
" "
554 <<
"dedicated=" << (block->
dedicated ?
"true" :
"false") <<
" "
561 uint32_t memory_type = instance->select_memory_type(user_context, instance->physical_device, block->
properties, 0);
562 if (memory_type == invalid_memory_type) {
563 error(user_context) <<
"VulkanMemoryAllocator: Unable to find appropriate memory type for device!\n";
577 debug(
nullptr) <<
"VulkanBlockAllocator: Unable to allocate block! Failed to allocate device memory handle!\n";
583 debug(
nullptr) <<
"VulkanMemoryAllocator: Allocation failed! vkAllocateMemory returned: " <<
vk_get_error_name(result) <<
"\n";
587 debug(
nullptr) <<
"vkAllocateMemory: Allocated memory for device region (" << (
uint64_t)block->
size <<
" bytes) ...\n";
605 debug(
nullptr) <<
"VulkanMemoryAllocator: Failed to create buffer!\n\t"
614#if defined(HL_VK_DEBUG_MEM)
615 debug(
nullptr) <<
"VulkanMemoryAllocator: Block allocated ("
620 <<
"dedicated=" << (block->
dedicated ?
"true" :
"false") <<
")\n";
634 instance->block_byte_count += block->
size;
635 instance->block_count++;
641 if (instance ==
nullptr) {
645 void *user_context = instance->owner_context;
646#if defined(HL_VK_DEBUG_MEM)
647 debug(
nullptr) <<
"VulkanMemoryAllocator: Deallocating block ("
648 <<
"user_context=" << user_context <<
" "
649 <<
"block=" << (
void *)(block) <<
") ... \n";
652 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
653 error(user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid device handle!\n";
657 if (block ==
nullptr) {
658 error(user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid pointer!\n";
662#if defined(HL_VK_DEBUG_MEM)
663 debug(
nullptr) <<
"VulkanBlockAllocator: deallocating block ("
665 <<
"dedicated=" << (block->
dedicated ?
"true" :
"false") <<
" "
671 if (block->
handle ==
nullptr) {
672 error(user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid handle!\n";
678 error(user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid device memory handle!\n";
684 debug(
nullptr) <<
"vkFreeMemory: Deallocated memory for device region (" << (
uint64_t)block->
size <<
" bytes) ...\n";
687 if (instance->block_count > 0) {
688 instance->block_count--;
690 error(
nullptr) <<
"VulkanRegionAllocator: Block counter invalid ... reseting to zero!\n";
691 instance->block_count = 0;
695 instance->block_byte_count -= block->
size;
697 error(
nullptr) <<
"VulkanRegionAllocator: Block byte counter invalid ... reseting to zero!\n";
698 instance->block_byte_count = 0;
712 return block_byte_count;
715uint32_t VulkanMemoryAllocator::select_memory_type(
void *user_context,
739 error(
nullptr) <<
"VulkanMemoryAllocator: Unable to convert type! Invalid memory visibility request!\n\t"
741 return invalid_memory_type;
765 error(user_context) <<
"VulkanMemoryAllocator: Unable to convert type! Invalid memory caching request!\n\t"
767 return invalid_memory_type;
773 uint32_t result = invalid_memory_type;
800 if (result == invalid_memory_type) {
801 error(user_context) <<
"VulkanBlockAllocator: Failed to find appropriate memory type for given properties:\n\t"
805 return invalid_memory_type;
816 if (instance ==
nullptr) {
820 void *user_context = instance->owner_context;
821#if defined(HL_VK_DEBUG_MEM)
822 debug(
nullptr) <<
"VulkanMemoryAllocator: Allocating region ("
823 <<
"user_context=" << user_context <<
" "
824 <<
"region=" << (
void *)(region) <<
") ... \n";
827 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
828 error(user_context) <<
"VulkanRegionAllocator: Unable to allocate region! Invalid device handle!\n";
832 if (region ==
nullptr) {
833 error(user_context) <<
"VulkanRegionAllocator: Unable to allocate region! Invalid pointer!\n";
837#if defined(HL_VK_DEBUG_MEM)
838 debug(
nullptr) <<
"VulkanRegionAllocator: Allocating region ("
841 <<
"dedicated=" << (region->
dedicated ?
"true" :
"false") <<
" "
859 if (buffer ==
nullptr) {
860 error(user_context) <<
"VulkanRegionAllocator: Unable to allocate region! Failed to allocate buffer handle!\n";
866 error(user_context) <<
"VulkanRegionAllocator: Failed to create buffer!\n\t"
871 debug(
nullptr) <<
"vkCreateBuffer: Created buffer for device region (" << (
uint64_t)region->
size <<
" bytes) ...\n";
876 error(user_context) <<
"VulkanBlockAllocator: Unable to allocate region! Invalid region allocator!\n";
881 if (block_resource ==
nullptr) {
882 error(user_context) <<
"VulkanBlockAllocator: Unable to allocate region! Invalid block resource handle!\n";
888 error(user_context) <<
"VulkanBlockAllocator: Unable to allocate region! Invalid device memory handle!\n";
895 error(user_context) <<
"VulkanRegionAllocator: Failed to bind buffer!\n\t"
900 region->
handle = (
void *)buffer;
902 instance->region_byte_count += region->
size;
903 instance->region_count++;
909 if (instance ==
nullptr) {
913 void *user_context = instance->owner_context;
914#if defined(HL_VK_DEBUG_MEM)
915 debug(
nullptr) <<
"VulkanMemoryAllocator: Deallocating region ("
916 <<
"user_context=" << user_context <<
" "
917 <<
"region=" << (
void *)(region) <<
") ... \n";
920 if ((instance->device ==
nullptr) || (instance->physical_device ==
nullptr)) {
921 error(user_context) <<
"VulkanRegionAllocator: Unable to deallocate region! Invalid device handle!\n";
925 if (region ==
nullptr) {
926 error(user_context) <<
"VulkanRegionAllocator: Unable to deallocate region! Invalid pointer!\n";
930#if defined(HL_VK_DEBUG_MEM)
931 debug(
nullptr) <<
"VulkanRegionAllocator: Deallocating region ("
934 <<
"dedicated=" << (region->
dedicated ?
"true" :
"false") <<
" "
940 if (region->
handle ==
nullptr) {
941 error(user_context) <<
"VulkanRegionAllocator: Unable to deallocate region! Invalid handle!\n";
946 if (buffer ==
nullptr) {
947 error(user_context) <<
"VulkanRegionAllocator: Unable to deallocate region! Invalid buffer handle!\n";
953 debug(
nullptr) <<
"vkDestroyBuffer: Destroyed buffer for device region (" << (
uint64_t)region->
size <<
" bytes) ...\n";
956 if (instance->region_count > 0) {
957 instance->region_count--;
959 error(
nullptr) <<
"VulkanRegionAllocator: Region counter invalid ... reseting to zero!\n";
960 instance->region_count = 0;
965 instance->region_byte_count -= region->
size;
967 error(
nullptr) <<
"VulkanRegionAllocator: Region byte counter invalid ... reseting to zero!\n";
968 instance->region_byte_count = 0;
971 vk_host_free(
nullptr, buffer, instance->alloc_callbacks);
981 return region_byte_count;
986 switch (properties.
usage) {
1006 error(user_context) <<
"VulkanRegionAllocator: Unable to convert type! Invalid memory usage request!\n\t"
1008 return invalid_usage_flags;
1011 if (result == invalid_usage_flags) {
1012 error(user_context) <<
"VulkanRegionAllocator: Failed to find appropriate memory usage for given properties:\n\t"
1016 return invalid_usage_flags;
1039 return callbacks->
pfnAllocation(user_context, size, alignment, scope);
1047 return callbacks->
pfnFree(user_context, ptr);
1074 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.maximum_pool_size <<
" for maximum pool size (in bytes)\n";
1078 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.minimum_block_size <<
" for minimum block size (in bytes)\n";
1082 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.maximum_block_size <<
" for maximum block size (in bytes)\n";
1086 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.maximum_block_count <<
" for maximum block count\n";
1090 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.nearest_multiple <<
" for nearest multiple\n";
1095 config, device, physical_device,
1100 if (allocator !=
nullptr) {
1102 allocator =
nullptr;
1110 VulkanMemoryAllocator *allocator,
1117 <<
" vk_clear_device_buffer (user_context: " << user_context <<
", "
1118 <<
"allocator: " << (
void *)allocator <<
", "
1119 <<
"command_pool: " << (
void *)command_pool <<
", "
1128 error(user_context) <<
"Vulkan: Failed to create command buffer!\n";
1143 error(user_context) <<
"Vulkan: vkBeginCommandBuffer returned " <<
vk_get_error_name(result) <<
"\n";
1153 error(user_context) <<
"Vulkan: vkEndCommandBuffer returned " <<
vk_get_error_name(result) <<
"\n";
1173 error(user_context) <<
"Vulkan: vkQueueSubmit returned " <<
vk_get_error_name(result) <<
"\n";
1180 error(user_context) <<
"Vulkan: vkQueueWaitIdle returned " <<
vk_get_error_name(result) <<
"\n";
1186 error(user_context) <<
"Vulkan: Failed to destroy command buffer!\n";
1210 custom_allocation_callbacks = callbacks;
1216 return custom_allocation_callbacks;
@ 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()
VulkanMemoryAllocator(const VulkanMemoryAllocator &)=delete
int release(void *user_context, MemoryRegion *region)
static int allocate_block(void *instance_ptr, MemoryBlock *block)
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)
~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)
MemoryRegion * owner_of(void *user_context, MemoryRegion *region)
VkDevice current_device() const
MemoryRegion * reserve(void *user_context, MemoryRequest &request)
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)
VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
VkFlags VkMemoryPropertyFlags
VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data)
VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory)
#define VK_MAX_MEMORY_TYPES
@ VK_SHARING_MODE_EXCLUSIVE
@ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
@ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
@ VK_MEMORY_PROPERTY_HOST_CACHED_BIT
@ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements *pMemoryRequirements)
@ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue)
VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator)
@ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer)
VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence)
VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData)
@ VK_BUFFER_USAGE_TRANSFER_DST_BIT
@ VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT
@ VK_BUFFER_USAGE_STORAGE_BUFFER_BIT
@ VK_BUFFER_USAGE_TRANSFER_SRC_BIT
VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer)
VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator)
@ VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
@ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
@ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
@ VK_STRUCTURE_TYPE_SUBMIT_INFO
VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo)
WEAK VulkanMemoryConfig memory_allocator_config
WEAK const VkAllocationCallbacks * custom_allocation_callbacks
WEAK ScopedSpinLock::AtomicFlag custom_allocation_callbacks_lock
WEAK char alloc_config[1024]
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
Expr cast(Expr a)
Cast an expression to the halide type corresponding to the C++ type T.
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
PFN_vkAllocationFunction pfnAllocation
PFN_vkFreeFunction pfnFree
VkDeviceSize minStorageBufferOffsetAlignment
VkDeviceSize minUniformBufferOffsetAlignment
WEAK void halide_vulkan_set_allocation_callbacks(const VkAllocationCallbacks *callbacks)
WEAK const VkAllocationCallbacks * halide_vulkan_get_allocation_callbacks(void *user_context)