xref: /aosp_15_r20/external/pytorch/aten/src/ATen/native/vulkan/api/Allocator.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 //
4 // Do NOT include vk_mem_alloc.h directly.
5 // Always include this file (Allocator.h) instead.
6 //
7 
8 #include <ATen/native/vulkan/api/vk_api.h>
9 
10 #ifdef USE_VULKAN_API
11 
12 #define VMA_VULKAN_VERSION 1000000
13 
14 #ifdef USE_VULKAN_WRAPPER
15 #define VMA_STATIC_VULKAN_FUNCTIONS 0
16 #else
17 #define VMA_DYNAMIC_VULKAN_FUNCTIONS 0
18 #endif /* USE_VULKAN_WRAPPER */
19 
20 #define VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE (32ull * 1024 * 1024)
21 #define VMA_SMALL_HEAP_MAX_SIZE (256ull * 1024 * 1024)
22 
23 #define VMA_STATS_STRING_ENABLED 0
24 
25 #ifdef VULKAN_DEBUG
26 #define VMA_DEBUG_ALIGNMENT 4096
27 #define VMA_DEBUG_ALWAYS_DEDICATED_MEMORY 0
28 #define VMA_DEBUG_DETECT_CORRUPTION 1
29 #define VMA_DEBUG_GLOBAL_MUTEX 1
30 #define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1
31 #define VMA_DEBUG_MARGIN 64
32 #define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY 256
33 #define VMA_RECORDING_ENABLED 1
34 
35 #define VMA_DEBUG_LOG(format, ...)
36 /*
37 #define VMA_DEBUG_LOG(format, ...) do { \
38     printf(format, __VA_ARGS__); \
39     printf("\n"); \
40 } while(false)
41 */
42 #endif /* VULKAN_DEBUG */
43 
44 // Note: Do not try to use C10 convenience macors here, as this header is
45 // included from ExecuTorch that does not want to have dependency on C10
46 #ifdef __clang__
47 #pragma clang diagnostic push
48 #pragma clang diagnostic ignored "-Wnullability-completeness"
49 #pragma clang diagnostic ignored "-Wunused-variable"
50 #pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override"
51 #endif /* __clang__ */
52 
53 #include <include/vk_mem_alloc.h>
54 
55 #ifdef __clang__
56 #pragma clang diagnostic pop
57 #endif /* __clang__ */
58 
59 #endif /* USE_VULKAN_API */
60