Skip to content

Commit 1972e69

Browse files
pytorchbotSS-JIA
andauthored
[ET-VK] Build Vulkan delegate on MacOS with MoltenVK (#6598)
As title. Differential Revision: [D65219240](https://our.internmc.facebook.com/intern/diff/D65219240/) ghstack-source-id: 251128867 Pull Request resolved: #6592 Co-authored-by: Stephen Jia <[email protected]>
1 parent 0f6aeec commit 1972e69

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

backends/vulkan/targets.bzl

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,28 +101,37 @@ def define_common_targets(is_fbcode = False):
101101
"fbsource//third-party/VulkanMemoryAllocator/3.0.1:VulkanMemoryAllocator_xplat",
102102
]
103103

104-
if not is_fbcode:
104+
if is_fbcode:
105105
VK_API_DEPS += [
106-
"fbsource//third-party/volk:volk",
106+
"fbsource//third-party/swiftshader:swiftshader_vk_headers",
107+
"fbsource//third-party/swiftshader/lib/linux-x64:libvk_swiftshader_fbcode",
108+
"fbsource//third-party/swiftshader/lib/linux-x64:libvk_swiftshader_so",
107109
]
110+
else:
108111
VK_API_DEPS += select({
109-
"DEFAULT": [],
110-
"ovr_config//os:android": ["fbsource//third-party/toolchains:android"],
112+
"DEFAULT": [
113+
"fbsource//third-party/volk:volk",
114+
],
115+
"ovr_config//os:android": [
116+
"fbsource//third-party/volk:volk",
117+
"fbsource//third-party/toolchains:android"
118+
],
119+
"ovr_config//os:macos-arm64": [
120+
"//third-party/khronos:moltenVK"
121+
],
111122
})
112-
VK_API_PREPROCESSOR_FLAGS += [
113-
"-DUSE_VULKAN_WRAPPER",
114-
"-DUSE_VULKAN_VOLK",
115-
]
116123
VK_API_PREPROCESSOR_FLAGS += select({
117-
"DEFAULT": [],
118-
"ovr_config//os:android": ["-DVK_ANDROID_external_memory_android_hardware_buffer"],
124+
"DEFAULT": [
125+
"-DUSE_VULKAN_WRAPPER",
126+
"-DUSE_VULKAN_VOLK",
127+
],
128+
"ovr_config//os:android": [
129+
"-DUSE_VULKAN_WRAPPER",
130+
"-DUSE_VULKAN_VOLK",
131+
"-DVK_ANDROID_external_memory_android_hardware_buffer"
132+
],
133+
"ovr_config//os:macos-arm64": []
119134
})
120-
else:
121-
VK_API_DEPS += [
122-
"fbsource//third-party/swiftshader:swiftshader_vk_headers",
123-
"fbsource//third-party/swiftshader/lib/linux-x64:libvk_swiftshader_fbcode",
124-
"fbsource//third-party/swiftshader/lib/linux-x64:libvk_swiftshader_so",
125-
]
126135

127136
runtime.cxx_library(
128137
name = "vulkan_compute_api",

0 commit comments

Comments
 (0)