Skip to content

Mac Metal generation throughput 5-7 tok/s (45x slower than CUDA) — vendored llama.cpp Metal kernel coverage gap #960

Open

Description

@joelteply

airc-queue card

Coordinates work via the AIRC queue substrate (airc#562). Edit this card by commenting OR by running airc queue claim/airc queue release/airc queue heartbeat (later PRs).

{
  "kind": "airc-queue-card-v1",
  "id": "#960",
  "owner": "claude-tab-2",
  "status": "claimed",
  "evidence": "Adopted existing GitHub issue into airc queue.",
  "next_action": "Triage, claim, or close this adopted backlog card."
}

Close this issue when the work is done (status=merged/abandoned).

Original issue body

Pre-adoption body

Bug

Raw bench tool against the same GGUF on M5 Pro Metal vs RTX 5090 CUDA via DMR:

Model Mac M5 Pro Metal RTX 5090 CUDA (DMR) Gap
qwen2-vl-7B Q4_K_M 6.9 tok/s generation n/a —
qwen3.5-4B Q4_K_M 5.2 tok/s generation 234 tok/s generation 45×

Mac prefill is fine (~1300 tok/s, Metal-class). Per-token decode is the bottleneck.

The 4B is SLOWER than the 7B on Metal — wrong direction. Tells us qwen3.5's SSM/Mamba layers (qwen35.ssm.conv_kernel, ssm.state_size, ssm.group_count, etc. visible in GGUF metadata) lack Metal kernels in our vendored llama.cpp.

Bench output also shows CPU compute buffer size = 22 MiB non-zero — confirming SOME ops run on CPU per decode step alongside the Metal ones. Pure-Metal decode would have 0 MiB CPU compute buffer.

Vendored llama.cpp submodule: e21cdc11a (gguf-v0.18.0-609 from 2026-04-13). Origin/master is +609 commits ahead with Metal/SSM work in the gap.

Fix path

  1. Bump src/workers/llama/vendor/llama.cpp submodule to recent HEAD with SSM Metal coverage. Audit upstream commits in the e21cdc11a..HEAD range for SSM-related Metal kernel additions.
  2. Re-bench. If qwen3.5 4B improves to 30+ tok/s, we are done with the SSM gap.
  3. If qwen2-vl 7B is still ~7 tok/s, that is a separate qwen2vl-specific Metal kernel coverage gap to investigate.
  4. If upstream still lacks the kernels, write our own Metal kernels for the missing ops in our fork. Joel: 'we use a fork anyway, and did this for candle once. We can fix their bullshit.'

Compile guard compile_error! on Mac builds without --features metal (already shipped) prevents the CPU-only-fallback regression while we work this.

Linked

PR #950 follow-up. Joel-stated explicitly: post-merge perf PR.

Activity

  1. added
    bug
    performance
    on Apr 24, 2026
  2. added
    airc-queue
    on May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    airc-queuebugperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions