Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/NOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Working head: `row/backend-rocm-w0` (#41). Prior: benchmark checkpoint
| f32-out GEMV audit | Only laguna + ds4 bf16 tower affected; gate models unaffected | Re-verify ds4 tower same-tool |
| Invocation-parity prevention | CI guard + checklist landing | Merge; build-verify `kGemvHeuristicAlgos` on dgx |
| MiniMax-H3 lane | **bf16 shards STREAM both towers (DiT + encoder); Q4_K_M enc cond cos 0.9975, 3.5° med, DIFFUSE** | render A/B on saved embeds |
| Kimi-Linear-48B | **Best: 122/128, 18.9 tok/s (0.90× vLLM); bf16 stream refuted; strict blocked by p7 near-tie** | ACTIVE: server fold + 0.10× |
| Kimi-Linear-48B | **ROW 7 fold LANDS (#122 §21): engine==CLI 128/128; golden 122/128; SACRED green; v13 tokens ABI** | ACTIVE: 19.0 tok/s vs vLLM ~21 (~0.90×) |
| 35B fresh grid | **BOUND** @`1ea26427`: 0.93-1.03x, c16 0.93x. INTAKE + Option A both NEGATIVE | Lever left: prefill glue (#61) |
| Qwen3.5-4B revalidation | 0.9971x @`59674cf1` (#35); TTFT/PSS pass, TPOT/ITL open | `docs/bench-evidence/` |
| MXFP4 parity | c1 1.020, c2-c8 0.962-0.969. **#82 CLOSED: ptxas-lineage REFUTED (A/B ties our+vLLM PTX all ptxas/JIT; +10us=engine context, not codegen)** | TERMINAL: at parity |
Expand Down
46 changes: 46 additions & 0 deletions .agents/benchmark-record.md
Original file line number Diff line number Diff line change
Expand Up @@ -15861,3 +15861,49 @@ busy) on the same grounds.
Decode is now **91.7 tok/s: 50% of the 182 tok/s roof, 1.75x off llama.cpp's
160.9**, from 8.59 at the start of the session.


## 2026-08-07 — ROW 7 Kimi-Linear runner fold: GB10 campaign (`row/KIMI-RUNNER-FOLD` #122)

Build: /dev/shm/kimifold, CUDA 121a, CUTLASS 4.5.0, FA2, Triton AOT sm_121a. Golden md5
`bfa5bdbf` (§12). flock $HOME/gpu.lock + /tmp/gpu, drop_caches per leg, worker parked,
min-avail >= 21G, no reboot. Engine legs: `kimi-linear-gen` thin ABI client
(`vllm_engine_load` + `vllm_complete_tokens`, max_model_len 4096) over
`~/kimi-linear-engine-dir` (snapshot symlinks + TikTokenConverter tokenizer.json).

| leg | config | /128 | steady tok/s | note |
|---|---|---|---|---|
| SACRED 35B | `test_qwen36_paged_engine` post-fold | 2/2·315 | — | PASS |
| SACRED 27B | `test_qwen27_paged_engine` post-fold | 1/1·235 | — | PASS |
| CLI reference | `test_kimi_linear_fold_gate`, §19 config | **122** | 18.93 (120 steps) | reproduces §19; p7 10/16 got == §19 |
| engine round 1 | FA2 unset (exact arm), pre-mirror-fix | 9 | 13.07 (16-step diff) | STALE HOST IDS (async device mirror) — root-caused, fixed |
| engine exact arm | post-fix, `VT_KIMI_PAGED_MLA_FA2=0` | 111 | 11.46 (16-step diff) | §19 M-tiling near-tie class: p7→16/16, p4 15/16, p2 token-1 cascade 0/16 |
| **engine FA2 arm** | post-fix (now DEFAULT) | **122** | 9.81 (16-step diff) | **p0-p6 16/16 + p7 got byte-equal CLI ⇒ engine==CLI 128/128** |
| engine FA2, N=64 | async sched | 122-profile (p0/p1 16/16) | **16.87** | two-length diff N=64 vs N=1 — the honest steady rate |
| engine FA2, N=64 | `VT_ASYNC_SCHED=0` | 122-profile | 16.11 | async is NOT the gap |
| default-bind | flipped-default binary, no env | **122** | 9.44 (16-step diff) | binds the shipped default |

Server smoke (`examples/server`, /v1/completions, converted tokenizer): STREAMED 48 tokens
in 2.52 s = 19.0 tok/s WALL (incl. prefill + first-request warmup — a lower bound on steady
decode); non-streamed haiku coherent; /v1/models lists the model.

Verdicts: Gate A engine==CLI 128/128 BYTE-IDENTICAL; golden >= 122 bound MET (122, same
profile). Speed: the SERVER 19.0 tok/s wall is the production-surface anchor (~0.90× the
#111 vLLM ~21 floor; CLI 18.93 reproduced) — NOT >= vLLM. MEASUREMENT CAVEAT: the example's
two-length diffs (N=64 16.9; N=16 9.8-11.5) run the LONG leg first and cold, so one-time
CUDA warmup pollutes the subtraction — the diffs UNDERSTATE steady decode; anchor on the
server wall (or run the short leg first / a warmup pass). Residual = per-step KDA host
islands (beta/g1 downloads + host decay gate per layer), grouped MoE via the shared seam,
decode graph. Exact-island arm kept as diagnostic (VT_KIMI_PAGED_MLA_FA2=0), its 111/128
recorded as the §19 M-tiling near-tie regime, not a bug.

vLLM same-session re-measure: ATTEMPTED and ABORTED BY BOX REBOOT. The leg (oracle venv,
util 0.82 — the #111-precedented config, no tracing, worker parked, 95G+ free at launch)
loaded all 20 shards and reached torch.compile/graph capture, then the box HARD-REBOOTED
at 00:25:32 (journal boot logs; min-avail had sat at the 15-17G floor during load). This
REPRODUCES the §19 finding that vLLM@0.82 + any additional pressure sits below the
life-critical floor on the 119G unified pool — per the safety mandate ("do not retry
higher", and now: do not retry AT 0.82 with compile/capture on), the leg is NOT retried.
The DENOMINATOR for this campaign therefore remains the #111 recorded floor (~21 tok/s,
16-token aggregate, same prompts/workload). Box recovered clean: single reboot, GPU
visible, local-ai-worker auto-restored by --restart=always; /dev/shm build tree gone
(campaign complete; all gate logs under $HOME).
2 changes: 1 addition & 1 deletion .agents/model-matrix.md

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions .agents/specs/kimi-linear.md
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,103 @@ campaign-completable to production quality; SCOPED here as the named born-on-run

---

## 21. ROW 7 — FOLDED ONTO THE SHARED PAGED RUNNER; engine==CLI 128/128 IDENTITY, golden 122/128 PROFILE PRESERVED (2026-08-07, `row/KIMI-RUNNER-FOLD`, #122)
<!-- state: 2026-08-07 -->
The §20.3-scoped production runner fold LANDS (ARCH-ONE-SURFACE ROW 7, task #281): Kimi-Linear's
decode runs THROUGH `ModelRegistry::Forward` on the runner's OWN paged state, the engine/server
serve it at the paged-incremental class of rate, and `examples/kimi_linear_gen` is a thin
public-ABI client (`vllm.h` + `vllm::shared`).

### The bricks (file:line)
- **B1 — KV enablement** (`src/vllm/transformers_utils/hf_config.cpp`): `LoadHfConfig` synthesizes
`layer_types` + the GDN-group geometry (`linear_num_key/value_heads`, `linear_key/value_head_dim`,
`linear_conv_kernel_dim`) from Kimi's nested `linear_attn_config` (configs/kimi_linear.py:34-148,
1-indexed `kda_layers`), so the §20.3 runner ABORT (the MambaSpec check against config-derived
{0,0},{0,0,0}) is gone and the per-layer loop allocates 20 KDA state groups + 7 MLA latent pages.
ADDITIVE: explicit-field configs (qwen3_5) never enter the branch; `runner.cpp` UNTOUCHED.
- **B2 — KDA-paged block** (`kimi_linear_device.cpp` `KdaLayerPagedBf16`): `vt::KdaChunkPrefill` for
fresh prefills (vLLM's prompt path; `VT_KIMI_PAGED_KDA_CHUNK=0` A/B) / `vt::KdaGatedDeltaRule`
(T==1) for decode + continuing prefills over the paged `gdn_state` group keyed by
`non_spec_state_indices` (GdnStateGather/Scatter); conv taps via `CausalConv1dFwd` (varlen) /
`CausalConv1dUpdate` (decode) in vLLM's `conv_state.chunk(3)` [q|k|v] row layout. NOT per-head
`GdnBlockPaged` — KDA's per-K-channel decay needs the KDA ops; the shared GDN kernels untouched.
- **B3 — NoPE-MLA-paged block**: latent rows written through `vt::ConcatAndCacheMla` at
`attn_meta.slot_mapping` (bf16 pages — vLLM's cache dtype; the KDA conv cache dtype now also
follows `ResolveKvCacheDType`, mirroring `kda_state_dtype`'s cache-dtype override). TWO arms:
**PRODUCTION = `mla::ForwardMlaAttentionBlock`** — vLLM's ACTUAL absorbed-MQA decode / FA2
prefill, identity-RoPE (cos=1/sin=0), scale qk^-0.5, load-time `AbsorbKvBProjBf16` into new
`MlaResidentWeights::w_uk_t/w_uv` (`VT_KIMI_PAGED_MLA_FA2`, default ON — GB10-ruled below); the
DIAGNOSTIC arm (`=0`) is the exact f64 softmax island over kv_b-up-projected paged rows, the
CPU fold-identity vehicle.
- **B4 — ONE SURFACE**: the registry loader loads the bf16-RESIDENT tower through the engine
(`ModelFactory::stage_on_load`: queue selected BEFORE the load — CUDA context first + per-tensor
stage-and-release, the §13 recipe; `model_loader.cpp` queue branch, additive); ENG-ASYNC-SCHED W4
honored (`ForwardPaged` embeds `device_token_ids` — the async device mirror leaves host ids
deliberately stale; missing this was a measured GB10 9/128 divergence, RED-first CPU-pinned);
`vllm_complete_tokens` (ABI v13) — pre-tokenized completion returning generated ids;
`examples/kimi_linear_gen` REWRITTEN as a thin `vllm.h` client; example-abi-allowlist kimi row
REMOVED (merged ratchet 8, with #123's two minimax removals); the CLI-incremental REFERENCE leg preserved as the env-gated
`tests/vllm/models/test_kimi_linear_fold_gate.cpp` (VT_KIMI_MODEL_DIR/VT_KIMI_GOLDEN_DIR).

### Gates (GB10 dgx.casa, /dev/shm CUDA build — CUTLASS 4.5.0 + FA2 + Triton AOT sm_121a; golden md5 `bfa5bdbf`; flock both locks, drop_caches, worker parked, min-avail ≥ 21G, NO reboot)
- **CPU**: `test_kimi_linear_paged` 8/8·206 — (a) runner allocates Kimi's het-KV groups from a REAL
config.json; (b) paged-runner tokens == CLI tokens (f32 AND production bf16 caches); (b2)
`ForwardPaged` logits BYTE-EQUAL the CLI logits at every step (real GDN builder; mutation-RED on
dropped ssm scatter / zeroed decode state / dropped conv scatter / dropped MLA cache write); (b3)
`device_token_ids` over stale host ids; shared-MLA-arm greedy == exact-arm greedy + f32-page
rejection; batched-prefill distinct KDA slots; (c) 2-request slot isolation. `test_hf_config`
17/17·180, `test_capi` 35/35·290 (ABI v13 case mutation-verified), full ctest **351/351**.
- **SACRED (re-run AFTER the fold, same build)**: 35B `test_qwen36_paged_engine` **2/2·315 PASS**;
27B `test_qwen27_paged_engine` **1/1·235 PASS** — the shared GDN/runner path is untouched.
- **Gate A — fold identity (the binding §20.3 gate)**: reference leg (CLI-incremental,
§19-winning config, via `test_kimi_linear_fold_gate`) reproduces §19 EXACTLY — **122/128 @
18.93 tok/s** (p7 10/16, got-string byte-equal to §19). Engine leg (thin ABI client →
`vllm_engine_load` + `vllm_complete_tokens`, FA2 arm): **ENGINE == CLI 128/128 BYTE-IDENTICAL**
— p0-p6 16/16 vs golden AND p7's full 16-token got-string equal to the CLI's
(`276,6315,7275,382,2512,2470,387,658,18705,58084,824,2234,397,73874,2366,16626`). vs the
golden: **122/128 — the SAME near-tie profile** (≥122 bound MET, no drop).
- **The FA2-default ruling (measured, 2 arms)**: FA2 arm 122/128 == the golden profile → DEFAULT ON
(vLLM's actual kernels + parity-enablers-ship-as-defaults). The diagnostic exact-island arm
measured **111/128** — the §19-documented GPU M-dimension-tiling near-tie class (re-up-projecting
the whole prefix at M=S vs the CLI's M=T append-time GEMM): p7 flips TOWARD golden (16/16!), p4
one flip that recovers, p2's token-1 flip cascades 0/16. NOT a paging bug (CPU byte-exact; FA2
shares every projection + cache write). Kept as the documented diagnostic arm.
- **The async-mirror catch (round 1)**: the first engine run DIVERGED 9/128 — `ForwardPaged`
embedded the host `token_ids` the DEFAULT-ON async device mirror deliberately leaves STALE for
decode rows. Fixed by honoring `device_token_ids` (the qwen3_5 DeviceTokenIdsScope contract);
CPU-pinned RED-first. Models outside qwen3_5/kimi still ignore this field — flagged as a
repo-wide audit residual.
- **SPEED**: the SERVER stream is the cleanest production-surface anchor — **48 tokens / 2.52 s =
19.0 tok/s wall** (including prefill + first-request warmup ⇒ a LOWER bound on steady decode),
i.e. the fold PRESERVES the §19 paged-incremental class (CLI reference 18.93 reproduced;
**~0.90× the #111 vLLM ~21 floor**). The example's two-length diffs read lower (N=64: 16.9
async / 16.1 sync; N=16: 9.8-11.5) because their long leg runs FIRST and cold — one-time CUDA
warmup pollutes the subtraction; recorded as a measurement caveat, not a regression. ≥ vLLM ~21
is still NOT met; the residual levers: device KDA decay gate + beta (kill the per-step host
islands ForwardPaged kept from the CLI), grouped MoE via the shared seam, decode CUDA graph.
- **Tokenizer enablement (server surface)**: Kimi ships tiktoken-only; converted to
`tokenizer.json` via `transformers` `TikTokenConverter` (encode round-trip verified vs the slow
remote-code tokenizer) — staged as `~/kimi-linear-engine-dir` (snapshot symlinks + the converted
tokenizer). A shippable-converter residual is noted.
- **Server smoke (`/v1/completions` through `examples/server`, the ONE-SURFACE deliverable)**:
PASS — model listed (`/v1/models`), STREAMED completion coherent ("The capital of France is" →
" Paris. The …", 48 tokens / 2.52 s = **19.0 tok/s streamed wall** — consistent with the CLI
18.93 class), non-streamed haiku coherent, greedy `finish_reason: length`, usage populated.
- **vLLM same-session re-measure: ABORTED — BOX REBOOT.** The #111-precedented config (oracle
venv, util 0.82, no tracing) loaded 20/20 shards then hard-rebooted the box at torch.compile/
graph capture (min-avail had sat at the 15-17G floor) — reproducing §19's measured box-safety
finding. NOT retried per the safety mandate; the denominator remains the #111 recorded ~21
floor (same prompts/workload). Box recovered clean; worker auto-restored.

### Status
Row `ACTIVE`: ROW 7 fold LANDED — engine/server surface serves Kimi via the shared paged runner at
122/128-profile fidelity; STRICT remains CLOSED (§20, intrinsic near-tie); the speed residual is
now the last open thread (server surface ~19.0 tok/s wall vs vLLM ~21, ~0.90×; levers: per-step
host-island removal (device decay gate + beta), MoE grouped GEMM through the shared seam, decode
CUDA graph).

---

## Structured contract (machine-readable — mirrors deepseek-v4-flash.md)

## Scope
Expand Down
16 changes: 10 additions & 6 deletions .agents/specs/surface-coverage-2026-08-07.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,23 @@ client. **ROW 1 UPDATE (2026-08-07): `parakeet_transcribe` is the SECOND clean A
client** — the Parakeet fold rewrote it against `vllm.h` + `vllm::shared` only, and the
ratchet fell 12 -> 11. **ROW 2 UPDATE (2026-08-08): `minimax_h3_gen` and
`minimax_h3_mux` are the THIRD and FOURTH clean ABI clients** (the video fold, ABI
v12 `vllm_video_*`), and the ratchet fell 11 -> 9. The remaining 9 reach
`include/vllm/**` / `vt/**` and are transition-tracked in
`scripts/example-abi-allowlist.txt`:

- Capability drivers: `deepseek_v4_gen`, `laguna_gen`, `kimi_linear_gen`, `server`.
v12 `vllm_video_*`), and the ratchet fell 11 -> 9. **ROW 7 UPDATE (2026-08-07):
`kimi_linear_gen` is the FIFTH clean ABI client** — the Kimi-Linear paged-runner fold
made the fast paged-incremental decode the ENGINE's production path, grew
`vllm_complete_tokens` (ABI v13, pre-tokenized completion returning generated token
ids) and rewrote the example against `vllm.h` + `vllm::shared` only; the ratchet fell
9 -> 8. The remaining 8 reach `include/vllm/**` / `vt/**` and are transition-tracked
in `scripts/example-abi-allowlist.txt`:

- Capability drivers: `deepseek_v4_gen`, `laguna_gen`, `server`.
- Dev/diagnostic (internal-by-nature, folded for consistency): `bench` (via
`bench_core.h`), `tokenize`, `dump_container`, `dequant_nvfp4`, `quant_gemm_bench`.
- Out of the gated `examples/` tree: `benchmarks/vulkan_gemm_ab.cpp` (Vulkan A/B harness).

**Policy (developer-directed 2026-08-07): no permanent exemptions.** Every allowlist entry
— drivers AND dev/diagnostic tools — is a transition-tracker pointing at a fold row; the
guard fails on any internal include not tracked, and a shrink-only ratchet
(`MAX_INTERNAL_REACHING`, 9 since ROW 2; 11 since ROW 1) means the count can only fall as folds land, never grow to
(`MAX_INTERNAL_REACHING`, 8 since ROW 7; 9 since ROW 2; 11 since ROW 1) means the count can only fall as folds land, never grow to
admit a new violation. The public header set is DERIVED from the CMake install rules
(exactly `include/vllm.h` today), not hardcoded. The guard catches BOTH breach vectors: a
`#include "vllm/..."|"vt/..."|"src/..."` AND a CMake `-I` grant into the internal tree
Expand Down
35 changes: 35 additions & 0 deletions .agents/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -42333,3 +42333,38 @@ the GB10 speed recipe must move to the seam. (3) Server-arm numeric deltas
disclosed above. (4) The CPU host-f32 GGUF arm is off the ABI (keep-quant is
the gated arm). (5) /v1/videos job/status/content stay VideoJobStore-served
(unchanged); no async-job C-ABI shape yet.

## 2026-08-08 — ROW 7: Kimi-Linear FOLDED onto the shared paged runner (engine==CLI 128/128; golden 122/128 profile; speed residual named)
<!-- state: 2026-08-08T05:00 -->
`row/KIMI-RUNNER-FOLD` (#122), ARCH-ONE-SURFACE ROW 7 / kimi-linear.md §20.3→§21, task #281.
The full digits and file:line map live in spec §21; the binding facts:

- **B1**: `LoadHfConfig` synthesizes `layer_types` + GDN geometry from `linear_attn_config`
(additive; `runner.cpp` untouched) — the §20.3 runner ABORT is gone.
- **B2/B3**: `KimiLinearModel::ForwardPaged` — KDA over the paged `gdn_state` group
(`KdaChunkPrefill` prefill / `KdaGatedDeltaRule` decode, conv in vLLM's chunk(3) layout);
NoPE-MLA latent through `ConcatAndCacheMla` with **`mla::ForwardMlaAttentionBlock` DEFAULT-ON**
(GB10-ruled: that arm reproduces the golden's 122/128 near-tie profile EXACTLY; the diagnostic
f64-island arm measured 111/128 = the §19 GPU M-tiling near-tie class, not a paging bug).
- **B4**: engine loads the bf16-resident tower (`stage_on_load`, §13 recipe);
`vllm_complete_tokens` (ABI v13 after the #123 video-v12 rebase); `kimi_linear_gen` = thin `vllm.h` client; allowlist kimi row removed (merged ratchet 8 with #123's two minimax removals);
CLI reference leg preserved as env-gated `test_kimi_linear_fold_gate`.
- **Gate A**: engine==CLI **128/128 BYTE-IDENTICAL** (p7 got-strings equal); vs golden **122/128**
(>=122 bound MET). SACRED re-run post-fold: 35B 315/315, 27B 235/235. CPU: paged suite 8/8·206
(logits byte-equal, mutation-verified ×4), ctest 351/351.
- **The async-mirror catch**: round-1 engine leg diverged 9/128 — ForwardPaged embedded the host
ids the DEFAULT-ON async device mirror leaves stale; fixed by honoring `device_token_ids`
(RED-first CPU pin). ★ AUDIT RESIDUAL: models outside qwen3_5/kimi still ignore this field —
any of them served on GB10 through the async engine would hit the same divergence.
- **SPEED (honest)**: server stream **19.0 tok/s wall** (48 tok incl. prefill+warmup — the
production-surface anchor) vs CLI 18.93 (reproduced) vs vLLM ~21 → ~0.90×, >= vLLM NOT met.
The example's two-length diffs (16.9 N=64; 9.8-11.5 N=16) ran the long leg first and cold, so
warmup pollutes the subtraction — measurement caveat recorded. Residual levers: device KDA decay
gate + beta (per-step host islands), grouped MoE via the shared seam, decode graph.
- **Tokenizer**: Kimi ships tiktoken-only; converted to tokenizer.json via transformers
TikTokenConverter (round-trip verified) → `~/kimi-linear-engine-dir` for the engine/server legs;
a shippable-converter residual is noted.
- **vLLM same-session re-measure: ABORTED BY BOX REBOOT** (util 0.82 + torch.compile/graph
capture pushed the unified pool below the floor at 00:25 — reproduces the §19 measured
box-safety violation; NOT retried per the safety mandate). Denominator stays the #111
recorded ~21 floor. Box recovered clean; worker auto-restored (--restart=always).
Loading
Loading