Skip to content

Commit 88b5dd8

Browse files
blood-orangeXue Chen
andauthored
Repair etvk.vma_dep=instantiated to share VMA via 3.2.0 (#20225)
Summary: Fixes the ExecuTorch Vulkan backend's `etvk.vma_dep=instantiated` mode so the backend links a single, shared VulkanMemoryAllocator (VMA) instead of instantiating its own. This is the prerequisite that lets a binary link both ET Vulkan and another VMA consumer (e.g. IGL/compphoto) without an `ld.lld: duplicate symbol: Vma*` collision. Changes (both `fbcode` and `xplat` mirrors): 1. `backends/vulkan/targets.bzl`: repair the `etvk.vma_dep=instantiated` path, which pointed at `//third-party/VulkanMemoryAllocator/3.0.1:VulkanMemoryAllocatorInstantiated` — a package that no longer exists at HEAD (only `3.2.0` remains), so the mode was broken for everyone. Repoint it to `3.2.0:VulkanMemoryAllocatorInstantiated`, the same target IGL/compphoto already use, so VMA is linked exactly once. 2. `backends/vulkan/runtime/vk_api/memory/vma_api.h`: align the `ETVK_USE_META_VMA` branch `VMA_VULKAN_VERSION` from `1002000` to `1003000` to match the 3.2.0 instantiated lib's config (`vk_mem_alloc_instantiated.h`) so struct layouts agree across translation units and the pre-instantiated static lib (ABI safety). Both changes only affect the opt-in `etvk.vma_dep=instantiated` mode (which was already broken/unused), so default `xplat` builds and all other ET consumers are byte-for-byte unchanged. Differential Revision: D108337179 Co-authored-by: Xue Chen <xuechen@meta.com>
1 parent 2302c25 commit 88b5dd8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

backends/vulkan/runtime/vk_api/memory/vma_api.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
#undef VMA_DYNAMIC_VULKAN_FUNCTIONS
2424
#define VMA_STATIC_VULKAN_FUNCTIONS 0
2525
#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
26-
#define VMA_VULKAN_VERSION 1002000
26+
// Must match the 3.2.0 VulkanMemoryAllocatorInstantiated config
27+
// (vk_mem_alloc_instantiated.h) so struct layouts agree across translation
28+
// units and the pre-instantiated static lib.
29+
#define VMA_VULKAN_VERSION 1003000
2730

2831
#ifdef __clang__
2932
#pragma clang diagnostic push

backends/vulkan/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def define_common_targets(is_fbcode = False):
191191

192192
if vma_dep == "instantiated":
193193
VK_API_DEPS = [
194-
"fbsource//third-party/VulkanMemoryAllocator/3.0.1:VulkanMemoryAllocatorInstantiated",
194+
"fbsource//third-party/VulkanMemoryAllocator/3.2.0:VulkanMemoryAllocatorInstantiated",
195195
]
196196
else:
197197
VK_API_DEPS = [

0 commit comments

Comments
 (0)