1 #ifndef HALIDE_RUNTIME_VULKAN_MEMORY_H
2 #define HALIDE_RUNTIME_VULKAN_MEMORY_H
54 VkDevice dev, VkPhysicalDevice phys_dev,
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;
105 VkDevice dev, VkPhysicalDevice phys_dev,
111 uint32_t select_memory_type(
void *user_context,
112 VkPhysicalDevice physical_device,
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;
122 VkDevice device =
nullptr;
123 VkPhysicalDevice physical_device =
nullptr;
134 if (system_allocator.
allocate ==
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";
147 result->initialize(user_context, cfg, dev, phys_dev, system_allocator, alloc_callbacks);
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";
167 int VulkanMemoryAllocator::initialize(
void *user_context,
172 owner_context = user_context;
175 physical_device = phys_dev;
178 region_byte_count = 0;
180 block_byte_count = 0;
182 allocators.
system = system_allocator;
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";
225 return block_allocator->
reserve(
this, request);
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";
251 if (region_allocator ==
nullptr) {
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";
262 VkDeviceMemory *device_memory =
reinterpret_cast<VkDeviceMemory *
>(block_resource->
memory.
handle);
263 if (device_memory ==
nullptr) {
264 error(user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid device memory handle!\n";
268 void *mapped_ptr =
nullptr;
272 error(user_context) <<
"VulkanMemoryAllocator: Unable to map region! Invalid memory range !\n";
275 debug(
nullptr) <<
"VulkanMemoryAllocator: MapMemory ("
276 <<
"user_context=" << user_context <<
"\n"
281 <<
" memory_offset=" << (
uint32_t)memory_offset <<
"\n"
282 <<
" memory_size=" << (
uint32_t)memory_size <<
") ...\n";
284 VkResult result =
vkMapMemory(device, *device_memory, memory_offset, memory_size, 0, (
void **)(&mapped_ptr));
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";
311 if (region_allocator ==
nullptr) {
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";
322 VkDeviceMemory *device_memory =
reinterpret_cast<VkDeviceMemory *
>(block_resource->
memory.
handle);
323 if (device_memory ==
nullptr) {
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";
350 if (region_allocator ==
nullptr) {
351 error(user_context) <<
"VulkanMemoryAllocator: Unable to unmap region! Invalid region allocator handle!\n";
356 int error_code = region_allocator->
retain(
this, owner);
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";
372 if (memory_region ==
nullptr) {
373 error(user_context) <<
"VulkanMemoryAllocator: Failed to allocate memory region! Out of memory!\n";
380 memory_region->
handle = (
void *)owner;
382 return memory_region;
386 if (region ==
nullptr) {
387 error(user_context) <<
"VulkanMemoryAllocator: Failed to destroy crop! Invalid memory region!\n";
393 if (region_allocator ==
nullptr) {
394 error(user_context) <<
"VulkanMemoryAllocator: Unable to destroy crop region! Invalid region allocator handle!\n";
399 int error_code = region_allocator->
release(
this, owner);
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";
575 VkDeviceMemory *device_memory = (VkDeviceMemory *)vk_host_malloc(
nullptr,
sizeof(VkDeviceMemory), 0,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT, instance->alloc_callbacks);
576 if (device_memory ==
nullptr) {
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";
590 uint32_t usage_flags = instance->select_memory_usage(user_context, block->
properties);
602 VkBuffer buffer = {0};
603 result =
vkCreateBuffer(instance->device, &create_info, instance->alloc_callbacks, &buffer);
605 debug(
nullptr) <<
"VulkanMemoryAllocator: Failed to create buffer!\n\t"
606 <<
"vkCreateBuffer returned: " << vk_get_error_name(result) <<
"\n";
614 #if defined(HL_VK_DEBUG_MEM)
615 debug(
nullptr) <<
"VulkanMemoryAllocator: Block allocated ("
620 <<
"dedicated=" << (block->
dedicated ?
"true" :
"false") <<
")\n";
633 block->
handle = (
void *)device_memory;
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";
676 VkDeviceMemory *device_memory =
reinterpret_cast<VkDeviceMemory *
>(block->
handle);
677 if (device_memory ==
nullptr) {
678 error(user_context) <<
"VulkanBlockAllocator: Unable to deallocate block! Invalid device memory handle!\n";
682 vkFreeMemory(instance->device, *device_memory, instance->alloc_callbacks);
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;
702 vk_host_free(
nullptr, device_memory, instance->alloc_callbacks);
703 device_memory =
nullptr;
712 return block_byte_count;
715 uint32_t VulkanMemoryAllocator::select_memory_type(
void *user_context,
716 VkPhysicalDevice physical_device,
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;
777 if (required_flags) {
778 if (((required_flags >> i) & 1) == 0) {
785 if ((properties & need_flags) != need_flags) {
791 if ((properties & want_flags) != want_flags) {
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") <<
" "
847 uint32_t usage_flags = instance->select_memory_usage(user_context, region->
properties);
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"
867 <<
"vkCreateBuffer returned: " << vk_get_error_name(result) <<
"\n";
871 debug(
nullptr) <<
"vkCreateBuffer: Created buffer for device region (" << (
uint64_t)region->
size <<
" bytes) ...\n";
875 if (region_allocator ==
nullptr) {
876 error(user_context) <<
"VulkanBlockAllocator: Unable to allocate region! Invalid region allocator!\n";
880 BlockResource *block_resource = region_allocator->block_resource();
881 if (block_resource ==
nullptr) {
882 error(user_context) <<
"VulkanBlockAllocator: Unable to allocate region! Invalid block resource handle!\n";
886 VkDeviceMemory *device_memory =
reinterpret_cast<VkDeviceMemory *
>(block_resource->
memory.
handle);
887 if (device_memory ==
nullptr) {
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"
896 <<
"vkBindBufferMemory returned: " << vk_get_error_name(result) <<
"\n";
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";
945 VkBuffer *buffer =
reinterpret_cast<VkBuffer *
>(region->
handle);
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;
1028 void *vk_system_malloc(
void *user_context,
size_t size) {
1032 void vk_system_free(
void *user_context,
void *ptr) {
1039 return callbacks->
pfnAllocation(user_context, size, alignment, scope);
1041 return vk_system_malloc(user_context, size);
1047 return callbacks->
pfnFree(user_context, ptr);
1049 return vk_system_free(user_context, ptr);
1053 VulkanMemoryAllocator *vk_create_memory_allocator(
void *user_context,
1055 VkPhysicalDevice physical_device,
1068 const char *
alloc_config = vk_get_alloc_config_internal(user_context);
1072 if (alloc_config_values.
size() > 0) {
1073 config.maximum_pool_size =
atoi(alloc_config_values[0]) * 1024 * 1024;
1074 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.maximum_pool_size <<
" for maximum pool size (in bytes)\n";
1076 if (alloc_config_values.
size() > 1) {
1077 config.minimum_block_size =
atoi(alloc_config_values[1]) * 1024 * 1024;
1078 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.minimum_block_size <<
" for minimum block size (in bytes)\n";
1080 if (alloc_config_values.
size() > 2) {
1081 config.maximum_block_size =
atoi(alloc_config_values[2]) * 1024 * 1024;
1082 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.maximum_block_size <<
" for maximum block size (in bytes)\n";
1084 if (alloc_config_values.
size() > 3) {
1085 config.maximum_block_count =
atoi(alloc_config_values[3]);
1086 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.maximum_block_count <<
" for maximum block count\n";
1088 if (alloc_config_values.
size() > 4) {
1089 config.nearest_multiple =
atoi(alloc_config_values[4]);
1090 print(user_context) <<
"Vulkan: Configuring allocator with " << (
uint32_t)config.nearest_multiple <<
" for nearest multiple\n";
1095 config, device, physical_device,
1096 system_allocator, alloc_callbacks);
1099 int vk_destroy_memory_allocator(
void *user_context, VulkanMemoryAllocator *allocator) {
1100 if (allocator !=
nullptr) {
1102 allocator =
nullptr;
1109 int vk_clear_device_buffer(
void *user_context,
1110 VulkanMemoryAllocator *allocator,
1111 VkCommandPool command_pool,
1112 VkQueue command_queue,
1113 VkBuffer device_buffer) {
1115 #ifdef DEBUG_RUNTIME
1117 <<
" vk_clear_device_buffer (user_context: " << user_context <<
", "
1118 <<
"allocator: " << (
void *)allocator <<
", "
1119 <<
"command_pool: " << (
void *)command_pool <<
", "
1120 <<
"command_queue: " << (
void *)command_queue <<
", "
1121 <<
"device_buffer: " << (
void *)device_buffer <<
")\n";
1125 VkCommandBuffer command_buffer;
1126 int error_code = vk_create_command_buffer(user_context, allocator, command_pool, &command_buffer);
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";
1184 error_code = vk_destroy_command_buffer(user_context, allocator, command_pool, command_buffer);
1186 error(user_context) <<
"Vulkan: Failed to destroy command buffer!\n";
1223 #endif // HALIDE_RUNTIME_VULKAN_MEMORY_H