TinkerLab
ARTIFACT // BENCH-M6-MEMORY-TIER.SH (SHELL)

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.

[KEY VERIFIED TAKEAWAY / TL;DR]This reproducible configuration artifact "Apple M6 MacBook Pro Memory-Tier Benchmark (wired limit + swap guard)" (bench-m6-memory-tier.sh, SHELL) is paired with Tinker AI Lab's hardware-verified guide "apple-m6-macbook-pro-16gb-24gb-32gb-local-llm-sizing-neural-engine-vs-gpu". It exposes 3 customizable browser variables (MODEL_PATH=./models/Qwen3-14B-Q4_K_M.gguf, WIRED_LIMIT_MB=0, CTX_SIZE=2048) with loopback-first security defaults.
01 // HOMELABLocal AI / HomeLab· Verified: 2026-11-05
Browse All 42 Artifacts →
bench-m6-memory-tier.sh

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.

View Paired Guide →
Customizable Variables (Saved in Browser)
UTF-8 Encoded · Live Client-Side Compilation
#!/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
PARAMETER SPECIFICATION // 参数化变量规范说明表

Customizable Parameter Reference for bench-m6-memory-tier.sh

This SHELL artifact exposes 3 template variables compiled client-side in your browser.

Template TokenParameter DescriptionVerified DefaultExample 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)026624
{{CTX_SIZE}}Prompt tokens for prefill test20482048
PAIRED HARDWARE MANIFEST // 配套实测环境与边界记录

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"

Tested Hardware & OS

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)

Pinned Stack & Model Versions
macOS 26.x (Metal 4)llama.cpp master (2026-11, Metal backend) / Ollama (latest stable)MLX + mlx-lm (latest, uses GPU Neural Accelerators via Metal 4 tensor ops)Models: Qwen3-8B / Qwen3-14B / Gemma 3 27B / Qwen3-30B-A3B / Qwen3-32B (GGUF Q4_K_M or MLX 4-bit)
Offline Boundary (Fully Offline After Model Download)

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.

Known Operational Limits & Failure Modes
  • 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).
DEPLOYMENT CHECKLIST // 配置落地核验步骤

3-Step Verification Checklist After Deploying bench-m6-memory-tier.sh

  1. Recorded exact memory tier and bandwidth class (16GB @153 GB/s or 24/32GB @170 GB/s) from About This Mac / `system_profiler SPHardwareDataType`.
  2. Checked `iogpu.wired_limit_mb` and, if raised, noted the value alongside the benchmark result.
  3. Confirmed `vm_stat` Swapins/Swapouts did not grow during the benchmark run.