1 #ifndef HALIDE_RUNTIME_VULKAN_INTERNAL_H
2 #define HALIDE_RUNTIME_VULKAN_INTERNAL_H
25 class VulkanMemoryAllocator;
26 struct VulkanShaderBinding;
27 struct VulkanCompilationCacheEntry;
39 VulkanMemoryAllocator *vk_create_memory_allocator(
void *user_context, VkDevice device, VkPhysicalDevice physical_device,
42 int vk_destroy_memory_allocator(
void *user_context, VulkanMemoryAllocator *allocator);
43 int vk_clear_device_buffer(
void *user_context,
44 VulkanMemoryAllocator *allocator,
45 VkCommandPool command_pool,
46 VkQueue command_queue,
47 VkBuffer device_buffer);
52 int vk_create_context(
54 VulkanMemoryAllocator **allocator,
57 VkPhysicalDevice *physical_device,
58 VkCommandPool *command_pool,
59 VkQueue *queue,
uint32_t *queue_family_index);
61 int vk_destroy_context(
63 VulkanMemoryAllocator *allocator,
66 VkPhysicalDevice physical_device,
67 VkCommandPool command_pool,
70 int vk_find_compute_capability(
void *user_context,
int *major,
int *minor);
73 int vk_destroy_instance(
void *user_context, VkInstance instance,
const VkAllocationCallbacks *alloc_callbacks);
75 int vk_select_device_for_context(
void *user_context,
76 VkInstance *instance, VkDevice *device,
77 VkPhysicalDevice *physical_device,
80 int vk_create_device(
void *user_context,
const StringTable &requested_layers, VkInstance *instance, VkDevice *device, VkQueue *queue,
91 uint32_t vk_get_supported_device_extensions(
void *user_context, VkPhysicalDevice physical_device,
StringTable &ext_table);
92 bool vk_validate_required_extension_support(
void *user_context,
101 int vk_create_command_pool(
void *user_context, VulkanMemoryAllocator *allocator,
uint32_t queue_index, VkCommandPool *command_pool);
102 int vk_destroy_command_pool(
void *user_context, VulkanMemoryAllocator *allocator, VkCommandPool command_pool);
105 const VkCommandPool VkInvalidCommandPool(
uint64_t(-1));
108 int vk_create_command_buffer(
void *user_context, VulkanMemoryAllocator *allocator, VkCommandPool pool, VkCommandBuffer *command_buffer);
109 int vk_destroy_command_buffer(
void *user_context, VulkanMemoryAllocator *allocator, VkCommandPool command_pool, VkCommandBuffer command_buffer);
111 int vk_fill_command_buffer_with_dispatch_call(
void *user_context,
113 VkCommandBuffer command_buffer,
114 VkPipeline compute_pipeline,
116 VkDescriptorSet descriptor_set,
118 int blocksX,
int blocksY,
int blocksZ);
120 int vk_submit_command_buffer(
void *user_context, VkQueue queue, VkCommandBuffer command_buffer);
123 bool vk_needs_scalar_uniform_buffer(
void *user_context,
128 size_t vk_estimate_scalar_uniform_buffer_size(
void *user_context,
133 MemoryRegion *vk_create_scalar_uniform_buffer(
void *user_context,
134 VulkanMemoryAllocator *allocator,
135 size_t scalar_buffer_size);
137 int vk_update_scalar_uniform_buffer(
void *user_context,
138 VulkanMemoryAllocator *allocator,
144 int vk_destroy_scalar_uniform_buffer(
void *user_context, VulkanMemoryAllocator *allocator,
147 int vk_create_descriptor_pool(
void *user_context,
148 VulkanMemoryAllocator *allocator,
151 VkDescriptorPool *descriptor_pool);
153 int vk_destroy_descriptor_pool(
void *user_context,
154 VulkanMemoryAllocator *allocator,
155 VkDescriptorPool descriptor_pool);
158 uint32_t vk_count_bindings_for_descriptor_set(
void *user_context,
163 int vk_create_descriptor_set_layout(
void *user_context,
164 VulkanMemoryAllocator *allocator,
167 VkDescriptorSetLayout *layout);
169 int vk_destroy_descriptor_set_layout(
void *user_context,
170 VulkanMemoryAllocator *allocator,
171 VkDescriptorSetLayout descriptor_set_layout);
174 int vk_create_descriptor_set(
void *user_context,
175 VulkanMemoryAllocator *allocator,
176 VkDescriptorSetLayout descriptor_set_layout,
177 VkDescriptorPool descriptor_pool,
178 VkDescriptorSet *descriptor_set);
180 int vk_update_descriptor_set(
void *user_context,
181 VulkanMemoryAllocator *allocator,
182 VkBuffer *scalar_args_buffer,
183 size_t uniform_buffer_count,
184 size_t storage_buffer_count,
188 VkDescriptorSet descriptor_set);
191 int vk_create_pipeline_layout(
void *user_context,
192 VulkanMemoryAllocator *allocator,
197 int vk_destroy_pipeline_layout(
void *user_context,
198 VulkanMemoryAllocator *allocator,
201 int vk_create_compute_pipeline(
void *user_context,
202 VulkanMemoryAllocator *allocator,
203 const char *pipeline_name,
207 VkPipeline *compute_pipeline);
209 int vk_setup_compute_pipeline(
void *user_context,
210 VulkanMemoryAllocator *allocator,
214 VkPipeline *compute_pipeline);
216 int vk_destroy_compute_pipeline(
void *user_context,
217 VulkanMemoryAllocator *allocator,
218 VkPipeline compute_pipeline);
221 VulkanShaderBinding *vk_decode_shader_bindings(
void *user_context, VulkanMemoryAllocator *allocator,
224 VulkanCompilationCacheEntry *vk_compile_shader_module(
void *user_context, VulkanMemoryAllocator *allocator,
225 const char *src,
int size);
227 int vk_destroy_shader_modules(
void *user_context, VulkanMemoryAllocator *allocator);
230 int vk_do_multidimensional_copy(
void *user_context, VkCommandBuffer command_buffer,
232 int d,
bool from_host,
bool to_host);
239 const char *vk_get_error_name(
VkResult error) {
244 return "VK_NOT_READY";
248 return "VK_EVENT_SET";
250 return "VK_EVENT_RESET";
252 return "VK_INCOMPLETE";
254 return "VK_ERROR_OUT_OF_HOST_MEMORY";
256 return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
258 return "VK_ERROR_INITIALIZATION_FAILED";
260 return "VK_ERROR_DEVICE_LOST";
262 return "VK_ERROR_MEMORY_MAP_FAILED";
264 return "VK_ERROR_LAYER_NOT_PRESENT";
266 return "VK_ERROR_EXTENSION_NOT_PRESENT";
268 return "VK_ERROR_FEATURE_NOT_PRESENT";
270 return "VK_ERROR_INCOMPATIBLE_DRIVER";
272 return "VK_ERROR_TOO_MANY_OBJECTS";
274 return "VK_ERROR_FORMAT_NOT_SUPPORTED";
276 return "VK_ERROR_FRAGMENTED_POOL";
278 return "VK_ERROR_SURFACE_LOST_KHR";
280 return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
282 return "VK_SUBOPTIMAL_KHR";
284 return "VK_ERROR_OUT_OF_DATE_KHR";
286 return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
288 return "VK_ERROR_VALIDATION_FAILED_EXT";
290 return "VK_ERROR_INVALID_SHADER_NV";
292 return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR";
294 return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR";
296 return "<Unknown Vulkan Result Code>";
@ VK_ERROR_VALIDATION_FAILED_EXT
@ VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR
@ VK_ERROR_INVALID_SHADER_NV
@ VK_ERROR_EXTENSION_NOT_PRESENT
@ VK_ERROR_OUT_OF_POOL_MEMORY_KHR
@ VK_ERROR_OUT_OF_HOST_MEMORY
@ VK_ERROR_INITIALIZATION_FAILED
@ VK_ERROR_INCOMPATIBLE_DISPLAY_KHR
@ VK_ERROR_OUT_OF_DEVICE_MEMORY
@ VK_ERROR_NATIVE_WINDOW_IN_USE_KHR
@ VK_ERROR_OUT_OF_DATE_KHR
@ VK_ERROR_FORMAT_NOT_SUPPORTED
@ VK_ERROR_FRAGMENTED_POOL
@ VK_ERROR_SURFACE_LOST_KHR
@ VK_ERROR_FEATURE_NOT_PRESENT
@ VK_ERROR_TOO_MANY_OBJECTS
@ VK_ERROR_MEMORY_MAP_FAILED
@ VK_ERROR_LAYER_NOT_PRESENT
@ VK_ERROR_INCOMPATIBLE_DRIVER
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
VkDescriptorSetLayout * descriptor_set_layouts
VulkanShaderBinding * shader_bindings
VkPipelineLayout pipeline_layout
VkShaderModule shader_module
The raw representation of an image passed around by generated Halide code.