Skip to content

Commit 615d52f

Browse files
author
ssjia
committed
[ET-VK] Add Vulkan backend support for Parakeet runner and export
Add Vulkan build support for the Parakeet runner: llm-debug-vulkan preset in root CMakePresets.json, parakeet-vulkan presets in the Parakeet CMakePresets.json, vulkan_backend linkage in CMakeLists.txt, and a `make parakeet-vulkan` Makefile target. Add _create_vulkan_partitioners() and wire it into lower_to_executorch() so that `--backend vulkan` is accepted by export_parakeet_tdt.py. Differential Revision: [D95970157](https://our.internmc.facebook.com/intern/diff/D95970157/) [ghstack-poisoned]
1 parent 9343d28 commit 615d52f

5 files changed

Lines changed: 107 additions & 2 deletions

File tree

CMakePresets.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,21 @@
217217
"rhs": "Darwin"
218218
}
219219
},
220+
{
221+
"name": "llm-debug-vulkan",
222+
"displayName": "LLM debug build with Vulkan",
223+
"inherits": [
224+
"llm-debug"
225+
],
226+
"cacheVariables": {
227+
"EXECUTORCH_BUILD_VULKAN": "ON"
228+
},
229+
"condition": {
230+
"type": "inList",
231+
"string": "${hostSystemName}",
232+
"list": ["Linux", "Windows"]
233+
}
234+
},
220235
{
221236
"name": "llm-metal-stats",
222237
"displayName": "LLM Metal build with stats collection and logging",
@@ -354,6 +369,15 @@
354369
],
355370
"jobs": 0
356371
},
372+
{
373+
"name": "llm-debug-vulkan-install",
374+
"displayName": "Build and install LLM extension debug artifacts (Vulkan)",
375+
"configurePreset": "llm-debug-vulkan",
376+
"targets": [
377+
"install"
378+
],
379+
"jobs": 0
380+
},
357381
{
358382
"name": "llm-metal-stats-install",
359383
"displayName": "Build and install LLM extension artifacts with Metal stats",
@@ -449,6 +473,20 @@
449473
}
450474
]
451475
},
476+
{
477+
"name": "llm-debug-vulkan",
478+
"displayName": "Configure, build and install ExecuTorch LLM extension with Vulkan enabled (Debug)",
479+
"steps": [
480+
{
481+
"type": "configure",
482+
"name": "llm-debug-vulkan"
483+
},
484+
{
485+
"type": "build",
486+
"name": "llm-debug-vulkan-install"
487+
}
488+
]
489+
},
452490
{
453491
"name": "llm-metal-stats",
454492
"displayName": "Configure, build and install ExecuTorch LLM extension with Metal stats and logging",

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
#
9292
# ==============================================================================
9393

94-
.PHONY: voxtral-cuda voxtral-cpu voxtral-metal voxtral_realtime-cuda voxtral_realtime-cpu voxtral_realtime-metal whisper-cuda whisper-cuda-debug whisper-cpu whisper-metal parakeet-cuda parakeet-cuda-debug parakeet-cpu parakeet-metal sortformer-cuda sortformer-cpu silero-vad-cpu llama-cuda llama-cuda-debug llama-cpu llava-cpu gemma3-cuda gemma3-cpu clean help
94+
.PHONY: voxtral-cuda voxtral-cpu voxtral-metal voxtral_realtime-cuda voxtral_realtime-cpu voxtral_realtime-metal whisper-cuda whisper-cuda-debug whisper-cpu whisper-metal parakeet-cuda parakeet-cuda-debug parakeet-cpu parakeet-metal parakeet-vulkan sortformer-cuda sortformer-cpu silero-vad-cpu llama-cuda llama-cuda-debug llama-cpu llava-cpu gemma3-cuda gemma3-cpu clean help
9595

9696
help:
9797
@echo "This Makefile adds targets to build runners for various models on various backends. Run using \`make <target>\`. Available targets:"
@@ -109,6 +109,7 @@ help:
109109
@echo " parakeet-cuda-debug - Build Parakeet runner with CUDA backend (debug mode)"
110110
@echo " parakeet-cpu - Build Parakeet runner with CPU backend"
111111
@echo " parakeet-metal - Build Parakeet runner with Metal backend (macOS only)"
112+
@echo " parakeet-vulkan - Build Parakeet runner with Vulkan backend"
112113
@echo " sortformer-cuda - Build Sortformer runner with CUDA backend"
113114
@echo " sortformer-cpu - Build Sortformer runner with CPU backend"
114115
@echo " silero-vad-cpu - Build Silero VAD runner with CPU backend"
@@ -219,6 +220,15 @@ parakeet-metal:
219220
@echo "✓ Build complete!"
220221
@echo " Binary: cmake-out/examples/models/parakeet/parakeet_runner"
221222

223+
parakeet-vulkan:
224+
@echo "==> Building and installing ExecuTorch with Vulkan..."
225+
cmake --workflow --preset llm-debug-vulkan
226+
@echo "==> Building Parakeet runner with Vulkan..."
227+
cd examples/models/parakeet && cmake --workflow --preset parakeet-vulkan
228+
@echo ""
229+
@echo "✓ Build complete!"
230+
@echo " Binary: cmake-out/examples/models/parakeet/parakeet_runner"
231+
222232
sortformer-cuda:
223233
@echo "==> Building and installing ExecuTorch with CUDA..."
224234
cmake --workflow --preset llm-release-cuda

examples/models/parakeet/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ if(EXECUTORCH_BUILD_METAL)
9191
executorch_target_link_options_shared_lib(metal_backend)
9292
endif()
9393

94+
if(EXECUTORCH_BUILD_VULKAN)
95+
list(APPEND link_libraries vulkan_backend)
96+
executorch_target_link_options_shared_lib(vulkan_backend)
97+
endif()
98+
9499
add_executable(parakeet_runner main.cpp timestamp_utils.cpp tokenizer_utils.cpp)
95100
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
96101
target_link_options_gc_sections(parakeet_runner)

examples/models/parakeet/CMakePresets.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@
5555
"type": "equals",
5656
"rhs": "Darwin"
5757
}
58+
},
59+
{
60+
"name": "parakeet-vulkan",
61+
"displayName": "Parakeet runner (Vulkan)",
62+
"inherits": ["parakeet-base"],
63+
"cacheVariables": {
64+
"EXECUTORCH_BUILD_VULKAN": "ON"
65+
},
66+
"condition": {
67+
"type": "inList",
68+
"string": "${hostSystemName}",
69+
"list": ["Linux", "Windows"]
70+
}
5871
}
5972
],
6073
"buildPresets": [
@@ -85,6 +98,13 @@
8598
"configurePreset": "parakeet-metal",
8699
"configuration": "Release",
87100
"targets": ["parakeet_runner"]
101+
},
102+
{
103+
"name": "parakeet-vulkan",
104+
"displayName": "Build Parakeet runner (Vulkan)",
105+
"configurePreset": "parakeet-vulkan",
106+
"configuration": "Release",
107+
"targets": ["parakeet_runner"]
88108
}
89109
],
90110
"workflowPresets": [
@@ -143,6 +163,20 @@
143163
"name": "parakeet-metal"
144164
}
145165
]
166+
},
167+
{
168+
"name": "parakeet-vulkan",
169+
"displayName": "Configure and build Parakeet runner (Vulkan)",
170+
"steps": [
171+
{
172+
"type": "configure",
173+
"name": "parakeet-vulkan"
174+
},
175+
{
176+
"type": "build",
177+
"name": "parakeet-vulkan"
178+
}
179+
]
146180
}
147181
]
148182
}

examples/models/parakeet/export_parakeet_tdt.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,22 @@ def _create_cuda_partitioners(programs, is_windows=False):
560560
return partitioner, updated_programs
561561

562562

563+
def _create_vulkan_partitioners(programs):
564+
"""Create Vulkan partitioners for all programs except preprocessor."""
565+
from executorch.backends.vulkan.partitioner.vulkan_partitioner import (
566+
VulkanPartitioner,
567+
)
568+
569+
print("\nLowering to ExecuTorch with Vulkan...")
570+
partitioner = {}
571+
for key in programs.keys():
572+
if key == "preprocessor":
573+
partitioner[key] = []
574+
else:
575+
partitioner[key] = [VulkanPartitioner()]
576+
return partitioner, programs
577+
578+
563579
def lower_to_executorch(programs, metadata=None, backend="portable"):
564580
if backend == "xnnpack":
565581
partitioner, programs = _create_xnnpack_partitioners(programs)
@@ -569,6 +585,8 @@ def lower_to_executorch(programs, metadata=None, backend="portable"):
569585
partitioner, programs = _create_cuda_partitioners(
570586
programs, is_windows=(backend == "cuda-windows")
571587
)
588+
elif backend == "vulkan":
589+
partitioner, programs = _create_vulkan_partitioners(programs)
572590
else:
573591
print("\nLowering to ExecuTorch...")
574592
partitioner = []
@@ -607,7 +625,7 @@ def main():
607625
"--backend",
608626
type=str,
609627
default="xnnpack",
610-
choices=["portable", "xnnpack", "metal", "cuda", "cuda-windows"],
628+
choices=["portable", "xnnpack", "metal", "cuda", "cuda-windows", "vulkan"],
611629
help="Backend for acceleration (default: xnnpack)",
612630
)
613631
parser.add_argument(

0 commit comments

Comments
 (0)