Commit 9df506e
[ET-VK][build] Fix Windows Vulkan/Android build and llama ETDump profiling
Summary:
Three additive, backward-compatible fixes needed to build the ExecuTorch Vulkan
backend and profile the llama runner from a Windows host. Each is guarded so it
is a no-op on non-Windows / non-profiling builds.
- backends/vulkan/runtime/gen_vulkan_spv.py: normalize CRLF -> LF at the top of
preprocess() before the trailing-backslash macro-continuation regex. GLSL
templates checked out with CRLF otherwise leave a lone backslash that escape()
turns into an unterminated Python string literal
("SyntaxError: unterminated string literal") during shader codegen.
- third-party/CMakeLists.txt: allow importing a prebuilt host flatc/flatcc via
FLATC_EXECUTABLE / FLATCC_EXECUTABLE instead of building them from source. The
existing WIN32 host-tool build only supports the Visual Studio generator
(VS-only CMAKE_GENERATOR_PLATFORM, .exe-less BUILD_BYPRODUCTS), which fails
under the Ninja generator required by the Android NDK cross-compile.
- examples/models/llama/CMakeLists.txt: link etdump and define
ET_EVENT_TRACER_ENABLED when the etdump target exists (i.e. core libs built
with EXECUTORCH_BUILD_DEVTOOLS=ON + EXECUTORCH_ENABLE_EVENT_TRACER=ON). This
enables ETDump collection and makes the Vulkan delegate emit per-dispatch GPU
timestamps for per-shader profiling.
Test Plan:
Cross-compiled ExecuTorch core libs + llama_main for Android arm64 with the
Vulkan backend enabled from a Windows host (NDK r29, Ninja generator, imported
host flatc/flatcc). Confirmed libvulkan_backend.a is linked and llama_main runs
on a Galaxy S24 (Adreno 750): Qwen3 0.6B ~80 tok/s decode, Llama 3.2 1B 8da4w
~60 tok/s decode. With DEVTOOLS/EVENT_TRACER on, collected an ETDump containing
per-shader Vulkan events and analyzed prefill/decode breakdown via
custom_inspector.py --mode llm.
Reviewers:
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 3389d51 commit 9df506e
3 files changed
Lines changed: 38 additions & 0 deletions
File tree
- backends/vulkan/runtime
- examples/models/llama
- third-party
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
644 | 650 | | |
645 | 651 | | |
646 | 652 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
244 | 253 | | |
245 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
246 | 259 | | |
247 | 260 | | |
248 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| |||
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
| 98 | + | |
89 | 99 | | |
90 | 100 | | |
91 | 101 | | |
| |||
104 | 114 | | |
105 | 115 | | |
106 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
107 | 125 | | |
108 | 126 | | |
109 | 127 | | |
| |||
142 | 160 | | |
143 | 161 | | |
144 | 162 | | |
| 163 | + | |
145 | 164 | | |
146 | 165 | | |
147 | 166 | | |
| |||
0 commit comments