Apple M6 MacBook Pro Memory-Tier Benchmark (wired limit + swap guard) (bench-m6-memory-tier.sh)
Records chip and memory tier, optionally raises iogpu.wired_limit_mb, runs a fixed llama-bench with Q8_0 KV cache, and flags the result as invalid if macOS swapped during the run.
Apple M6 MacBook Pro Memory-Tier Benchmark (wired limit + swap guard)
Records chip and memory tier, optionally raises iogpu.wired_limit_mb, runs a fixed llama-bench with Q8_0 KV cache, and flags the result as invalid if macOS swapped during the run.
#!/usr/bin/env bash
# Tinker AI — Apple M6 MacBook Pro Memory-Tier Benchmark (Guide #38)
set -euo pipefail
MODEL="./models/Qwen3-14B-Q4_K_M.gguf"
WIRED="0"
PROMPT_TOKENS="2048"
echo "=== [1/4] Chip & memory tier ==="
system_profiler SPHardwareDataType | grep -E "Chip|Memory"
echo "=== [2/4] GPU wired-memory limit ==="
if [ "$WIRED" != "0" ]; then
sudo sysctl iogpu.wired_limit_mb="$WIRED"
fi
sysctl iogpu.wired_limit_mb
swapins() { vm_stat | awk '/Swapins/ {gsub("\\.","",$2); print $2}'; }
BEFORE=$(swapins)
echo "=== [3/4] llama-bench pp$PROMPT_TOKENS / tg128 x3, Q8_0 KV ==="
llama-bench -m "$MODEL" -ngl 99 -fa 1 -ctk q8_0 -ctv q8_0 -p "$PROMPT_TOKENS" -n 128 -r 3 -o md
AFTER=$(swapins)
echo "=== [4/4] Swap guard ==="
if [ "$AFTER" -gt "$BEFORE" ]; then
echo "[INVALID] macOS swapped $((AFTER - BEFORE)) pages during the run — this model is too large for this memory tier."
else
echo "[OK] No swap during benchmark — result is valid for this memory tier."
fi
Customizable Parameter Reference for bench-m6-memory-tier.sh
This SHELL artifact exposes 3 template variables compiled client-side in your browser.
| Template Token | Parameter Description | Verified Default | Example Format |
|---|---|---|---|
{{MODEL_PATH}} | GGUF model path | ./models/Qwen3-14B-Q4_K_M.gguf | ./models/Qwen3-14B-Q4_K_M.gguf |
{{WIRED_LIMIT_MB}} | GPU wired limit in MB (0 = keep macOS default) | 0 | 26624 |
{{CTX_SIZE}} | Prompt tokens for prefill test | 2048 | 2048 |
Verified Environment for "Apple M6 MacBook Pro (16GB / 24GB / 32GB) for Local LLMs: Which Memory Tier, Which Models, and Why the Dual Neural Engine Does Not Speed Up llama.cpp"
Spec basis (not lab-measured): 14-inch MacBook Pro with base Apple M6 (TSMC N2 · 12-core CPU: 2 super + 4 performance + 6 efficiency · 12-core GPU with per-core Neural Accelerators · dual 16-core Neural Engine · 16GB @ 153 GB/s, 24GB/32GB @ 170 GB/s, as reported at launch)
llama.cpp / Ollama / MLX inference runs entirely on-device. Apple Intelligence features that hand off to Private Cloud Compute are not part of this guide.
- Evidence level: SPEC-DERIVED ESTIMATE. Tok/s figures are computed from published bandwidth (× 0.68 efficiency), not measured on an M6 in our lab. Run the attached script and replace them with your numbers.
- macOS caps GPU-wired memory at roughly two-thirds to three-quarters of RAM by default. Raising `iogpu.wired_limit_mb` helps on 32GB but leaves less headroom for the OS, browser, and IDE; it resets on reboot.
- The dual 16-core Neural Engine is only reachable via Core ML / Apple Foundation Models. llama.cpp, Ollama and MLX run on the GPU; their speed is governed by memory bandwidth (decode) and GPU Neural Accelerators (prefill, MLX/Metal 4 path).
3-Step Verification Checklist After Deploying bench-m6-memory-tier.sh
- Recorded exact memory tier and bandwidth class (16GB @153 GB/s or 24/32GB @170 GB/s) from About This Mac / `system_profiler SPHardwareDataType`.
- Checked `iogpu.wired_limit_mb` and, if raised, noted the value alongside the benchmark result.
- Confirmed `vm_stat` Swapins/Swapouts did not grow during the benchmark run.