fix: consolidate metal support#4
Merged
Merged
Conversation
608b255 to
37986e3
Compare
e4eb12c to
b4eb62c
Compare
parakeet.cpp aborted on Apple Metal (ggml's Metal backend has no CONV_2D_DW kernel, which the Conformer subsampling emits). Make it run on Metal and keep every backend fast: - backend: GPU devices use the persistent gallocr fast path. A per-graph ggml_backend_supports_op scan only routes to ggml_backend_sched (CPU fallback) when the active GPU backend genuinely lacks a kernel for some op. CUDA covers every op, so it stays on gallocr (verified parity with master on the GB10; the earlier blanket-sched approach regressed CUDA 7-23%). The CPU path is unchanged. - ggml: native Metal CONV_2D_DW kernel (patch 0002) and leading-side PAD support (patch 0003), the two ops the encoder needed. With these the whole encoder, down to the log-mel front end, runs on Metal. - bench: scripts/bench_metal_dw.sh measures steady-state RTFx via parakeet-cli bench (warm up once, time inference only). - ci: run the closed-loop end-to-end transcript assertion on pull requests, not just manual dispatch. - docs: Apple Metal section in README and BENCHMARK; AGENTS.md gains a performance-invariant note (keep gallocr) and the reference transcript. Metal (M4, q4_k) is about 3-5x over CPU on the larger models. CPU and CUDA are within noise of master. Assisted-by: Claude:claude-opus-4-8 [Claude Code]
b4eb62c to
e52b079
Compare
Owner
Author
|
on this I've actually ported the missing ops. Metal should be fully covered |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent changes to make parakeet.cpp work on metal:
src/backend.cpp). When the selected deviceis a GPU, compute runs through
ggml_backend_schedover{GPU, CPU}, so anop the GPU lacks is offloaded to CPU instead of aborting.
CONV_2D_DWkernel and conv module's leading side time padding (PAD). It mirrors theexisting
CONV_2Dop but is depthwise: each output channel convolves onlyits own input channel. Scope is WHCN-contiguous, F32, which is what
subsampling uses; other layouts and dtypes report unsupported and fall back
to CPU via change 1, so the kernel is correct by construction for the cases
it claims.
With change 1 alone, Metal works (the conv runs on CPU), 2 is an optimization to gain some speed back and move all ops to Metal.
Fixes: #2