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
4 changes: 2 additions & 2 deletions .agents/NOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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 | **fl2va COHERENT; ref2va NVFP4 grid DIAGNOSED (#95): NO loader bug** | weights/islands/RoPE all quant-noise-close to coherent GGUF; residual = community-NVFP4 quant fidelity §8.12 |
| Kimi-Linear-48B (KDA+NoPE-MLA+MoE) | bf16 knobs **106→120/128**, NOT STRICT (§14, `row/KIMI-LINEAR-STRICT-SPEED`); default OFF | residual = device islands; 1.30 tok/s |
| Kimi-Linear-48B (KDA/NoPE-MLA/MoE) | **`vt::KdaGatedDeltaRule` LANDED + GB10-MEASURED** (§15, `row/KIMI-KDA-DEVICE-KERNEL`): **106→122/128 + 1.35→4.24 tok/s (3.1×)**, beats §14's 120. OFF (122≠STRICT) | close p7: chunked-prefill/paged-MLA/incremental |
| 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 Expand Up @@ -67,7 +67,7 @@ throughput ⇒ audit the context; per-shape MEASUREMENT arbitrates).
into a lock or worktree+PR; operator merges PRs first and does features only via
sub-agents; helpers use worktrees on `row/<ROW-ID>` and open a DRAFT PR at the
START, which IS the claim. **W0-W5 LANDED**; role discipline ENFORCING,
`--require-role` is the DEFAULT. Queue: 10 rows (6 audit-vacated, LANDED gate anchors; READ before picking). Backfill: 79 rows, 30 anchored; blocker is claim FAMILIES.
`--require-role` is the DEFAULT. Queue: 10 rows; backfill 79 rows, 30 anchored.
**Upstream inventory** ([spec](specs/upstream-derived-inventory-2026-08-05.md),
drift-gated, arch parity BOTH ways): SM060/061/070 below vLLM's floor =
OUT-OF-SCOPE; COMP-*/DISTRIBUTED-* are REAL unported work; **all 362 archs now have rows**; llama.cpp's 11 extra devices are IN SCOPE, spike-gated
Expand Down
17 changes: 16 additions & 1 deletion .agents/benchmark-record.md
Original file line number Diff line number Diff line change
Expand Up @@ -14593,4 +14593,19 @@ Full 48.9B model on GB10 (sm_121a clean CUDA build, cutlass-4.5.0, 14 GDN AOT sy
FLIP LEDGER (deterministic golden arbitrates): the two levers interact — island bf16-input rounding fixes p2 but repeats p3; the bf16 residual stream (vLLM `fused_add_rms_norm` order) re-stabilizes p3. At 120/128 the SOLE divergence is p7 position 8 (golden deterministically `18705`, ours `58084`), a single near-tie that cascades to 8/16 on p7. Further precision-"matching" (output bf16, f32 accum) is a coin-flip that regresses — it is not vLLM's actual GDN-Triton/FA2 kernel arithmetic. Host-precision-matching PLATEAUS at 120/128.

VERDICT: NO arm STRICT (K=3-deterministic golden → STRICT required, not distributional); default STAYS OFF (parity-enablers). NAMED residual (= also the speed lever): the device islands — a NEW per-channel-decay GDN kernel (`g[T,H,D]`; `vt::GdnDecode`/`GdnPrefill` carry only per-head `g[T,Hv]`, ops.h:1797/1846 — NOT a drop-in) + paged `mla::ForwardMlaAttentionBlock` (FA2). Speed HW-forced-indirect: 1.30 tok/s (O(n²) recompute + host islands, invariant to the numeric knobs); vLLM cannot serve Kimi-Linear-48B at bf16 on one GB10 (oracle capture needed util 0.82 for a single-seq eager run) so a direct `vllm bench throughput` arm is infeasible. Row STAYS ACTIVE.
>>>>>>> origin/main

## 2026-08-07 — Kimi-Linear-48B: per-channel-decay KDA device kernel `vt::KdaGatedDeltaRule` — 106→122/128 AND 3.1× speed (the §14 residual, MEASURED on GB10)

The §14 named residual ("a NEW per-channel-decay GDN kernel `g[T,H,D]`; `vt::GdnDecode`/`GdnPrefill` carry only per-head `g[T,Hv]` — NOT a drop-in") was BUILT as the additive device op `vt::KdaGatedDeltaRule` (`row/KIMI-KDA-DEVICE-KERNEL`, #104) and MEASURED. Grounded 1:1 in FLA `fused_recurrent_gated_delta_rule_fwd_kernel` IS_KDA=True (`b_h *= exp(b_gk[None,:])` per-K-channel, `third_party/flash_linear_attention/ops/fused_recurrent.py:136-137` @ 555967922); the shared GDN kernels are untouched (`test_ops_gdn` 66/66·4242 on GPU). Unit-gate `test_ops_kda_recurrence` (broadcast-g == `vt::GdnPrefill` BIT-IDENTICAL; distinct per-channel vs f64 ref; CPU↔CUDA parity) 4/4·8 GREEN on the GB10 CUDA binary.

**Full 48.9B 128-token gate vs the §12 STRICT golden** (GB10 sm_121a, clean Release CUDA build, Triton-AOT vendored, cutlass-4.5.0; single-load per config; memory-safe: host RSS peak 1.7 GiB, min-avail 21 GiB, freed cleanly between configs, NO reboot):

| Config | env | /128 | tok/s |
|---|---|---|---|
| control (f64 host recurrence) | `VT_KIMI_DEVICE_COMPUTE=1` | 106 | 1.35 |
| **device-KDA** | `…DEVICE_KDA=1` | **122** | **4.24** |
| device-KDA + bf16 knobs | `…DEVICE_KDA=1 BF16_RESIDUAL BF16_ISLANDS` | 90 | 4.19 |

RESULT (the §14 thesis CONFIRMED): the device recurrence — vLLM's ACTUAL f32-on-bf16 arithmetic — moves **106→122/128** (prompts 0-6 all 16/16; only p7 diverges at pos-6, got `387` vs golden `11`, a comma near-tie) AND is **3.1× FASTER (1.35→4.24 tok/s)**. It beats BOTH the control (106) AND §14's host-precision best (120, which needed both bf16 knobs), and FIXES the p2 divergence the f64 host path had — because it runs the right arithmetic, not a coin-flip. The §14 bf16 knobs are now SUPERSEDED + COUNTERPRODUCTIVE: device-KDA + bf16 REGRESSES 122→90 (reintroducing p3's `163586×` repeat loop) — they were tuned to compensate for the f64 host island's over-precision. The speed win = the device recurrence kills the per-step host Download/f64-recompute/upload round-trip and runs the O(T²) recurrence in parallel on the GPU.

VERDICT: device-KDA (122/128, 4.24 tok/s) is the NEW BEST on BOTH axes but STILL a DIVERGENCE (STRICT required, K=3-deterministic golden) → `VT_KIMI_DEVICE_KDA` STAYS OFF (parity-enablers). The residual is now a SINGLE near-tie (p7 pos-6). NAMED next brick to STRICT (+ more speed): the KDA chunked-prefill kernel family (vLLM processes the PROMPT with `chunk_kda`, we still run the recurrent form — regen a Triton-AOT cubin for sm_121a via `scripts/regen-triton-aot.sh`, or a native `chunk_kda` port) + paged `mla::ForwardMlaAttentionBlock` for the 7 NoPE-MLA layers + paged-incremental decode (persistent KDA state + MLA-KV, kills the remaining O(n²)). Row STAYS ACTIVE.
83 changes: 83 additions & 0 deletions .agents/specs/kimi-linear.md
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,89 @@ rewrite, which is the SAME W7-speed residual. Scoped as the named follow-up, not

---

## 15. PER-CHANNEL-DECAY KDA DEVICE KERNEL LANDED (2026-08-07, `row/KIMI-KDA-DEVICE-KERNEL`)

The §14-named residual — "our `vt::GdnDecode`/`GdnPrefill` carry only a per-HEAD scalar decay
`g[T,Hv]`, so a NEW per-channel-decay GDN kernel (`g[T,H,D]`) is required" — is now IMPLEMENTED
as the additive device op **`vt::KdaGatedDeltaRule`**, the genuinely-net-new-vs-GDN primitive.

**Grounding (file:line, BOTH sides @ pin 555967922).** KDA's decode path REUSES the exact GDN
recurrence kernel — `fused_recurrent_kda` (`third_party/flash_linear_attention/ops/kda.py:109-146`)
calls `fused_recurrent_gated_delta_rule_fwd_kernel` with `IS_KDA=True`
(`ops/fused_recurrent.py:88-175`). The SOLE net-new numeric is the decay application: plain GDN
does `b_h *= exp(b_g)` (per-HEAD scalar, `fused_recurrent.py:132-134`), KDA does
`b_h *= exp(b_gk[None, :])` (per-K-CHANNEL, `:136-137`) — `g` is `[T,Hv,Dk]`, one log-decay per K
channel of the value head's `[Dv,Dk]` state, broadcast across the Dv rows. Everything else
(decay → predict → beta → rank-1 update → read-out, all `tl.float32` on bf16 loads) is byte-for-byte
GDN's recurrence. The op is thus GdnPrefill's per-channel twin; the shared GDN kernels are UNTOUCHED
(Qwen3.6 27B/35B gate byte-identical — `test_ops_gdn` 58/58·1825 unchanged).

**Implementation (ours, additive).** OpId `kKdaGatedDeltaRule` + `KdaGatedDeltaRuleFn`
(`include/vt/ops.h`); wrapper + per-channel-g validation (`src/vt/ops.cpp`); CPU
`KdaHeadTokenStep`/`KdaGatedDeltaRuleKernel` (`src/vt/cpu/cpu_ops.cpp`, GdnHeadTokenStep with a
per-`ki` decay vector); CUDA `KdaScanKernel` + `KdaGatedDeltaRuleKernelCuda` (`src/vt/cuda/cuda_gdn.cu`,
GdnScanKernel staging the per-K decay in shared memory, +1 dk-array). Both dual-registered CPU+CUDA.

**Unit gate (RED-first, `tests/vt/test_ops_kda_recurrence.cpp`) — 3/3·6 CPU-green:**
(1) EQUIVALENCE — with `g` broadcast from a per-head scalar, the per-channel op reduces
**BIT-IDENTICALLY** to the landed+gated `vt::GdnPrefill` (out & state exact-float-equal), tying the
net-new op to a proven reference with zero new numerics; (2) PER-CHANNEL — distinct per-channel
decay vs the from-first-principles f64 island reference (`KdaRecurrenceIsland` math) at documented
f32 tolerance (atol 1e-4, rtol 3e-3); (3) VALIDATION — rejects per-head `g` and unset scale; plus a
CPU↔CUDA parity case (GPU-pending). GDN untouched, `test_kimi_kda` 14/14, `test_kimi_linear_forward`
13/13·656 unchanged.

**Wiring (opt-in, default OFF).** `KdaRecurrenceIsland` (`kimi_linear_device.cpp`) gains a
`VT_KIMI_DEVICE_KDA` branch: q_n/k_n/v (already device-resident) feed `vt::KdaGatedDeltaRule` with a
fresh zero state + qsl=[0,T]; only the elementwise decay gate (`KdaDecayGate`) + beta = sigmoid(b)
stay host (numerically stable; the numerically-sensitive object is the RECURRENCE). Requires
`VT_KIMI_DEVICE_COMPUTE=1`. CPU whole-forward gate passes with the flag ON (`test_kimi_linear_forward`
13/13·656, f32 device recurrence within the forward's rtol 5e-3 vs the f64 ref) — the WIRING is
correct. Default OFF (parity-enabler) keeps the f64 host path as production.

**Why this is the STRICT path (spec §14 razor).** §14 proved host-precision-matching PLATEAUS at
120/128 because the f64 island is MORE precise than vLLM and coin-flips near-ties (f32-accumulation
knob regressed 120→91-106). This op runs vLLM's ACTUAL f32-on-bf16 recurrence arithmetic on device,
not a host approximation — the principled STRICT lever AND the speed lever (it is the per-step device
recurrence the paged-incremental-decode rewrite needs).

**GPU-VERIFIED + FULL-MODEL GATE MEASURED on GB10 (2026-08-07, sm_121a, clean Release CUDA build,
Triton-AOT vendored, cutlass-4.5.0).** Kernel GPU-verify: `test_ops_kda_recurrence` **4/4·8 GREEN**
on the CUDA binary (the CPU↔CUDA parity case confirms `KdaScanKernel` == the CPU kernel on Blackwell);
GDN untouched `test_ops_gdn` 66/66·4242; `test_kimi_kda` 14/14; 23 KDA symbols linked. Full 48.9B
128-token gate vs the §12 STRICT golden, single-load per config, memory-safe throughout (host RSS peak
1.7 GiB, min-avail 21 GiB, freed cleanly between configs, NO reboot):

| Config | env | /128 | tok/s | verdict |
|---|---|---|---|---|
| control (f64 host recurrence) | `DEVICE_COMPUTE=1` | 106 | 1.35 | reproduces §13/§14 baseline |
| **device-KDA** | `DEVICE_COMPUTE=1 DEVICE_KDA=1` | **122** | **4.24** | **NEW BEST on BOTH axes** |
| device-KDA + bf16 knobs | `…DEVICE_KDA=1 BF16_RESIDUAL BF16_ISLANDS` | 90 | 4.19 | REGRESSION (reverted) |

**RESULT (the §14 thesis CONFIRMED).** The device recurrence — vLLM's ACTUAL f32-on-bf16 arithmetic —
moves **106→122/128** (prompts 0-6 all 16/16; only p7 diverges at pos-6, `387` vs golden `11`, a comma
near-tie) AND is **3.1× FASTER (1.35→4.24 tok/s)**. It beats BOTH the control (106) AND §14's
host-precision best (120, which needed both bf16 knobs). It FIXES the p2 divergence the f64 host path
had — because it runs the right arithmetic, not a coin-flip. The §14 bf16 knobs are now SUPERSEDED and
COUNTERPRODUCTIVE (device-KDA + bf16 REGRESSES 122→90, reintroducing p3's `163586×` repeat loop) — they
were tuned to compensate for the f64 host island's over-precision; on the already-correct device
arithmetic they perturb the wrong way. The speed win is because the device recurrence kills the host
Download/f64-recompute/upload round-trip and runs the O(T²) recurrence in parallel on the GPU.

**Default + parity-enabler.** `VT_KIMI_DEVICE_KDA` STAYS OFF (122/128 is still a DIVERGENCE, not STRICT;
parity-enablers flip only with the token gate green). But the result reframes the residual: it is now a
SINGLE near-tie (p7 pos-6) and the recorded next brick is the clear path to STRICT + more speed.

**NAMED residuals to STRICT (the p7 near-tie).** vLLM processes the PROMPT with the CHUNKED prefill
kernel (`chunk_kda`), we still run the RECURRENT form over the whole sequence; and the 7 NoPE-MLA layers
still use a host f64 softmax island. Closing p7 needs (c) the KDA chunked-prefill kernel family +
(d) paged `mla::ForwardMlaAttentionBlock` for the NoPE-MLA layers + (e) paged-incremental decode
(persistent KDA state + MLA-KV) to kill the remaining O(n²) recompute (more speed still). Options for
(c) mirror-first: regen a Triton-AOT cubin from FLA's KDA kernels for sm_121a (`scripts/regen-triton-
aot.sh`), or a native `chunk_kda` port. Row STAYS `ACTIVE`.

---

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

## Scope
Expand Down
59 changes: 59 additions & 0 deletions .agents/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -40896,3 +40896,62 @@ Records: spec §14, STATUS/BENCHMARKS/FEATURES Kimi rows, benchmark-record, NOW.
fails to create. `sudo` on the host is the working path. No container was
holding the GPU (all exited), so nothing was stopped and nothing needed
restoring.

## 2026-08-07T12:30 — Kimi-Linear: per-channel-decay KDA device kernel `vt::KdaGatedDeltaRule` LANDED (the §14 STRICT+speed residual, one object)
<!-- state: 2026-08-07T12:30 -->
KIMI-KDA-DEVICE-KERNEL (`row/KIMI-KDA-DEVICE-KERNEL`, helper) — the §14 named residual ("`vt::GdnDecode`/
`GdnPrefill` carry only a per-HEAD scalar decay `g[T,Hv]`; a NEW per-channel-decay GDN kernel `g[T,H,D]`
is required") is now IMPLEMENTED as the additive device op `vt::KdaGatedDeltaRule`.

**Grounding (1:1, file:line both sides @ 555967922).** KDA decode REUSES the GDN recurrence kernel —
`fused_recurrent_kda` (kda.py:109-146) calls `fused_recurrent_gated_delta_rule_fwd_kernel` with
`IS_KDA=True` (fused_recurrent.py:88-175). The SOLE net-new numeric: GDN does `b_h *= exp(b_g)`
(per-HEAD scalar, :132-134), KDA does `b_h *= exp(b_gk[None,:])` (per-K-CHANNEL, :136-137) — `g` is
`[T,Hv,Dk]`, broadcast across Dv rows. Everything else (decay→predict→beta→rank-1→read-out, f32 on
bf16 loads) is byte-for-byte GDN's recurrence. Shared GDN kernels UNTOUCHED (`test_ops_gdn` 58/58·1825).

**Landed.** OpId `kKdaGatedDeltaRule` + Fn typedef + wrapper/validation (ops.h, ops.cpp); CPU
`KdaHeadTokenStep`/`KdaGatedDeltaRuleKernel` (cpu_ops.cpp, GdnHeadTokenStep with a per-`ki` decay
vector); CUDA `KdaScanKernel`/`KdaGatedDeltaRuleKernelCuda` (cuda_gdn.cu, GdnScanKernel + a 3rd
shared-mem dk-array for the per-K decay). Dual-registered CPU+CUDA.

**Unit gate RED-first (`tests/vt/test_ops_kda_recurrence.cpp`) 3/3·6 CPU-green:** (1) broadcast-`g`
== `vt::GdnPrefill` BIT-IDENTICAL (out+state exact float ==) — ties the op to a landed reference with
zero new numerics; (2) distinct per-channel vs the f64 island reference (atol 1e-4 rtol 3e-3);
(3) validation rejects per-head g + unset scale; (+CPU↔CUDA parity, GPU-pending). `test_kimi_kda`
14/14, `test_kimi_linear_forward` 13/13·656 unchanged (default AND with `VT_KIMI_DEVICE_KDA=1` on CPU).

**Wiring (opt-in OFF).** `KdaRecurrenceIsland` gains a `VT_KIMI_DEVICE_KDA` branch: device-resident
q_n/k_n/v feed `vt::KdaGatedDeltaRule` (fresh zero state, qsl=[0,T]); decay gate + beta stay host
(stable). Requires `VT_KIMI_DEVICE_COMPUTE=1`. Default OFF (parity-enabler) = f64 host path production.
env-doc: `VT_KIMI_DEVICE_KDA` + the two pre-existing H3 `VT_H3_ACT_*` documented (env-doc gate green).

**Why STRICT (the §14 razor).** §14 proved host-precision-matching PLATEAUS at 120/128 (f64 island is
MORE precise than vLLM, coin-flips near-ties; f32-acc knob regressed 120→91-106). This op runs vLLM's
ACTUAL f32-on-bf16 recurrence on device, not a host approximation — the principled STRICT lever AND
the per-step device recurrence the paged-incremental-decode speed rewrite needs.

**GPU-VERIFIED + FULL GATE MEASURED on GB10 (2026-08-07, sm_121a, clean Release CUDA build, Triton-AOT
vendored, cutlass-4.5.0).** Kernel GPU-verify: `test_ops_kda_recurrence` **4/4·8** on the CUDA binary
(CPU↔CUDA parity confirms KdaScanKernel == CPU kernel on Blackwell); `test_ops_gdn` 66/66·4242 (GDN
untouched); `test_kimi_kda` 14/14; 23 KDA symbols linked. Full 48.9B 128-token gate vs the §12 STRICT
golden, single-load per config, memory-safe (host RSS peak 1.7 GiB, min-avail 21 GiB, freed cleanly
between configs, NO reboot):

| config | env | /128 | tok/s |
|---|---|---|---|
| control (f64 host) | `DEVICE_COMPUTE=1` | 106 | 1.35 |
| **device-KDA** | `DEVICE_COMPUTE=1 DEVICE_KDA=1` | **122** | **4.24** |
| device-KDA + bf16 | `…DEVICE_KDA=1 BF16_RESIDUAL BF16_ISLANDS` | 90 | 4.19 |

**RESULT (§14 thesis CONFIRMED):** the device recurrence (vLLM's ACTUAL f32-on-bf16 arithmetic) moves
**106→122/128** (prompts 0-6 all 16/16; only p7 diverges pos-6, `387` vs golden `11`, a comma near-tie)
AND is **3.1× faster (1.35→4.24 tok/s)** — beats BOTH the control (106) AND §14's host-precision best
(120). It FIXES the p2 divergence the f64 path had (right arithmetic, not a coin-flip). The §14 bf16
knobs are now SUPERSEDED + COUNTERPRODUCTIVE (device-KDA + bf16 REGRESSES 122→90, reintroduces p3's
`163586×` repeat loop). Speed win = the device recurrence kills the host Download/f64-recompute/upload
round-trip and runs O(T²) in parallel on GPU. `VT_KIMI_DEVICE_KDA` STAYS OFF (122 is a DIVERGENCE, not
STRICT). Residual = the SINGLE p7 near-tie → the recorded next brick: KDA chunked-prefill family
(`chunk_kda`; regen a Triton-AOT cubin for sm_121a via `scripts/regen-triton-aot.sh`, or native port)
+ paged `mla::ForwardMlaAttentionBlock` (7 NoPE-MLA layers) + paged-incremental decode. Row `ACTIVE`.
Box left clean (artifacts removed, memory restored, worker parked, no reboot).
Loading