Repository navigation
research(decode): Lever B Phase-0 capture-stability probe — gated-GO on Increment-0 - #948
Merged
Merged
Conversation
Cheap, throwaway, #[ignore]d, UN-WIRED measurement probe answering the one load-bearing Lever B question on glm-4-9b-int4 (H200): can a fixed-shape padded M=K forward be CUDA-graph captured, replay ~1 dispatch/verify across KV bucket growth, and cost ~= one M=1 replay? Result by strict "PASS = all three": (b) PASS, (a) FAIL, (c) UNMEASURED -> NO-GO to an unconditional multi-week commit; GATED-GO on a cheap Increment-0. - (b) 1000 M=1 steps: captures=3 replays=994 invalidations=3 growths=2, 90.3 tok/s captured, no thrash. Capture machine stable across bucket growth. - (a) real M=K try_capture NotCapturable: [1,K,vocab] logits materialized + ~722 transient workspace allocs. Both are the missing Increment-0 build (persistent [1,K_max,vocab] logits binding + alloc-free M=K workspace + KV-symbol pin), not a kernel veto. - (c) blocked by (a). Eager proxy: M=1 13.5ms, M=8 91.5ms = 6.77x, a step function: M=1->M=2 cliff 66.9ms, near-flat M=2->M=8 tail 1.85ms/row. The cliff's composition (dispatch vs generic-GEMM+alloc) is the pivotal unknown Phase-0 could not resolve. M=8 logit readback 4.62MB (small). Recommend: fund Increment-0, re-run this probe for the decisive captured M=8-vs-M=1 replay number, then GO/NO-GO. If the ~80ms floor persists under capture, promote Lever A (Marlin, unconditional 1.3-1.6x) to primary. Adds: - native_decode/leverb_phase0_probe.rs (#[ignore]d probe, cfg-gated) - #[cfg(test)] leverb_phase0_capture_attempt + LeverBPhase0CaptureAttempt (cuda.rs) - #[cfg(test)] load_with_cuda_options_and_io_spec (load.rs) - docs/research/leverb-phase0-capture-probe.md (findings) - .squad/decisions/inbox/deckard-leverb-phase0.md (decision drop) None of the above is wired into any decode path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #948 +/- ##
==========================================
- Coverage 78.46% 77.81% -0.65%
==========================================
Files 354 354
Lines 148153 148153
Branches 148153 148153
==========================================
- Hits 116246 115287 -959
- Misses 27410 28372 +962
+ Partials 4497 4494 -3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…uda feature The leverb_phase0_probe module is #[cfg(all(test, feature = "cuda"))], but the LeverBPhase0CaptureAttempt struct and leverb_phase0_capture_attempt method it consumes were only #[cfg(test)]. Under the native-backend (non-CUDA) test build, they compiled with no consumer, tripping dead_code as clippy -D warnings in the 'Check the native backend compiles' CI step. Align their gate to the module's. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔴 Benchmark Regression DetectedComparison of criterion micro-benchmarks: PR head vs merge-base, measured on the same runner in the same job (base first → PR second).
Visual flags: Host infoWhat this cannot catch
|
justinchuby
added a commit
that referenced
this pull request
Aug 14, 2026
…→ NO-GO, promote Marlin (#949) Follow-up to #948. Built the 3 capture-enablement fixes Phase-0 identified (persistent padded `[1,K_max,vocab]` logits binding + alloc-free pre-capture warm forward + inherited KV-symbol pin) as a throwaway `#[ignore]`d, un-wired test overlay, then took the decisive measurement on glm-4-9b-int4 / H200 (reproduced 3×). **Criteria now:** - **(a) instantiates capture-safe → PASS.** M=8: `captured=true`, `capture_alloc=(0,0)`, `decline=None` (Phase-0's raw M=8 was NotCapturable). The recipe works. - **(b) stable replay across bucket growth → PASS** (unchanged). - **(c) captured M=K wall ≈ captured M=1 wall → FAIL.** Captured M=8 = **87.2 ms** vs captured M=1 = **10.2 ms** = **8.58×**. The ~80 ms floor persists *under capture*. **Smoking gun:** `segments=41` at M=8 vs `1` at M=1 — the M=K forward does NOT whole-graph capture. Every hot kernel opts out at query-width >1: `GroupQueryAttention[KernelCaptureUnsupported]×40`, `MatMulNBits×240`, `SkipSimplifiedLayerNormalization×80`. "Captured" M=K degrades to ~361 eager per-op relaunches — the dispatch-bound regime the lever meant to escape. **Verdict: NO-GO for Lever B. Promote Lever A (Marlin int4 relayout, unconditional 1.3–1.6×) to primary.** Lever B is gated behind a multi-family kernel-capture-support program (make GQA / MatMulNBits / SkipSimplifiedLayerNorm capture-safe at M>1); this exact probe can be re-run after that lands. Throwaway probe + docs + decision drop only; no pipeline wiring. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
justinchuby
added a commit
that referenced
this pull request
Aug 14, 2026
Scribe state-only batch: merged 2 decision drops (#948 leverb-phase0, #949 leverb-increment0) into decisions.md as the resolved 'Decode perf REOPENED — RESOLVED' section (Lever B tested and NO-GO, Marlin/Lever A promoted to primary — supersedes the #938 'build Lever B first' recommendation), archived older bodies to keep decisions.md under 50 KB (48,169 → 40,842 B), appended deckard history + logs. State-only; no code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
justinchuby
added a commit
that referenced
this pull request
Aug 14, 2026
…d behind Marlin (#957) ## Speculative decoding under CUDA-graph capture — feasibility (DESIGN-ONLY) Answers Justin's question — *"想办法把 speculative decoding 的 capture 做好?有办法吗?"* — with a concrete, honest staged path. **No kernels touched; adds one research doc + one decision drop.** ### Verdict: CONDITIONAL-GO, and the single condition is Marlin (Lever A) — which we are already building as the primary decode lever. - **Today (measured, #948/#949):** captured M=8 verify = **87.2 ms = 8.58× captured M=1 (10.2 ms)** ⇒ acceptance break-even **B\* = 8.5** ⇒ physically impossible ⇒ guaranteed loss (matches the settled speculative KILL). - **Root cause (code-grounded, no new GPU run):** the ~80 ms floor is **dominated by the 240 `MatMulNBits` generic 16×16 CUDA-core tiled GEMMs** — M>1 leaves the tuned fused int4 GEMV (`matmul_nbits.rs:4803-4869`). GQA (efficient flash) and norm (same kernel) live in the cheap 1.85 ms/row tail. - **Marlin is the enabler, not just a speedup:** static launch grid ⇒ capture-safe by construction (kills the 240 seams) + weights reused across the M rows ⇒ collapses the 67 ms cliff. **Estimated** post-Marlin verify ~12–20 ms ⇒ break-even **B\* ≈ 1.2–2.0**, cleared by prompt-lookup (B≈2–4) and EAGLE-3/MTP. - **Residual blockers after Marlin are cheap:** SkipSimplifiedLayerNorm = a `num_groups==1` **signature relaxation** (`normalization.rs:2306`); GQA = **pre-warmed fixed-M flash workspace** (`group_query_attention.rs:3099`). Not kernel rewrites. ### Staged plan with hard gates 1. **Marlin** (already primary; ref `docs/research/decode-remaining-levers-feasibility.md`) + a new "capture-safe at fixed M=K" contract item. 2. **GQA + norm M>1 capture-support** (the two cheap fixes) — gate: seam census collapses to ~1 segment. 3. **Re-run THIS Increment-0 probe** for the true post-Marlin captured M=K wall — **fund/kill gate: measured B\* ≤ ~2 ⇒ GO, ≳4 ⇒ NO-GO.** 4. **Only then** build the verify-graph + capture-stable KV-commit + near-tie guard + draft sources. ### Context - Refines (does not overturn) the settled **Lever B NO-GO** — #948 (Phase-0) / #949 (Increment-0). - Marlin scoping: `docs/research/decode-remaining-levers-feasibility.md`. - Portability (Rule 11): Marlin is SM-version-specific ⇒ arch guard + split-K fallback + degrade-to-disabled on non-Marlin tiers. H200/glm-4-9b-int4-scoped.⚠️ Design/research doc — no production code changed. A squad member should sanity-check the post-Marlin verify-wall estimate (clearly labeled as an estimate; Stage-3 measures it). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
justinchuby
added a commit
that referenced
this pull request
Aug 14, 2026
Scribe consolidation for the Marlin int4 GEMM program landing (#960/#961/#962). - Merge 5 decision inbox drops (deckard/pris/sebastian kernel+bench+numerics + chew/gaff reviews) into one consolidated Marlin program entry; corrected per-model attribution (glm block-128 → gate_up fusion no-op; 2.16× was the general split-K retune). - Archive resolved #957/#948/#949 spec-capture + Lever B entries to decisions-archive/2026-08.md (decisions.md 45,991 → 42,104 B, under the 50 KB gate). - Orchestration logs (deckard/sebastian/pris/chew/gaff), session log, cross-agent history updates; summarized sebastian history (>8 chronicle threshold). State-only change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase-0 de-risking probe for Lever B (capture-stable padded M=K verify), on glm-4-9b-int4 / H200. Throwaway
#[ignore]d un-wired microbench + findings doc + decision drop. No pipeline wiring.Three pass-criteria measured:
try_capture= NotCapturable because[1,K,vocab]logits materialized (binding is[1,1,vocab]) + 724 alloc/722 free transient workspaces at M=8. Both are the missing Increment-0 (persistent[1,K_max,vocab]logits binding + alloc-free M=K workspace + KV-symbol pin).Verdict: NO-GO to an unconditional multi-week Lever B commit; gated-GO on a cheap Increment-0 (days) — build the persistent logits binding + alloc-free workspace + KV pin, re-run this probe for the decisive captured-M=8-vs-M=1 replay number. If captured M=K ≈ M=1 → GO full build; if the ~80ms floor persists under capture → promote Lever A (Marlin, unconditional 1.3–1.6×) to primary.
Docs + probe + decision drop only.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com