Commit 741032c
transcribefile: Metal GPU support via llamafile's runtime loader
Wires llamafile's GPU machinery into transcribefile so parakeet runs on
Apple Silicon GPUs: 51x realtime cold / ~120x warm vs 17x CPU on jfk.wav,
with transcripts byte-identical to the CPU backend.
How it works:
- transcribefile links llamafile.o + gpu.a + zip.o + check_cpu.o (the
whisperfile TOOL_LLAMAFILE_OBJS pattern) plus $(LLAMAFILE_METAL_SOURCES),
so metal.c can extract the bundled (patched) ggml sources from the zip
store and compile ggml-metal.dylib at runtime, sharing the cached copy
under ~/.llamafile with llamafile itself.
- ggml_backend_register resolves from transcribe.cpp.a, so the loaded
backend registers into transcribe.cpp's own ggml device registry; the
upstream CLI's --backend / --device / --list-devices logic works
unchanged.
- transcribefile/main.cpp gains load_gpu_backends(): --backend cpu /
cpu_accel never touch the GPU machinery; auto / metal try Metal and
degrade silently to CPU when unavailable, leaving backend-missing
errors to transcribe.cpp's own reporting.
- 7 new transcribe.cpp patches port the host-side ggml ABI surface
(GGML_CALL calling-convention annotations + the free_struct buffer
callback) from the llama.cpp patch set, unmodified except for paths --
both trees vendor ggml 0.15.2. This keeps the interface structs
exchanged with the (llama.cpp-built) backend dylibs ABI-identical,
which is a no-op for Metal on macOS today but load-bearing on Windows
(ms_abi) and for the Vulkan/CUDA follow-ups.
- transcribefile_smoke.sh gains a Metal layer: asserts an MTL device is
actually selected and that Metal/CPU transcripts match; skips cleanly
off Apple Silicon or when no Metal device registers.
Vulkan and CUDA are intentionally not wired up yet (follow-up PRs); on
this branch --backend vulkan/cuda report "backend requested but not
available" via transcribe.cpp as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 1281813 commit 741032c
10 files changed
Lines changed: 1024 additions & 4 deletions
File tree
- tests
- transcribe.cpp.patches/patches
- transcribefile
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
0 commit comments