1#ifndef HALIDE_RUNTIME_VULKAN_INTERFACE_H
2#define HALIDE_RUNTIME_VULKAN_INTERFACE_H
12#define HL_VK_ENV_DELIM ";"
14#define HL_VK_ENV_DELIM ":"
18#define VK_NO_PROTOTYPES
20#include <vulkan/vulkan.h>
50 const char *env_libname =
getenv(
"HL_VK_LOADER_LIB");
63 const char *lib_names[] = {
71 "/usr/local/lib/libvulkan.dylib",
73 "vulkan.framework/vulkan",
74 "MoltenVK.framework/MoltenVK"
77 for (
auto &lib_name : lib_names) {
90 <<
"(Try setting the env var HL_VK_LOADER_LIB to an explicit path to fix this.)\n";
99#define VULKAN_FN(fn) WEAK PFN_##fn fn = nullptr;
100#define HL_USE_VULKAN_LOADER_FNS
101#define HL_USE_VULKAN_INSTANCE_FNS
102#define HL_USE_VULKAN_DEVICE_FNS
104#undef HL_USE_VULKAN_DEVICE_FNS
105#undef HL_USE_VULKAN_INSTANCE_FNS
106#undef HL_USE_VULKAN_LOADER_FNS
112#define VULKAN_FN(fn) fn = (PFN_##fn)halide_vulkan_get_symbol(user_context, #fn);
113#define HL_USE_VULKAN_LOADER_FNS
115#undef HL_USE_VULKAN_LOADER_FNS
122#define VULKAN_FN(fn) fn = (PFN_##fn)vkGetInstanceProcAddr(instance, #fn);
123#define HL_USE_VULKAN_INSTANCE_FNS
125#undef HL_USE_VULKAN_INSTANCE_FNS
131#define VULKAN_FN(fn) fn = (PFN_##fn)(nullptr);
132#define HL_USE_VULKAN_INSTANCE_FNS
134#undef HL_USE_VULKAN_INSTANCE_FNS
141#define VULKAN_FN(fn) fn = (PFN_##fn)vkGetDeviceProcAddr(device, #fn);
142#define HL_USE_VULKAN_DEVICE_FNS
144#undef HL_USE_VULKAN_DEVICE_FNS
150#define VULKAN_FN(fn) fn = (PFN_##fn)(nullptr);
151#define HL_USE_VULKAN_DEVICE_FNS
153#undef HL_USE_VULKAN_DEVICE_FNS
#define debug(n)
For optional debugging during codegen, use the debug macro as follows:
void * halide_get_library_symbol(void *lib, const char *name)
void * halide_load_library(const char *name)
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)
void WEAK vk_load_vulkan_loader_functions(void *user_context)
void WEAK vk_load_vulkan_device_functions(void *user_context, VkDevice device)
void WEAK vk_load_vulkan_instance_functions(void *user_context, VkInstance instance)
WEAK halide_device_interface_t vulkan_device_interface
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Expr print(const std::vector< Expr > &values)
Create an Expr that prints out its value whenever it is evaluated.
char * getenv(const char *)
Each GPU API provides a halide_device_interface_t struct pointing to the code that manages device all...