Halide 16.0.0
Halide compiler and libraries
vulkan_context.h
Go to the documentation of this file.
1#ifndef HALIDE_RUNTIME_VULKAN_CONTEXT_H
2#define HALIDE_RUNTIME_VULKAN_CONTEXT_H
3
4#include "printer.h"
5#include "runtime_internal.h"
6#include "scoped_spin_lock.h"
7
8#include "vulkan_extensions.h"
9#include "vulkan_internal.h"
10#include "vulkan_memory.h"
11
12// --------------------------------------------------------------------------
13
14namespace Halide {
15namespace Runtime {
16namespace Internal {
17namespace Vulkan {
18
19// --------------------------------------------------------------------------
20
21// Vulkan Memory allocator for host-device allocations
22halide_vulkan_memory_allocator *WEAK cached_allocator = nullptr;
23
24// Cached instance related handles for device resources
25VkInstance WEAK cached_instance = nullptr;
26VkDevice WEAK cached_device = nullptr;
27VkCommandPool WEAK cached_command_pool = 0;
28VkQueue WEAK cached_queue = nullptr;
29VkPhysicalDevice WEAK cached_physical_device = nullptr;
31
32// A Vulkan context/queue/synchronization lock defined in this module with weak linkage
34
35// --------------------------------------------------------------------------
36
37// Helper object to acquire and release the Vulkan context.
39 void *user_context;
40
41public:
43 VkInstance instance;
44 VkDevice device;
45 VkCommandPool command_pool;
46 VkPhysicalDevice physical_device;
47 VkQueue queue;
48 uint32_t queue_family_index; // used for operations requiring queue family
50
52 : user_context(user_context),
53 allocator(nullptr),
54 instance(nullptr),
55 device(nullptr),
56 command_pool(0),
57 physical_device(nullptr),
58 queue(nullptr),
61
62 int result = halide_vulkan_acquire_context(user_context,
63 reinterpret_cast<halide_vulkan_memory_allocator **>(&allocator),
65 if (result != halide_error_code_success) {
68 }
69 halide_debug_assert(user_context, allocator != nullptr);
70 halide_debug_assert(user_context, instance != nullptr);
71 halide_debug_assert(user_context, device != nullptr);
72 halide_debug_assert(user_context, command_pool != 0);
73 halide_debug_assert(user_context, queue != nullptr);
74 halide_debug_assert(user_context, physical_device != nullptr);
75 }
76
79 }
80
81 // For now, this is always nullptr
83 return nullptr;
84 }
85};
86
87// --------------------------------------------------------------------------
88
89namespace {
90
91int vk_find_compute_capability(void *user_context, int *major, int *minor) {
92 debug(user_context) << " vk_find_compute_capability (user_context: " << user_context << ")\n";
93
94 VkInstance instance = nullptr;
95 VkDevice device = nullptr;
96 VkPhysicalDevice physical_device = nullptr;
97 uint32_t queue_family_index = 0;
98
99 StringTable requested_layers;
100 vk_get_requested_layers(user_context, requested_layers);
101
102 const VkAllocationCallbacks *alloc_callbacks = halide_vulkan_get_allocation_callbacks(user_context);
103 int status = vk_create_instance(user_context, requested_layers, &instance, alloc_callbacks);
104 if (status != halide_error_code_success) {
105 debug(user_context) << " no valid vulkan runtime was found ...\n";
106 *major = 0;
107 *minor = 0;
108 return 0;
109 }
110
111 if (vkCreateDevice == nullptr) {
112 vk_load_vulkan_functions(instance);
113 }
114
115 status = vk_select_device_for_context(user_context, &instance, &device, &physical_device, &queue_family_index);
116 if (status != halide_error_code_success) {
117 debug(user_context) << " no valid vulkan device was found ...\n";
118 *major = 0;
119 *minor = 0;
120 return 0;
121 }
122
123 VkPhysicalDeviceProperties device_properties = {0};
124 debug(user_context) << " querying for device properties ...\n";
125 vkGetPhysicalDeviceProperties(physical_device, &device_properties);
126 *major = VK_API_VERSION_MAJOR(device_properties.apiVersion);
127 *minor = VK_API_VERSION_MINOR(device_properties.apiVersion);
128 debug(user_context) << " found device compute capability v" << *major << "." << *minor << " ...\n";
129
130 vk_destroy_instance(user_context, instance, alloc_callbacks);
131 return 0;
132}
133
134// Initializes the instance (used by the default vk_create_context)
135int vk_create_instance(void *user_context, const StringTable &requested_layers, VkInstance *instance, const VkAllocationCallbacks *alloc_callbacks) {
136 debug(user_context) << " vk_create_instance (user_context: " << user_context << ")\n";
137
138 StringTable required_instance_extensions;
139 vk_get_required_instance_extensions(user_context, required_instance_extensions);
140
141 StringTable supported_instance_extensions;
142 vk_get_supported_instance_extensions(user_context, supported_instance_extensions);
143
144 bool valid_instance = vk_validate_required_extension_support(user_context, required_instance_extensions, supported_instance_extensions);
145 halide_abort_if_false(user_context, valid_instance);
146
147 debug(user_context) << " found " << (uint32_t)required_instance_extensions.size() << " required extensions for instance!\n";
148 for (int n = 0; n < (int)required_instance_extensions.size(); ++n) {
149 debug(user_context) << " extension: " << required_instance_extensions[n] << "\n";
150 }
151
152 // If we're running under Molten VK, we must enable the portability extension and create flags
153 // to allow non-physical devices that are emulated to appear in the device list.
154 uint32_t create_flags = 0;
155 if (supported_instance_extensions.contains("VK_KHR_portability_enumeration") &&
156 supported_instance_extensions.contains("VK_MVK_macos_surface")) {
158 required_instance_extensions.append(user_context, "VK_KHR_portability_enumeration");
159 }
160
161 VkApplicationInfo app_info = {
163 nullptr, // Next
164 "Runtime", // application name
165 VK_MAKE_API_VERSION(0, 1, 0, 0), // app version
166 "Halide", // engine name
167 VK_MAKE_API_VERSION(0, HALIDE_VERSION_MAJOR, HALIDE_VERSION_MINOR, HALIDE_VERSION_PATCH), // engine version
168 VK_API_VERSION_1_3}; // FIXME: only use the minimum capability necessary
169
170 VkInstanceCreateInfo create_info = {
172 nullptr, // Next
173 create_flags, // Flags
174 &app_info, // ApplicationInfo
175 (uint32_t)requested_layers.size(), requested_layers.data(), // Layers
176 (uint32_t)required_instance_extensions.size(), required_instance_extensions.data() // Extensions
177 };
178
179 VkResult result = vkCreateInstance(&create_info, alloc_callbacks, instance);
180 if (result != VK_SUCCESS) {
181 debug(user_context) << "Vulkan: vkCreateInstance failed with return code: " << vk_get_error_name(result) << "\n";
183 }
184
186}
187
188int vk_destroy_instance(void *user_context, VkInstance instance, const VkAllocationCallbacks *alloc_callbacks) {
189 debug(user_context) << " vk_destroy_instance (user_context: " << user_context << ")\n";
190 vkDestroyInstance(instance, alloc_callbacks);
192}
193
194int vk_select_device_for_context(void *user_context,
195 VkInstance *instance, VkDevice *device,
196 VkPhysicalDevice *physical_device,
197 uint32_t *queue_family_index) {
198 // query for the number of physical devices available in this instance
199 uint32_t device_count = 0;
200 VkResult result = vkEnumeratePhysicalDevices(*instance, &device_count, nullptr);
201 if ((result != VK_SUCCESS) && (result != VK_INCOMPLETE)) {
202 debug(user_context) << "Vulkan: vkEnumeratePhysicalDevices failed with return code: " << vk_get_error_name(result) << "\n";
204 }
205 if (device_count == 0) {
206 debug(user_context) << "Vulkan: No devices found.\n";
208 }
209
210 // allocate enough storage for the physical device query results
211 BlockStorage::Config device_query_storage_config;
212 device_query_storage_config.entry_size = sizeof(VkPhysicalDevice);
213 BlockStorage device_query_storage(user_context, device_query_storage_config);
214 device_query_storage.resize(user_context, device_count);
215
216 VkPhysicalDevice chosen_device = nullptr;
217 VkPhysicalDevice *avail_devices = (VkPhysicalDevice *)(device_query_storage.data());
218 if (avail_devices == nullptr) {
219 debug(user_context) << "Vulkan: Out of system memory!\n";
221 }
222 result = vkEnumeratePhysicalDevices(*instance, &device_count, avail_devices);
223 if ((result != VK_SUCCESS) && (result != VK_INCOMPLETE)) {
224 debug(user_context) << "Vulkan: vkEnumeratePhysicalDevices failed with return code: " << vk_get_error_name(result) << "\n";
226 }
227
228 // get the configurable device type to search for (e.g. 'cpu', 'gpu', 'integrated-gpu', 'discrete-gpu', ...)
229 const char *dev_type = halide_vulkan_get_device_type(user_context);
230
231 // try to find a matching device that supports compute.
232 uint32_t queue_family = 0;
233 for (uint32_t i = 0; (chosen_device == nullptr) && (i < device_count); i++) {
235 vkGetPhysicalDeviceProperties(avail_devices[i], &properties);
236 debug(user_context) << "Vulkan: Checking device #" << i << "='" << properties.deviceName << "'\n";
237
238 int matching_device = 0;
239 if ((dev_type != nullptr) && (*dev_type != '\0')) {
240 if (strstr(dev_type, "cpu") && (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU)) {
241 matching_device = 1;
242 } else if (strstr(dev_type, "integrated-gpu") && ((properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU))) {
243 matching_device = 1;
244 } else if (strstr(dev_type, "discrete-gpu") && ((properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU))) {
245 matching_device = 1;
246 } else if (strstr(dev_type, "virtual-gpu") && (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU)) {
247 matching_device = 1;
248 } else if (strstr(dev_type, "gpu") && ((properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) || (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU))) {
249 matching_device = 1;
250 }
251 } else {
252 // use a non-virtual gpu device by default
255 matching_device = 1;
256 }
257 }
258
259 if (matching_device) {
260 // get the number of supported queues for this physical device
261 uint32_t queue_properties_count = 0;
262 vkGetPhysicalDeviceQueueFamilyProperties(avail_devices[i], &queue_properties_count, nullptr);
263 if (queue_properties_count < 1) {
264 continue;
265 }
266
267 // allocate enough storage for the queue properties query results
268 BlockStorage::Config queue_properties_storage_config;
269 queue_properties_storage_config.entry_size = sizeof(VkPhysicalDevice);
270 BlockStorage queue_properties_storage(user_context, queue_properties_storage_config);
271 queue_properties_storage.resize(user_context, queue_properties_count);
272
273 VkQueueFamilyProperties *queue_properties = (VkQueueFamilyProperties *)(queue_properties_storage.data());
274 vkGetPhysicalDeviceQueueFamilyProperties(avail_devices[i], &queue_properties_count, queue_properties);
275 for (uint32_t j = 0; (chosen_device == nullptr) && (j < queue_properties_count); j++) {
276 if (queue_properties[j].queueCount > 0 &&
277 queue_properties[j].queueFlags & VK_QUEUE_COMPUTE_BIT) {
278 chosen_device = avail_devices[i];
279 queue_family = j;
280
281 debug(user_context) << "Vulkan: Found matching compute device '" << properties.deviceName << "'\n";
282 }
283 }
284 }
285 }
286 // If nothing, just try the first one for now.
287 if (chosen_device == nullptr) {
288 queue_family = 0;
289 chosen_device = avail_devices[0];
291 vkGetPhysicalDeviceProperties(chosen_device, &properties);
292 debug(user_context) << "Vulkan: Defaulting to first compute device '" << properties.deviceName << "'\n";
293 }
294
295 *queue_family_index = queue_family;
296 *physical_device = chosen_device;
298}
299
300int vk_create_device(void *user_context, const StringTable &requested_layers, VkInstance *instance, VkDevice *device, VkQueue *queue,
301 VkPhysicalDevice *physical_device, uint32_t *queue_family_index, const VkAllocationCallbacks *alloc_callbacks) {
302 debug(user_context) << " vk_create_device (user_context=" << user_context << ")\n";
303
304 debug(user_context) << " checking for required device extensions ...\n";
305 StringTable required_device_extensions;
306 vk_get_required_device_extensions(user_context, required_device_extensions);
307
308 debug(user_context) << " checking for optional device extensions ...\n";
309 StringTable optional_device_extensions;
310 vk_get_optional_device_extensions(user_context, optional_device_extensions);
311
312 debug(user_context) << " validating supported device extensions ...\n";
313 StringTable supported_device_extensions;
314 vk_get_supported_device_extensions(user_context, *physical_device, supported_device_extensions);
315
316 bool valid_device = vk_validate_required_extension_support(user_context, required_device_extensions, supported_device_extensions);
317 if (!valid_device) {
318 debug(user_context) << "Vulkan: Unable to validate required extension support!\n";
320 }
321
322 debug(user_context) << " found " << (uint32_t)required_device_extensions.size() << " required extensions for device!\n";
323 for (int n = 0; n < (int)required_device_extensions.size(); ++n) {
324 debug(user_context) << " required extension: " << required_device_extensions[n] << "\n";
325 }
326
327 // enable all available optional extensions
328 debug(user_context) << " checking for " << (uint32_t)optional_device_extensions.size() << " optional extensions for device ...\n";
329 for (int n = 0; n < (int)optional_device_extensions.size(); ++n) {
330 if (supported_device_extensions.contains(optional_device_extensions[n])) {
331 debug(user_context) << " optional extension: " << optional_device_extensions[n] << "\n";
332 required_device_extensions.append(user_context, optional_device_extensions[n]);
333 }
334 }
335
336 float queue_priority = 1.0f;
337 VkDeviceQueueCreateInfo device_queue_create_info = {
339 nullptr, // Next
340 0, // Flags
341 *queue_family_index,
342 1,
343 &queue_priority,
344 };
345
346 // Get the API version to determine what device features are valid to search for
347 VkPhysicalDeviceProperties device_properties = {0};
348 debug(user_context) << " querying for device properties ...\n";
349 vkGetPhysicalDeviceProperties(*physical_device, &device_properties);
350 uint32_t major_version = VK_API_VERSION_MAJOR(device_properties.apiVersion);
351 uint32_t minor_version = VK_API_VERSION_MINOR(device_properties.apiVersion);
352 bool has_capability_v11 = (major_version >= 1) && (minor_version >= 1); // supports >= v1.1
353 bool has_capability_v12 = (major_version >= 1) && (minor_version >= 2); // supports >= v1.2
354 debug(user_context) << " found device compute capability v" << major_version << "." << minor_version << " ...\n";
355
356 // Get the device features so that all supported features are enabled when device is created
357 VkPhysicalDeviceFeatures device_features = {};
358 void *extended_features_ptr = nullptr;
359 void *standard_features_ptr = nullptr;
360
361 debug(user_context) << " querying for device features...\n";
362 vkGetPhysicalDeviceFeatures(*physical_device, &device_features);
363 debug(user_context) << " shader float64 support: " << (device_features.shaderFloat64 ? "true" : "false") << "...\n";
364 debug(user_context) << " shader int64 support: " << (device_features.shaderInt64 ? "true" : "false") << "...\n";
365 debug(user_context) << " shader int16 support: " << (device_features.shaderInt16 ? "true" : "false") << "...\n";
366
367 // assemble the chain of features to query, but only add the ones that exist in the API version
368
369 // note: requires v1.2+
371 nullptr, VK_FALSE, VK_FALSE};
372
373 // note: requires v1.2+
375 &shader_f16_i8_ext, VK_FALSE, VK_FALSE, VK_FALSE};
376
377 // note: requires v1.1+
379 (has_capability_v12 ? &storage_8bit_ext : nullptr),
381
382 VkPhysicalDeviceFeatures2KHR device_features_ext = {
384 &storage_16bit_ext, device_features};
385
386 // Look for extended device feature query method (KHR was removed when it was adopted into v1.1+)
390 }
391
392 // If the instance runtime supports querying extended device features, request them
393 if (vkGetPhysicalDeviceFeatures2KHR && has_capability_v11) {
394
395 debug(user_context) << " querying for extended device features...\n";
396 vkGetPhysicalDeviceFeatures2KHR(*physical_device, &device_features_ext);
397 debug(user_context) << " shader int8 support: " << (shader_f16_i8_ext.shaderInt8 ? "true" : "false") << "...\n";
398 debug(user_context) << " shader float16 support: " << (shader_f16_i8_ext.shaderFloat16 ? "true" : "false") << "...\n";
399 if (has_capability_v12) {
400 debug(user_context) << " storage buffer 8bit access support: " << (storage_8bit_ext.storageBuffer8BitAccess ? "true" : "false") << "...\n";
401 debug(user_context) << " storage buffer 16bit access support: " << (storage_16bit_ext.storageBuffer16BitAccess ? "true" : "false") << "...\n";
402 }
403 extended_features_ptr = (void *)(&device_features_ext); // pass extended features (which also contains the standard features)
404 } else {
405 standard_features_ptr = &device_features; // pass v1.0 standard features
406 }
407
408 VkDeviceCreateInfo device_create_info = {
410 extended_features_ptr, // Extended struct ptr (used here for requesting chain of extended features)
411 0, // Flags
412 1, // Count of queues to create
413 &device_queue_create_info,
414 (uint32_t)requested_layers.size(), requested_layers.data(), // Layers
415 (uint32_t)required_device_extensions.size(), required_device_extensions.data(), // Enabled extensions
416 (VkPhysicalDeviceFeatures *)standard_features_ptr, // Requested device features
417 };
418
419 VkResult result = vkCreateDevice(*physical_device, &device_create_info, alloc_callbacks, device);
420 if (result != VK_SUCCESS) {
421 debug(user_context) << "Vulkan: vkCreateDevice failed with return code: " << vk_get_error_name(result) << "\n";
423 }
424
425 vkGetDeviceQueue(cached_device, *queue_family_index, 0, queue);
427}
428
429// Initializes the context (used by the default implementation of halide_acquire_context)
430int vk_create_context(void *user_context, VulkanMemoryAllocator **allocator,
431 VkInstance *instance, VkDevice *device, VkPhysicalDevice *physical_device,
432 VkCommandPool *command_pool, VkQueue *queue, uint32_t *queue_family_index) {
433
434 debug(user_context) << " vk_create_context (user_context: " << user_context << ")\n";
435
436 StringTable requested_layers;
437 uint32_t requested_layer_count = vk_get_requested_layers(user_context, requested_layers);
438 debug(user_context) << " requested " << requested_layer_count << " layers for instance!\n";
439 for (int n = 0; n < (int)requested_layer_count; ++n) {
440 debug(user_context) << " layer: " << requested_layers[n] << "\n";
441 }
442
443 const VkAllocationCallbacks *alloc_callbacks = halide_vulkan_get_allocation_callbacks(user_context);
444 int error_code = vk_create_instance(user_context, requested_layers, instance, alloc_callbacks);
445 if (error_code != halide_error_code_success) {
446 error(user_context) << "Vulkan: Failed to create instance for context!\n";
447 return error_code;
448 }
449
450 if (vkCreateDevice == nullptr) {
451 vk_load_vulkan_functions(*instance);
452 }
453
454 error_code = vk_select_device_for_context(user_context, instance, device, physical_device, queue_family_index);
455 if (error_code != halide_error_code_success) {
456 error(user_context) << "Vulkan: Failed to select device for context!\n";
457 return error_code;
458 }
459
460 error_code = vk_create_device(user_context, requested_layers, instance, device, queue, physical_device, queue_family_index, alloc_callbacks);
461 if (error_code != halide_error_code_success) {
462 error(user_context) << "Vulkan: Failed to create device for context!\n";
463 return error_code;
464 }
465
466 *allocator = vk_create_memory_allocator(user_context, *device, *physical_device, alloc_callbacks);
467 if (*allocator == nullptr) {
468 error(user_context) << "Vulkan: Failed to create memory allocator for device!\n";
470 }
471
472 error_code = vk_create_command_pool(user_context, *allocator, *queue_family_index, command_pool);
473 if (error_code != halide_error_code_success) {
474 error(user_context) << "Vulkan: Failed to create command pool for context!\n";
475 return error_code;
476 }
477
479}
480
481// --------------------------------------------------------------------------
482
483} // namespace
484} // namespace Vulkan
485} // namespace Internal
486} // namespace Runtime
487} // namespace Halide
488
489#endif /// HALIDE_RUNTIME_VULKAN_CONTEXT_H
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_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
Definition: HalideRuntime.h:40
const struct VkAllocationCallbacks * halide_vulkan_get_allocation_callbacks(void *user_context)
int halide_vulkan_acquire_context(void *user_context, struct halide_vulkan_memory_allocator **allocator, struct VkInstance_T **instance, struct VkDevice_T **device, struct VkPhysicalDevice_T **physical_device, uint64_t *command_pool, struct VkQueue_T **queue, uint32_t *queue_family_index, bool create=true)
const char * halide_vulkan_get_device_type(void *user_context)
int halide_vulkan_release_context(void *user_context, struct VkInstance_T *instance, struct VkDevice_T *device, struct VkQueue_T *queue)
void append(void *user_context, const char *str, size_t length=0)
Definition: string_table.h:144
bool contains(const char *str) const
Definition: string_table.h:190
HALIDE_ALWAYS_INLINE VulkanContext(void *user_context)
HALIDE_ALWAYS_INLINE const VkAllocationCallbacks * allocation_callbacks()
Vulkan Memory Allocator class interface for managing large memory requests stored as contiguous block...
Definition: vulkan_memory.h:42
#define VK_API_VERSION_1_3
Definition: mini_vulkan.h:83
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName)
void(VKAPI_PTR * PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR *pFeatures)
Definition: mini_vulkan.h:3862
VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue)
#define VK_MAKE_API_VERSION(variant, major, minor, patch)
Definition: mini_vulkan.h:78
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance)
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
#define VK_API_VERSION_MINOR(version)
Definition: mini_vulkan.h:76
@ VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR
Definition: mini_vulkan.h:1044
#define VK_FALSE
Definition: mini_vulkan.h:120
@ VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU
Definition: mini_vulkan.h:608
@ VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
Definition: mini_vulkan.h:606
@ VK_PHYSICAL_DEVICE_TYPE_CPU
Definition: mini_vulkan.h:609
@ VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
Definition: mini_vulkan.h:607
VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices)
@ VK_QUEUE_COMPUTE_BIT
Definition: mini_vulkan.h:1111
#define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR
Definition: mini_vulkan.h:6069
VkResult
Definition: mini_vulkan.h:138
@ VK_INCOMPLETE
Definition: mini_vulkan.h:144
@ VK_SUCCESS
Definition: mini_vulkan.h:139
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties)
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR *pFeatures)
VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator)
#define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR
Definition: mini_vulkan.h:6059
#define VK_API_VERSION_MAJOR(version)
Definition: mini_vulkan.h:75
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice)
@ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
Definition: mini_vulkan.h:175
@ VK_STRUCTURE_TYPE_APPLICATION_INFO
Definition: mini_vulkan.h:173
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR
Definition: mini_vulkan.h:250
@ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
Definition: mini_vulkan.h:174
@ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
Definition: mini_vulkan.h:176
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR
Definition: mini_vulkan.h:302
volatile ScopedSpinLock::AtomicFlag WEAK thread_lock
VkCommandPool WEAK cached_command_pool
VkPhysicalDevice WEAK cached_physical_device
halide_vulkan_memory_allocator *WEAK cached_allocator
void WEAK vk_load_vulkan_functions(VkInstance instance)
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
#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 *)
#define WEAK
VkPhysicalDeviceType deviceType
Definition: mini_vulkan.h:1658
char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]
Definition: mini_vulkan.h:1659