1#ifndef HALIDE_RUNTIME_VULKAN_CONTEXT_H
2#define HALIDE_RUNTIME_VULKAN_CONTEXT_H
105 debug(
user_context) <<
" no valid vulkan loader library was found ...\n";
118 debug(
user_context) <<
" no valid vulkan runtime was found ...\n";
125 debug(
user_context) <<
" no valid vulkan device was found ...\n";
131 debug(
user_context) <<
" querying for device properties ...\n";
206 error(
user_context) <<
"Vulkan: Failed to resolve instance API methods to create device!\n";
214 debug(
user_context) <<
" vk_destroy_instance (user_context: " <<
user_context <<
", device: " << (
void *)instance <<
", alloc_callbacks: " << (
void *)alloc_callbacks <<
")\n";
245 debug(
user_context) <<
"Vulkan: Out of system memory!\n";
262 debug(
user_context) <<
"Vulkan: Checking device #" <<
i <<
"='" << properties.deviceName <<
"'\n";
307 debug(
user_context) <<
"Vulkan: Found matching compute device '" << properties.deviceName <<
"'\n";
318 debug(
user_context) <<
"Vulkan: Defaulting to first compute device '" << properties.deviceName <<
"'\n";
330 debug(
user_context) <<
" checking for required device extensions ...\n";
334 debug(
user_context) <<
" checking for optional device extensions ...\n";
338 debug(
user_context) <<
" validating supported device extensions ...\n";
344 debug(
user_context) <<
"Vulkan: Unable to validate required extension support!\n";
374 debug(
user_context) <<
" querying for device properties ...\n";
387 debug(
user_context) <<
" querying for device features...\n";
421 debug(
user_context) <<
" querying for extended device features...\n";
426 debug(
user_context) <<
" storage buffer 8bit access support: " << (
storage_8bit_ext.storageBuffer8BitAccess ?
"true" :
"false") <<
"...\n";
427 debug(
user_context) <<
" storage buffer 16bit access support: " << (
storage_16bit_ext.storageBuffer16BitAccess ?
"true" :
"false") <<
"...\n";
453 error(
user_context) <<
"Vulkan: Failed to resolve device API methods for driver!\n";
462 debug(
user_context) <<
" vk_destroy_device (user_context: " <<
user_context <<
", device: " << (
void *)device <<
", alloc_callbacks: " << (
void *)alloc_callbacks <<
")\n";
478 error(
user_context) <<
"Vulkan: Failed to resolve loader library methods to create instance!\n";
493 error(
user_context) <<
"Vulkan: Failed to create instance for context!\n";
499 error(
user_context) <<
"Vulkan: Failed to select device for context!\n";
505 error(
user_context) <<
"Vulkan: Failed to create device for context!\n";
511 error(
user_context) <<
"Vulkan: Failed to create memory allocator for device!\n";
526 <<
"vk_destroy_context (user_context: " <<
user_context <<
")\n";
592 if (func !=
nullptr) {
593 debug(
user_context) <<
"Vulkan: Registering Debug Utils Messenger ... \n";
603 debug(
user_context) <<
"Vulkan: Debug Utils Messenger extension unavailable!\n";
610 if (func !=
nullptr) {
611 debug(
user_context) <<
"Vulkan: Destroying Debug Utils Messenger ...\n";
#define HALIDE_VERSION_MINOR
#define HALIDE_VERSION_PATCH
#define HALIDE_VERSION_MAJOR
int halide_error_no_device_interface(void *user_context)
halide_error_code_t
The error codes that may be returned by a Halide pipeline.
@ halide_error_code_symbol_not_found
A runtime symbol could not be loaded.
@ halide_error_code_device_interface_no_device
Buffer has a non-null device_interface but device is 0, which violates a Halide invariant.
@ halide_error_code_generic_error
An uncategorized error occurred.
@ halide_error_code_success
There was no error.
@ halide_error_code_out_of_memory
A call to halide_malloc returned NULL.
#define HALIDE_ALWAYS_INLINE
int halide_vulkan_acquire_context(void *user_context, struct halide_vulkan_memory_allocator **allocator, VkInstance *instance, VkDevice *device, VkPhysicalDevice *physical_device, VkQueue *queue, uint32_t *queue_family_index, VkDebugUtilsMessengerEXT *messenger, bool create=true)
const struct VkAllocationCallbacks * halide_vulkan_get_allocation_callbacks(void *user_context)
int halide_vulkan_release_context(void *user_context, VkInstance instance, VkDevice device, VkQueue queue, VkDebugUtilsMessengerEXT messenger)
const char * halide_vulkan_get_device_type(void *user_context)
VulkanMemoryAllocator * allocator
uint32_t queue_family_index
HALIDE_ALWAYS_INLINE VulkanContext(void *user_context)
HALIDE_ALWAYS_INLINE const VkAllocationCallbacks * allocation_callbacks()
VkDebugUtilsMessengerEXT messenger
VkPhysicalDevice physical_device
HALIDE_ALWAYS_INLINE ~VulkanContext()
halide_error_code_t error
Vulkan Memory Allocator class interface for managing large memory requests stored as contiguous block...
const VkAllocationCallbacks * callbacks() const
WEAK void * halide_vulkan_get_symbol(void *user_context, const char *name)
void WEAK vk_unload_vulkan_device_functions(void *user_context)
void WEAK vk_unload_vulkan_instance_functions(void *user_context)
WEAK halide_mutex thread_lock
VkQueue WEAK cached_queue
void WEAK vk_load_vulkan_loader_functions(void *user_context)
VkDebugUtilsMessengerEXT WEAK cached_messenger
void WEAK vk_load_vulkan_device_functions(void *user_context, VkDevice device)
VkInstance WEAK cached_instance
uint32_t WEAK cached_queue_family_index
VkPhysicalDevice WEAK cached_physical_device
void WEAK vk_load_vulkan_instance_functions(void *user_context, VkInstance instance)
halide_vulkan_memory_allocator *WEAK cached_allocator
VkDevice WEAK cached_device
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.
Expr print(const std::vector< Expr > &values)
Create an Expr that prints out its value whenever it is evaluated.
#define halide_debug_assert(user_context, cond)
halide_debug_assert() is like halide_assert(), but only expands into a check when DEBUG_RUNTIME is de...
unsigned __INT32_TYPE__ uint32_t
#define halide_abort_if_false(user_context, cond)
const char * strstr(const char *, const char *)
bool contains(int32_t x) const
Test if the interval contains a particular value.
VulkanMemoryAllocator * allocator