← Back to Pull requests

Port native decode and shared speculative execution to standalone Skippy #9

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 17, 2026 07:31 UTC
Author

Summary

Share target verification and compatible DFlash draft forwards across independent requests, while retaining per-request sampling, checkpoints and repair. This PR layers the remaining native decode work onto main's earlier placement/batching/cache baseline from #71. It keeps llama.cpp pinned to 8954f194, uses native ABI 0.1.88, and leaves model/quantization inputs unchanged.

Review follow-up

  • Stop verification gathering when a barrier drains its queue. Interrupt direct gathering for speculative work and avoid an iteration pause while draft/verification work is ready.

  • Route speculative gather decisions through BatchPolicy, using the configured decode wait capped at 300 microseconds, and trace the waits. Compatible-lane packing remains unchanged for the separate selection/chunk-sizing work.

  • Replace the dflash-propose diagnostic-string barrier exception with an explicit operation kind.

  • Skip unchanged recurrent rows and use backend copies for non-overlapping moves. Keep gather-before-scatter for overlapping moves, cycles, fan-out and zeroing. Trace explicit helper staging bytes and duration.

  • Separate Metal diagnostic eligibility from measured defaults. M3 Ultra can exercise bounded u32 geometry; host-greedy and family-based row diagnostics are opt-in. Broader defaults remain unpromoted without measurements.

  • Backport main's existing deterministic telemetry test fix (f985bb5) so process-wide counter updates from parallel tests cannot invalidate its exact assertions.
  • Matched M3 Ultra pilot

    Candidate ab0dd87 versus pinned main 5008074, on the same 256 GB M3 Ultra, Qwen3.6-35B-A3B original GGUF and DFlash draft bytes, upstream pin and serving settings:

    | Serving mode | Main TPS | Candidate TPS | Change |
    | --- | ---: | ---: | ---: |
    | Plain, concurrency 1 | 94.84 | 99.56 | +4.97% |
    | Plain, concurrency 2, aggregate | 150.46 | 161.93 | +7.62% |
    | DFlash, concurrency 1 | 162.63 | 164.79 | +1.33% |
    | DFlash, concurrency 2, aggregate | 157.72 | 207.70 | +31.69% |

    A separate comparison against pre-fix PR head 1ebce5e measured concurrent DFlash at 205.70 → 208.07 TPS (+1.15%). The large main comparison includes all PR work; it is not attributable to these review fixes alone. Later follow-ups only wire the native test, backport the telemetry test fix, and record evidence.

    Each comparison/mode has one fresh-process campaign, three warmup cycles and three measured cycles, eight fixed prompts and a 128-token output budget. These are pooled HTTP serving rates including prefill. All accepted outputs match exactly, with zero prompt-cache hits; whole ABBA blocks with competing load or non-nominal thermals were rejected. The observations are provisional; no headline is promoted from a single campaign.

    Measurement job · Raw archives and SHA-256 manifest · Benchmark report and source identities

    Validation

  • Formatting and warning-denying all-target serving Clippy passed.

  • Full static serving suite: 1,374 passed, zero failures, with 32 opt-in tests ignored; documentation tests passed.

  • Native patch replay reproduced the tested native source. Focused CPU/Metal copy and rollback contracts passed. The M3 Ultra native job passed 40 routed native cases, 80 paired outputs, 160 FP64 oracle checks, both R8/R4 pipelines and peer GPU rollback modes 0/1/2/7. The new copy contract is included in routine native test builds.

  • All four downloaded raw campaigns were independently re-audited locally; rates, request membership, output hashes, token budgets, cache checks and interference exclusions match the remote audits.

  • The broad native replay timed out on skippy_graph_contract_glm4-expansion after 131 preceding passes. The replay/resume recorded 335 distinct native passes, with the opt-in resident-checkpoint long test skipped; this is not a clean full-replay pass.

  • Fresh GitHub validation passed on f45fcc1: binding freshness, lint, full tests and CI gate, plus all seven source-bound model configurations. PR checks and Inference qualification are green. Package/device-smoke jobs were not selected in this run and are not counted as passing qualification. CI fix #176 is merged and the author licensing declaration is confirmed. #9 remains open and unmerged.
  • The changed native recipe does not renew the split/family certification rosters. Keep release admission separate from experimental PR smoke.

    Historical performance

    Older tables remain source-pinned historical observations. Their large gains over the early standalone extraction are not gains over current main or isolated gains over Jared's work. Use the matched pilot above for the present comparison, with its single-campaign limitation.

    CI image repair

    Stacked PR CI inherited references to the retired ghcr.io/general-inference/skippy-ci- namespace. The quality job in the failed run was denied before it could execute checks. The affected compiler image references now use ghcr.io/mesh-llm/skippy-ci-, matching the repository’s published images.

    CI image validation

    actionlint .github/workflows/ci.yml, node --test .github/scripts/.test.cjs, and SKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just automation-contracts passed locally. These validate workflow syntax and offline contracts; fresh package and hardware checks remain pending in CI.

    Workflow diagrams

    The diagrams compare the live target branch with the proposed .github/workflows/ci.yml. Arrows show job dependencies; CPU-to-backend CLI artifact handoffs are labeled. Qualification/publication outside this workflow remains separately gated.

    Before

    flowchart TD
      trigger["pull_request, pull_request_target, push, schedule, workflow_dispatch, workflow_call"]
      pr_image_builds["pr_image_builds"]
      changes["Select checks by path"]
      automation["Automation checks"]
      plan["Validate build targets"]
      quality["Quality canary: resolved image"]
      native_contracts["Check llama.cpp Graph Contracts, patches, and API docs: resolved image"]
      package_darwin_aarch64_cpu["Build, package, and smoke · macOS ARM64 CPU"]
      package_darwin_aarch64_metal["Build, package, and smoke · macOS ARM64 Metal"]
      package_linux_x86_64_cpu["Build, package, and smoke · Linux x64 CPU"]
      package_linux_x86_64_cuda12["Build, package, and smoke · Linux x64 CUDA 12: resolved image"]
      release_smoke_linux_x86_64_cuda12["Release GPU smoke · Linux x64 CUDA 12"]
      package_linux_x86_64_cuda13["Build, package, and smoke · Linux x64 CUDA 13: resolved image"]
      package_linux_x86_64_rocm["Build, package, and smoke · Linux x64 ROCm: resolved image"]
      package_linux_aarch64_cpu["Build, package, and smoke · Linux ARM64 CPU"]
      package_linux_aarch64_cuda12["Build, package, and smoke · Linux ARM64 CUDA 12: resolved image"]
      release_smoke_linux_aarch64_cuda12["Release GPU smoke · Linux ARM64 CUDA 12"]
      package_linux_aarch64_cuda13["Build, package, and smoke · Linux ARM64 CUDA 13"]
      release_smoke_linux_x86_64_cuda13["Release GPU smoke · Linux x64 CUDA 13"]
      package_windows_x86_64_cpu["Build and verify archive · Windows x64 CPU"]
      package_windows_x86_64_cuda12["Build and verify archive · Windows x64 CUDA 12"]
      package_windows_x86_64_cuda13["Build and verify archive · Windows x64 CUDA 13"]
      package_windows_x86_64_rocm["Build and verify archive · Windows x64 ROCm"]
      package_linux_x86_64_vulkan["Build and verify archive · Linux x64 Vulkan"]
      package_windows_x86_64_vulkan["Build and verify archive · Windows x64 Vulkan"]
      smoke_linux_x86_64_vulkan_nvidia["Vulkan GPU smoke · Linux x64 · nvidia"]
      smoke_linux_x86_64_vulkan_amd["Vulkan GPU smoke · Linux x64 · amd: resolved image"]
      gate["gate"]
      trigger --> pr_image_builds
      trigger --> changes
      changes --> automation
      changes --> plan
      changes --> quality
      plan --> quality
      automation --> quality
      plan --> native_contracts
      quality --> native_contracts
      changes --> native_contracts
      plan --> package_darwin_aarch64_cpu
      quality --> package_darwin_aarch64_cpu
      plan --> package_darwin_aarch64_metal
      quality --> package_darwin_aarch64_metal
      package_darwin_aarch64_cpu -->|CLI artifact| package_darwin_aarch64_metal
      changes --> package_darwin_aarch64_metal
      automation --> package_darwin_aarch64_metal
      plan --> package_linux_x86_64_cpu
      quality --> package_linux_x86_64_cpu
      plan --> package_linux_x86_64_cuda12
      quality --> package_linux_x86_64_cuda12
      package_linux_x86_64_cpu -->|CLI artifact| package_linux_x86_64_cuda12
      package_linux_x86_64_cuda12 --> release_smoke_linux_x86_64_cuda12
      plan --> package_linux_x86_64_cuda13
      quality --> package_linux_x86_64_cuda13
      package_linux_x86_64_cpu -->|CLI artifact| package_linux_x86_64_cuda13
      plan --> package_linux_x86_64_rocm
      quality --> package_linux_x86_64_rocm
      package_linux_x86_64_cpu -->|CLI artifact| package_linux_x86_64_rocm
      plan --> package_linux_aarch64_cpu
      quality --> package_linux_aarch64_cpu
      plan --> package_linux_aarch64_cuda12
      quality --> package_linux_aarch64_cuda12
      package_linux_aarch64_cpu -->|CLI artifact| package_linux_aarch64_cuda12
      package_linux_aarch64_cuda12 --> release_smoke_linux_aarch64_cuda12
      plan --> package_linux_aarch64_cuda13
      quality --> package_linux_aarch64_cuda13
      package_linux_aarch64_cpu -->|CLI artifact| package_linux_aarch64_cuda13
      changes --> package_linux_aarch64_cuda13
      automation --> package_linux_aarch64_cuda13
      package_linux_x86_64_cuda13 --> release_smoke_linux_x86_64_cuda13
      plan --> package_windows_x86_64_cpu
      quality --> package_windows_x86_64_cpu
      plan --> package_windows_x86_64_cuda12
      quality --> package_windows_x86_64_cuda12
      package_windows_x86_64_cpu -->|CLI artifact| package_windows_x86_64_cuda12
      plan --> package_windows_x86_64_cuda13
      quality --> package_windows_x86_64_cuda13
      package_windows_x86_64_cpu -->|CLI artifact| package_windows_x86_64_cuda13
      plan --> package_windows_x86_64_rocm
      quality --> package_windows_x86_64_rocm
      package_windows_x86_64_cpu -->|CLI artifact| package_windows_x86_64_rocm
      plan --> package_linux_x86_64_vulkan
      quality --> package_linux_x86_64_vulkan
      package_linux_x86_64_cpu -->|CLI artifact| package_linux_x86_64_vulkan
      plan --> package_windows_x86_64_vulkan
      quality --> package_windows_x86_64_vulkan
      package_windows_x86_64_cpu -->|CLI artifact| package_windows_x86_64_vulkan
      plan --> smoke_linux_x86_64_vulkan_nvidia
      package_linux_x86_64_vulkan --> smoke_linux_x86_64_vulkan_nvidia
      plan --> smoke_linux_x86_64_vulkan_amd
      package_linux_x86_64_vulkan --> smoke_linux_x86_64_vulkan_amd
      changes --> gate
      automation --> gate
      plan --> gate
      quality --> gate
      native_contracts --> gate
      package_darwin_aarch64_cpu --> gate
      package_darwin_aarch64_metal --> gate
      package_linux_x86_64_cpu --> gate
      package_linux_x86_64_cuda12 --> gate
      package_linux_x86_64_cuda13 --> gate
      package_linux_x86_64_rocm --> gate
      package_linux_x86_64_vulkan --> gate
      package_linux_aarch64_cpu --> gate
      package_linux_aarch64_cuda12 --> gate
      package_linux_aarch64_cuda13 --> gate
      package_windows_x86_64_cpu --> gate
      package_windows_x86_64_cuda12 --> gate
      package_windows_x86_64_cuda13 --> gate
      package_windows_x86_64_rocm --> gate
      package_windows_x86_64_vulkan --> gate
      smoke_linux_x86_64_vulkan_nvidia --> gate
      smoke_linux_x86_64_vulkan_amd --> gate
      release_smoke_linux_x86_64_cuda12 --> gate
      release_smoke_linux_aarch64_cuda12 --> gate
      release_smoke_linux_x86_64_cuda13 --> gate
    

    After

    flowchart TD
      trigger["pull_request, push, schedule, workflow_dispatch, workflow_call"]
      changes["Select checks by path"]
      plan["Validate build targets"]
      quality["Quality canary: Mesh-LLM image"]
      native_contracts["Check llama.cpp Graph Contracts, patches, and API docs"]
      package_darwin_aarch64_cpu["Build, package, and smoke · macOS ARM64 CPU"]
      package_darwin_aarch64_metal["Build, package, and smoke · macOS ARM64 Metal"]
      package_linux_x86_64_cpu["Build, package, and smoke · Linux x64 CPU"]
      package_linux_x86_64_cuda12["Build, package, and smoke · Linux x64 CUDA 12: Mesh-LLM image"]
      release_smoke_linux_x86_64_cuda12["Release GPU smoke · Linux x64 CUDA 12"]
      package_linux_x86_64_cuda13["Build, package, and smoke · Linux x64 CUDA 13"]
      package_linux_aarch64_cpu["Build, package, and smoke · Linux ARM64 CPU"]
      package_linux_aarch64_cuda12["Build, package, and smoke · Linux ARM64 CUDA 12: Mesh-LLM image"]
      release_smoke_linux_aarch64_cuda12["Release GPU smoke · Linux ARM64 CUDA 12"]
      package_linux_aarch64_cuda13["Build, package, and smoke · Linux ARM64 CUDA 13: Mesh-LLM image"]
      release_smoke_linux_aarch64_cuda13["Release GPU smoke · Linux ARM64 CUDA 13"]
      gate["gate"]
      trigger --> changes
      changes --> plan
      changes --> quality
      plan --> quality
      plan --> native_contracts
      quality --> native_contracts
      plan --> package_darwin_aarch64_cpu
      quality --> package_darwin_aarch64_cpu
      plan --> package_darwin_aarch64_metal
      quality --> package_darwin_aarch64_metal
      package_darwin_aarch64_cpu -->|CLI artifact| package_darwin_aarch64_metal
      changes --> package_darwin_aarch64_metal
      plan --> package_linux_x86_64_cpu
      quality --> package_linux_x86_64_cpu
      plan --> package_linux_x86_64_cuda12
      quality --> package_linux_x86_64_cuda12
      package_linux_x86_64_cpu -->|CLI artifact| package_linux_x86_64_cuda12
      package_linux_x86_64_cuda12 --> release_smoke_linux_x86_64_cuda12
      plan --> package_linux_x86_64_cuda13
      quality --> package_linux_x86_64_cuda13
      package_linux_x86_64_cpu -->|CLI artifact| package_linux_x86_64_cuda13
      changes --> package_linux_x86_64_cuda13
      plan --> package_linux_aarch64_cpu
      quality --> package_linux_aarch64_cpu
      plan --> package_linux_aarch64_cuda12
      quality --> package_linux_aarch64_cuda12
      package_linux_aarch64_cpu -->|CLI artifact| package_linux_aarch64_cuda12
      package_linux_aarch64_cuda12 --> release_smoke_linux_aarch64_cuda12
      plan --> package_linux_aarch64_cuda13
      quality --> package_linux_aarch64_cuda13
      package_linux_aarch64_cpu -->|CLI artifact| package_linux_aarch64_cuda13
      package_linux_aarch64_cuda13 --> release_smoke_linux_aarch64_cuda13
      changes --> gate
      plan --> gate
      quality --> gate
      native_contracts --> gate
      package_darwin_aarch64_cpu --> gate
      package_darwin_aarch64_metal --> gate
      package_linux_x86_64_cpu --> gate
      package_linux_x86_64_cuda12 --> gate
      package_linux_x86_64_cuda13 --> gate
      package_linux_aarch64_cpu --> gate
      package_linux_aarch64_cuda12 --> gate
      package_linux_aarch64_cuda13 --> gate
      release_smoke_linux_x86_64_cuda12 --> gate
      release_smoke_linux_aarch64_cuda12 --> gate
      release_smoke_linux_aarch64_cuda13 --> gate
    

    Native cache validation

    The v1 shared Cargo/sccache inputs omitted the native patch recipe, allowing native artifacts from another source tree to be reused. Ported main’s source-bound dependency/extra-file identity and cold-build directory fix. Native patch edits/removals now invalidate dependency caches; Rust-only changes retain their permitted dependency reuse.

    SKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just automation-contracts and git diff --check passed on macOS ARM64, including the native-cache regressions. Fresh model/device qualification is pending on the new head.

    CI repair validation — 5fd7a54b49519b5da355358df700861067eb8d2f

    Merged main cc2a27435e798649a9cb938d600d39722e4a2263, including separate qualification queue/execution budgets and formation-bound peer/listener checks. Reconciled the native decode/speculative/Metal queue with llama.cpp 5bacb7c868a2bc98682de15f447fc1ce17c9c49c: branch core patches follow main as 0061–0070, and its ABI patch is model-support 0025. The routed-vector kernel rebase preserves 64-bit destination offsets.

    Updated the static/dynamic adapters for the three device-row functions now exported with C linkage. Native ABI 0.1.90, regenerated bindings, API reference and source-recipe identity agree. This avoids reusing ABI 0.1.89 already present on child APIs. Runtime bundles must be rebuilt for the new ABI/recipe; wire and model hash contracts are preserved.

    Completed validation:

  • Clean LLAMA_STAGE_BACKEND=cpu just llama-prepare replay; LLAMA_STAGE_BACKEND=cpu just skippy-ffi-bindgen; just --command cargo fmt --all; LLAMA_STAGE_BACKEND=cpu just --command cargo check --workspace --all-targets; LLAMA_STAGE_BACKEND=cpu just lint; and LLAMA_STAGE_BACKEND=cpu just test passed, including both Rust workspaces and integration/doc/native facade tests.

  • LLAMA_STAGE_BACKEND=cpu just skippy-ffi-bindgen-check passed.

  • SKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just llama-check completed its Metal native build, deterministic generated-family validation and API-reference check. Its 322-test native run recorded 321 passes and one optional long GPU checkpoint skip. That skip does not establish GPU/model qualification.

  • SKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just ci-automation, generated API documentation check and git diff --check passed. All-workflow actionlint passed with narrow local 1.7.12 exceptions for documented GitHub cache-mode and queue: max keys; repository lint rules were retained.
  • Fresh exact-head hosted checks and real-model/device qualification remain pending. Earlier performance measurements apply to their recorded sources, not this refreshed head. Contributor declarations remain unchanged.

    Split preparation rendezvous repair

    <!-- split-preparation-rendezvous-repair -->
    The follow-up to main's peer lifecycle improvements is included at c8d5a396ad1791242918ae3c06d3de5e61049ada. The failed #239 split attempt showed a late-starting peer remained invisible during model admission and stage planning. Control now exposes the matching formation/source/attempt in the preparing phase during those operations. Native-child readiness, listener ownership and completion evidence remain required; timeouts and qualification policy are unchanged.

    Validation for this head: git diff --check, just --command env PYTHONPATH=scripts /tmp/skippy-ci-repair/automation-venv312/bin/python scripts/tests/inference_peer.py (12 tests), and SKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just ci-automation all passed. The new real-loopback regression covers both roles and both preparation operations, rejects premature readiness, and verifies cleanup on preparation failure. Exact-head hardware qualification is pending CI.

    Acceptance criteria

  • I ran the relevant local checks, or explained why they do not apply.

  • I agree to license my contributions under the Apache License, Version 2.0.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Compatible concurrent requests can now share speculative draft generation and verification while keeping each request’s generation state independent.
    Added benchmark options for comparing shared verification, concurrent DFlash runs, and reference decoding, with throughput and timing reports.
    Added optional native draft readout and device-side feature processing, with fallback behavior when unavailable.
    Improved Metal decoding and recurrent-state handling.
    Documentation
    Expanded guidance for configuring shared execution, packaged native runtimes, and benchmark comparisons.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: jaredwy Review duration: 19644m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #9"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.7% · Safe to merge
    27.7%