1#ifndef HALIDE_RUNTIME_VULKAN_INTERNAL_H
2#define HALIDE_RUNTIME_VULKAN_INTERNAL_H
25class VulkanMemoryAllocator;
26struct VulkanShaderBinding;
27struct VulkanCompiledShaderModule;
28struct VulkanCompilationCacheEntry;
37void *vk_host_malloc(
void *
user_context,
size_t size,
size_t alignment, VkSystemAllocationScope scope,
const VkAllocationCallbacks *callbacks =
nullptr);
38void vk_host_free(
void *
user_context,
void *ptr,
const VkAllocationCallbacks *callbacks =
nullptr);
40VulkanMemoryAllocator *vk_create_memory_allocator(
void *
user_context, VkDevice device, VkPhysicalDevice physical_device,
41 const VkAllocationCallbacks *alloc_callbacks);
47 VkQueue command_queue,
48 VkBuffer device_buffer);
58 VkPhysicalDevice *physical_device,
59 VkQueue *queue,
uint32_t *queue_family_index);
61int vk_destroy_context(
66 VkPhysicalDevice physical_device,
69int vk_find_compute_capability(
void *
user_context,
int *major,
int *minor);
71int vk_create_instance(
void *
user_context,
const StringTable &requested_layers, VkInstance *instance,
const VkAllocationCallbacks *alloc_callbacks);
72int vk_destroy_instance(
void *
user_context, VkInstance instance,
const VkAllocationCallbacks *alloc_callbacks);
75 VkInstance *instance, VkDevice *device,
76 VkPhysicalDevice *physical_device,
79int vk_create_device(
void *
user_context,
const StringTable &requested_layers, VkInstance *instance, VkDevice *device, VkQueue *queue,
80 VkPhysicalDevice *physical_device,
uint32_t *queue_family_index,
const VkAllocationCallbacks *alloc_callbacks);
91bool vk_validate_required_extension_support(
void *
user_context,
107struct ScopedVulkanCommandBufferAndPool;
109int vk_fill_command_buffer_with_dispatch_call(
void *
user_context,
112 VkPipeline compute_pipeline,
113 VkPipelineLayout pipeline_layout,
114 VkDescriptorSet descriptor_set,
116 int blocksX,
int blocksY,
int blocksZ);
126size_t vk_estimate_scalar_uniform_buffer_size(
void *
user_context,
133 size_t scalar_buffer_size);
149 VkDescriptorPool *descriptor_pool);
153 VkDescriptorPool descriptor_pool);
165 VkDescriptorSetLayout *layout);
169 VkDescriptorSetLayout descriptor_set_layout);
174 VkDescriptorSetLayout descriptor_set_layout,
175 VkDescriptorPool descriptor_pool,
176 VkDescriptorSet *descriptor_set);
180 VkBuffer *scalar_args_buffer,
181 size_t uniform_buffer_count,
182 size_t storage_buffer_count,
186 VkDescriptorSet descriptor_set);
192 VkDescriptorSetLayout *descriptor_set_layouts,
193 VkPipelineLayout *pipeline_layout);
197 VkPipelineLayout pipeline_layout);
201 const char *pipeline_name,
202 VkShaderModule shader_module,
203 VkPipelineLayout pipeline_layout,
204 VkSpecializationInfo *specialization_info,
205 VkPipeline *compute_pipeline);
209 VulkanShaderBinding *shader_bindings,
210 VkShaderModule shader_module,
211 VkPipelineLayout pipeline_layout,
212 VkPipeline *compute_pipeline);
216 VkPipeline compute_pipeline);
219VulkanCompilationCacheEntry *vk_compile_kernel_module(
void *
user_context, VulkanMemoryAllocator *
allocator,
220 const char *ptr,
int size);
226VulkanCompiledShaderModule *vk_compile_shader_module(
void *
user_context, VulkanMemoryAllocator *
allocator,
227 const char *src,
int size);
234 int d,
bool from_host,
bool to_host);
240VkResult vk_create_debug_utils_messenger(
void *
user_context, VkInstance instance, VulkanMemoryAllocator *
allocator, VkDebugUtilsMessengerEXT *messenger);
241void vk_destroy_debug_utils_messenger(
void *
user_context, VkInstance instance, VulkanMemoryAllocator *
allocator, VkDebugUtilsMessengerEXT messenger);
244const char *vk_get_error_name(VkResult error) {
249 return "VK_NOT_READY";
253 return "VK_EVENT_SET";
255 return "VK_EVENT_RESET";
257 return "VK_INCOMPLETE";
258 case VK_ERROR_OUT_OF_HOST_MEMORY:
259 return "VK_ERROR_OUT_OF_HOST_MEMORY";
260 case VK_ERROR_OUT_OF_DEVICE_MEMORY:
261 return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
262 case VK_ERROR_INITIALIZATION_FAILED:
263 return "VK_ERROR_INITIALIZATION_FAILED";
264 case VK_ERROR_DEVICE_LOST:
265 return "VK_ERROR_DEVICE_LOST";
266 case VK_ERROR_MEMORY_MAP_FAILED:
267 return "VK_ERROR_MEMORY_MAP_FAILED";
268 case VK_ERROR_LAYER_NOT_PRESENT:
269 return "VK_ERROR_LAYER_NOT_PRESENT";
270 case VK_ERROR_EXTENSION_NOT_PRESENT:
271 return "VK_ERROR_EXTENSION_NOT_PRESENT";
272 case VK_ERROR_FEATURE_NOT_PRESENT:
273 return "VK_ERROR_FEATURE_NOT_PRESENT";
274 case VK_ERROR_INCOMPATIBLE_DRIVER:
275 return "VK_ERROR_INCOMPATIBLE_DRIVER";
276 case VK_ERROR_TOO_MANY_OBJECTS:
277 return "VK_ERROR_TOO_MANY_OBJECTS";
278 case VK_ERROR_FORMAT_NOT_SUPPORTED:
279 return "VK_ERROR_FORMAT_NOT_SUPPORTED";
280 case VK_ERROR_FRAGMENTED_POOL:
281 return "VK_ERROR_FRAGMENTED_POOL";
282 case VK_ERROR_SURFACE_LOST_KHR:
283 return "VK_ERROR_SURFACE_LOST_KHR";
284 case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
285 return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
286 case VK_SUBOPTIMAL_KHR:
287 return "VK_SUBOPTIMAL_KHR";
288 case VK_ERROR_OUT_OF_DATE_KHR:
289 return "VK_ERROR_OUT_OF_DATE_KHR";
290 case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
291 return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
292 case VK_ERROR_VALIDATION_FAILED_EXT:
293 return "VK_ERROR_VALIDATION_FAILED_EXT";
294 case VK_ERROR_INVALID_SHADER_NV:
295 return "VK_ERROR_INVALID_SHADER_NV";
296 case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
297 return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR";
298 case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR:
299 return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR";
301 return "<Unknown Vulkan Result Code>";
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
unsigned __INT64_TYPE__ uint64_t
signed __INT64_TYPE__ int64_t
unsigned __INT32_TYPE__ uint32_t
signed __INT8_TYPE__ int8_t
VulkanMemoryAllocator * allocator
The raw representation of an image passed around by generated Halide code.
VkCommandPool command_pool
VkCommandBuffer command_buffer