Repository navigation
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
Regarding the automated flags:
|
67ec85e to
ed69c7b
Compare
|
You seem to have included your other PR in this one. |
|
Thank you @CISC . When fixing the conflict with ./scripts/create_ops_docs.py I accidentally included other fixes for another branch. Will address. |
|
Requesting review from @ggml-org/ggml-metal |
3524fef to
6b913eb
Compare
|
@CISC Would you mind taking another look? The issue is addressed. |
I cannot review Metal PRs (I don't even have the necessary hardware), wait for @ggml-org/ggml-metal |
|
@ggerganov any chance I can get a review? |
Add Metal backend support for GGML_OP_GATED_LINEAR_ATTN (GLA). Supports head_size 64 and 128, f32 only. Tested with test-backend-ops (7/7 passed): - M5 Max 128GB (Apple10) - M2 Mac Mini (Apple8)
# Conflicts: # docs/ops.md
Add Metal backend support for
GGML_OP_GATED_LINEAR_ATTN(GLA). Supports head_size 64 and 128, f32 only.Overview
Metal is currently the only major GPU backend without GLA support. Without this, RWKV6Qwen2 models fall back to CPU for this op on every layer, causing GPU/CPU sync overhead that hurts performance significantly on lower-end Apple Silicon.
The kernel follows the existing RWKV WKV6 Metal structure: one thread per head element, threadgroup shared memory for k/q/gate, and a float4-vectorized inner loop.
supports_oprestricts execution to f32 with head sizes 64 or 128.Correctness
test-backend-ops (7/7 passed on both devices):
Before (master a6cc43c):
After:
Performance
Benchmarked with QRWKV6-7B-Instruct Q4_K_M, llama-bench, 3 runs each.
M2 Mac Mini 32GB (Apple8)
M5 Max 128GB (Apple10)
The M5 Max has enough GPU bandwidth that GLA is not the bottleneck at this model size. The M2 Mini shows the real impact of CPU fallback: 5.3x on single-token prefill and 22.5% on decode.
Perplexity
wikitext-2, 5 chunks, ctx=512:
Zero quality impact.
Notes
docs/ops.mdanddocs/ops/Metal.csvregenerated usingtest-backend-ops support --output csvand./scripts/create_ops_docs.py.Mentions #14909
Requirements