Skip to content

Port Metal placement and batching from mesh-llm - #71

Merged
michaelneale merged 3 commits into
mainfrom
skippy/metal-placement-batching
Nov 20, 2026
Merged

michaelneale merged 3 commits into
mainfrom
skippy/metal-placement-batching

Conversation

@i386

@i386 i386 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Ports skippy/metal-placement-batching from Mesh-LLM/mesh-llm#3031 (source 3afad3e6) into standalone Skippy, using the history-aware three-way transplant over the mapped shared baseline (mesh 937f236c:skippy ≡ skippy dfefa89f) so Skippy's post-extraction changes are preserved. Based on latest main.

What's included

  • KV placement / Metal attention: each request's batch tokens are placed together, reducing fragmented attention rows; row-list validation on Metal fast paths.
  • Cache lifecycle prerequisites: resident-prefix reuse, recurrent checkpoints, cold offload/restore, and KV page release with compaction that preserves live cached prefixes.
  • Batch policy: configurable gathering and selection with session ordering, queue progress, lane limits, and token budget checks.
  • Sampling: shared configurable sampling executor replaces per-token thread creation.
  • Serving defaults: balanced batch 512 → 2,048, throughput 1,024 → 2,048; native checkpoint RAM retention is independent of the optional disk L2 cache.
  • Native: 25 patch-queue entries (23 from source, renumbered after Skippy's existing 0017–0019, plus 2 corrections below). ABI 0.1.80 → 0.1.86; bindings, dynamic exports, docs, and runtime bundles move together. Same llama.cpp pin (8954f194).

Port corrections (not in source)

  1. Preserved Skippy's full-context prefill admission — the source's resident-prefix eviction rejected a request that fit a 512-token context because it also reserved a 64-token decode batch.
  2. Hybrid checkpoint test restored both checkpoint components (attention + recurrent) instead of recurrent-only.
  3. Capability fixture admits separate resident capability components.
  4. Metal telemetry no longer labels an empty command buffer as "mixed" timing.
  5. native-full-replay now builds the activation-validation executable it registers.
  6. Loaded-runtime probes (cold prefix restore after restart; near-full context admission) added as standalone env-gated tests using a generated Qwen3.5 graph fixture.

Validation performed

  • just format, workspace Clippy --all-targets -D warnings (incl. tracy and dynamic-native-runtime features)
  • Full Rust test suites: main workspace and skippy-api-rs (unit, integration, doc tests)
  • Native: 335 Metal tests passed (full replay, static + dynamic link); 249 C++ facade tests passed
  • FFI bindings freshness check, docs site build, automation/inference contracts
  • Loaded-runtime probes: cold restart restore and full-context admission (generated fixture)

Remaining qualification (documented in docs/design/METAL_PLACEMENT_BATCHING_MIGRATION.md)

  • CUDA (page release also affects host-visible/unified memory beyond Metal)
  • Real-model performance (source reported +18.5% generation throughput for Qwen3-Coder-30B @ concurrency 4; Qwen3.5-4B within noise — memory comparison context equality unconfirmed)
  • Sampling-pool contention on many-core / multi-model
  • Renewed split certification for ABI 0.1.86 (existing roster does not certify this recipe)
  • Production-model GPU checkpoint test remains explicitly fixture-skipped

i386 added 2 commits November 20, 2026 08:15
Transplant Mesh skippy/metal-placement-batching at 3afad3e60e19 using the mapped extraction ancestor, preserving standalone main and native patches. Move resident checkpoint ownership, Metal row attention and placement, batch and sampling controls, tracing, and regression coverage without monorepo hosts or CI.

Keep ABI 0.1.86 bindings and documentation aligned; preserve near-full-context prefill admission, update component capability fixtures, classify empty Metal command timings correctly, and build every replay target. Record provenance, validation, and outstanding production-model, CUDA, cache-performance, and split qualification in docs/design/METAL_PLACEMENT_BATCHING_MIGRATION.md.
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

General Inference Lab Qualification: Passed

Commit: 7aef6868a41d1808706a5cec4d1d61cd4bdb9b7e · PR smoke · Workflow and timings · Saved evidence

Native Spark lab qualification.

Configuration Outcome Prefill tok/s Decode tok/s Actions Lab record
qwen35-4b-standalone Passed 566.9 61.4 Logs job_5nmxe8tdgp89xbv
qwen3-coder-30b-a3b-standalone Passed 212.3 62.2 Logs job_731gcdtsvvq759c
qwen3-coder-30b-a3b-split Passed Unavailable Unavailable Logs job_r9pnct68dmnygzy
qwen36-35b-a3b-standalone Passed 251.3 58.9 Logs job_36nvjbk6yw2rb09
qwen36-35b-a3b-split Passed Unavailable Unavailable Logs job_c2bd0793mfff1hh
qwen38-flash-next-standalone Passed Unavailable Unavailable Logs job_crag7kvtbd111tj
qwen38-flash-next-split Passed 67.7 14.2 Logs job_7s1q1djtzsprmqm

TPS describes the first response of each of three short scored smoke cases at concurrency 1; deterministic repeats are excluded. Each rate is total tokens / total server-reported phase time, not an average of request rates. Prefill excludes cached prompt tokens. These short samples include startup/warmup effects and are not sustained benchmarks or controlled speedup comparisons. Missing or invalid timings show as Unavailable.

Smoke checks cover GPU startup, deterministic endpoint repeats and bounded streaming. They do not establish an AgentX performance score. The General Inference lab retains native results and logs; GitHub evidence copies expire after 30 days.

The bindgen check failed on Linux because macOS libclang traverses the
blocklisted llama_sampler definition and emits its vtable internals as
dependents, while the CI libclang does not. Blocklist those types so
generation is identical on both, and commit the regenerated llama.rs.

Assisted-by: goose
@michaelneale
michaelneale merged commit 0558e33 into main Nov 20, 2026
38 checks passed
@michaelneale
michaelneale deleted the skippy/metal-placement-batching branch November 20, 2026 07:58
i386 added a commit that referenced this pull request Nov 20, 2026
Keep the placement and batching baseline from Skippy #71 and replay the nine remaining native patches against it. Integrate shared draft and verification scheduling while preserving the main branch's cache, stop-token, and GGUF admission behavior. Bump the ABI for the shared verify export.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants