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);
92bool vk_validate_required_extension_support(
void *
user_context,
108struct ScopedVulkanCommandBufferAndPool;
110int vk_fill_command_buffer_with_dispatch_call(
void *
user_context,
113 VkPipeline compute_pipeline,
114 VkPipelineLayout pipeline_layout,
115 VkDescriptorSet descriptor_set,
117 int blocksX,
int blocksY,
int blocksZ);
127size_t vk_estimate_scalar_uniform_buffer_size(
void *
user_context,
134 size_t scalar_buffer_size);
150 VkDescriptorPool *descriptor_pool);
154 VkDescriptorPool descriptor_pool);
166 VkDescriptorSetLayout *layout);
170 VkDescriptorSetLayout descriptor_set_layout);
175 VkDescriptorSetLayout descriptor_set_layout,
176 VkDescriptorPool descriptor_pool,
177 VkDescriptorSet *descriptor_set);
181 VkBuffer *scalar_args_buffer,
182 size_t uniform_buffer_count,
183 size_t storage_buffer_count,
187 VkDescriptorSet descriptor_set);
193 VkDescriptorSetLayout *descriptor_set_layouts,
194 VkPipelineLayout *pipeline_layout);
198 VkPipelineLayout pipeline_layout);
202 const char *pipeline_name,
203 VkShaderModule shader_module,
204 VkPipelineLayout pipeline_layout,
205 VkSpecializationInfo *specialization_info,
206 VkPipeline *compute_pipeline);
210 VulkanShaderBinding *shader_bindings,
211 VkShaderModule shader_module,
212 VkPipelineLayout pipeline_layout,
213 VkPipeline *compute_pipeline);
217 VkPipeline compute_pipeline);
220VulkanCompilationCacheEntry *vk_compile_kernel_module(
void *
user_context, VulkanMemoryAllocator *
allocator,
221 const char *ptr,
int size);
227VulkanCompiledShaderModule *vk_compile_shader_module(
void *
user_context, VulkanMemoryAllocator *
allocator,
228 const char *src,
int size);
235 int d,
bool from_host,
bool to_host);
241VkResult vk_create_debug_utils_messenger(
void *
user_context, VkInstance instance, VulkanMemoryAllocator *
allocator, VkDebugUtilsMessengerEXT *messenger);
242void vk_destroy_debug_utils_messenger(
void *
user_context, VkInstance instance, VulkanMemoryAllocator *
allocator, VkDebugUtilsMessengerEXT messenger);
245const char *vk_get_error_name(VkResult error) {
250 return "VK_NOT_READY";
254 return "VK_EVENT_SET";
256 return "VK_EVENT_RESET";
258 return "VK_INCOMPLETE";
259 case VK_ERROR_OUT_OF_HOST_MEMORY:
260 return "VK_ERROR_OUT_OF_HOST_MEMORY";
261 case VK_ERROR_OUT_OF_DEVICE_MEMORY:
262 return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
263 case VK_ERROR_INITIALIZATION_FAILED:
264 return "VK_ERROR_INITIALIZATION_FAILED";
265 case VK_ERROR_DEVICE_LOST:
266 return "VK_ERROR_DEVICE_LOST";
267 case VK_ERROR_MEMORY_MAP_FAILED:
268 return "VK_ERROR_MEMORY_MAP_FAILED";
269 case VK_ERROR_LAYER_NOT_PRESENT:
270 return "VK_ERROR_LAYER_NOT_PRESENT";
271 case VK_ERROR_EXTENSION_NOT_PRESENT:
272 return "VK_ERROR_EXTENSION_NOT_PRESENT";
273 case VK_ERROR_FEATURE_NOT_PRESENT:
274 return "VK_ERROR_FEATURE_NOT_PRESENT";
275 case VK_ERROR_INCOMPATIBLE_DRIVER:
276 return "VK_ERROR_INCOMPATIBLE_DRIVER";
277 case VK_ERROR_TOO_MANY_OBJECTS:
278 return "VK_ERROR_TOO_MANY_OBJECTS";
279 case VK_ERROR_FORMAT_NOT_SUPPORTED:
280 return "VK_ERROR_FORMAT_NOT_SUPPORTED";
281 case VK_ERROR_FRAGMENTED_POOL:
282 return "VK_ERROR_FRAGMENTED_POOL";
283 case VK_ERROR_SURFACE_LOST_KHR:
284 return "VK_ERROR_SURFACE_LOST_KHR";
285 case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
286 return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
287 case VK_SUBOPTIMAL_KHR:
288 return "VK_SUBOPTIMAL_KHR";
289 case VK_ERROR_OUT_OF_DATE_KHR:
290 return "VK_ERROR_OUT_OF_DATE_KHR";
291 case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
292 return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
293 case VK_ERROR_VALIDATION_FAILED_EXT:
294 return "VK_ERROR_VALIDATION_FAILED_EXT";
295 case VK_ERROR_INVALID_SHADER_NV:
296 return "VK_ERROR_INVALID_SHADER_NV";
297 case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
298 return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR";
299 case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR:
300 return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR";
302 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