Repository navigation
Conversation
…and the short-conv, per-head gate and sandwich host twins
- `chain::linear::Ring { taps }`: rows = taps − 1 + the pass (14 at 7 taps), through `stores::conv_ring_rows`; the
delta and Mamba2 convs keep 4 taps through `DELTA_RING`. `ring_input` takes the ring's rows; its five callers pass
`RING_ROWS`, a move for every existing kernel.
- `RopeSpec.factors` (ggml's freq_factors, from `rope_freqs.weight`): the table and the reference cache divide theta
by factor i in ggml's order. A model without factors builds the same bits.
- Host twins in chain: `shortconv::short_conv` (C ⊙ conv(B ⊙ x) over the ring), `out_gate::out_gate` (Proj and
ProjHead), `residual::sandwich_add`, each with hand-derived cases.
- `stores::conv_ring_bytes`, used by the recurrent sizing and LFM3's place.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Verdict: MUST_FIX: ring_input gains a rows parameter that every caller sets to RING_ROWS, which is an element the change does not use now.
Must fix
1. ring_input takes rows, and no caller passes anything but RING_ROWS
crates/gpu/src/linear/mod.rs:108 adds the parameter. All 5 call sites pass RING_ROWS: conv.rs:147, mamba2.rs:311-313 and mamba2.rs:1113. The only other reader of a different ring size is the short-conv kernel, which is not in this diff (C2). The change edits three kernel bodies and widens an unsafe contract (rows > d >= 1) for a caller that does not exist yet.
Cost: C2 adds the parameter in the same commit as its first user, with its own gate. Until then the kernels stay as they were and the ptx-scan risk is zero.
Fix: revert the crates/gpu hunks (linear/mod.rs, linear/conv.rs, mamba2.rs) in this PR. ring_input keeps its 5 arguments and RING_ROWS.
Non-blocking
⚠ Host twins have no caller yet: crates/chain/src/shortconv.rs:29, out_gate.rs:22, residual.rs:21, RopeSpec::with_factors and Hparams::rope_factor_values are used by their own tests only. I read this as the stated staging (C2 gates compare against them), so I did not block. Name the C2 gate that calls each one in the PR body, or the twins have nothing that holds them to a kernel.
⚠ Second owner of the Proj gate rule: crates/chain/src/out_gate.rs:68 computes attn · sigmoid(g) with a finite check for Proj, as out_gate_host already does at crates/gpu/src/linear/out_gate.rs:158. They differ in the sigmoid (device polynomial vs libm) and in the failure (NaN value vs Err), so I did not call it a duplicate. State in the module doc which gate uses which, so the Proj kernel is not compared with two rules.
⚠ Tests pin the delta ring size three times: linear.rs:224-233 asserts RING_ROWS == 11 and CONV_ROWS == 3, and stores.rs:318 tests conv_ring_rows(4) == 11. gpu/src/arch/hybrid.rs:55 also asserts it at compile time. One owner of the number is enough; drop the delta constants from the Ring test.
Checked
- Duplicates: 14 new items checked. Hits:
out_gate_host(see ⚠ above); Metal'sring_rowsatcrates/metal/src/kernels/delta_geom.rs:17andPASS_ROWSat:11are an older second owner, outside this diff. dryer: 0 pairs. - Complexity: crapper flagged nothing.
- Silent failure: 9 sites followed (factors length and value,
Ring::new(0), non-consecutivepos, non-finite conv output, gate kind and length, non-finite sandwich input,epsrange, factor bytes count, absent table). Each is a named error or panic. A refusedshort_convorsandwich_addleaves its state as it was. - Tests: mutation check done for
Ring::before,Ring::rows, rope factor order and the YaRN blend, the per-head gate index, the conv tap order and the ring write range. Each has an assertion that turns red. - Rope: the division is
theta / ffbeforefreq_scale, as in ggml'srope_cache_init.RopeSpeclostCopy; every caller takes&RopeSpec, so none breaks. - Gates: no pin moved. Escape catalog: no match.
Notes
- The PR body has no
nvidia-smiline orjust gate-*output. Onlycanon-checkis named, on the maintainer's box.
Card check: needs-gpu. This pull request changes crates/gpu-deepseek41/src/params.rs, crates/gpu/src/linear/conv.rs, crates/gpu/src/linear/mod.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
…ds another; one owner pins the delta ring `ring_input`'s length argument had no caller passing anything but `RING_ROWS`, so the gpu hunks go back to main's; the short-conv kernel adds it with its first user. The `Ring` test no longer re-pins the delta constants `stores` and `hybrid.rs` already pin, and `out_gate`'s module doc names which gates read which host rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Verdict: CLEAN: the new commit reverts the ring_input change, and the earlier must-fix and ⚠ items are fixed or answered.
Since the last review
- Must fix 1 (
ring_inputtakesrows): fixed. crates/gpu/src/linear/mod.rs:107 has its 5 arguments again, and the 4 call sites inconv.rsandmamba2.rspass norows. The onlycrates/gpu*change left isfactors: Noneingpu-deepseek41/src/params.rs. - ⚠ Host twins have no caller yet: answered. The PR body names the C2 gate clause that uses each twin.
- ⚠ Second owner of the
Projgate rule: fixed. The module doc of out_gate.rs:9-11 now saysout_gate_hostkeeps theProjkernels and this rule is the LFM3 reference. - ⚠ Delta ring size pinned three times: fixed. The constants assertion is gone from the
Ringtest;gpu/src/arch/hybrid.rskeeps its compile-time check.
Checked
- Duplicates: the new commit adds no item. Its one new text is a doc paragraph naming
out_gate_host. - Complexity: crapper flagged nothing. dryer: 0 pairs.
- Silent failure: no new site in the new commit. The earlier 9 sites stay named errors or panics.
- Tests: the removed assertion pinned constants that the compile-time check in
hybrid.rsstill holds. TheRingrows case[(1, 0, 8), (3, 2, 10), (4, 3, 11), (7, 6, 14)]still turns red on ataps + PASS_ROWSmutant. - Gates: no pin moved. Escape catalog: no match.
Notes
- The PR body has no
nvidia-smiline orjust gate-*output. The change is host code only, and thecrates/gpukernels are unchanged, so no card run is needed for this verdict.
Card check: needs-gpu. This pull request changes crates/gpu-deepseek41/src/params.rs and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
What and why
LFM3 step C1: the common host owners the next kernels read, with no kernel change. The conv ring's length is named by its taps (
chain::linear::Ring{taps},stores::conv_ring_bytes; the CUDAring_inputkeeps its fixed ring until C2's short-conv kernel, its first other user, adds the length), RoPE takes ggml'sfreq_factors(RopeSpec.factors, fromrope_freqs.weight), and the short conv, the per-head output gate (OutGate::ProjHead) and the sandwich residual get host twins inchain, each tested against hand-derived cases.Release notes: internal — LFM3 does not run yet (C2 kernels and C3 body follow).
Code shape
lfm3/hparams.rsreads the factors;lfm3/place.rssizes the ring throughstores::conv_ring_bytes.cargo fmtandcargo clippyare clean on what I touched.Duplication found or removed: none. One line outside the LFM3 files:
gpu-deepseek41/src/params.rsnamesfactors: None.What I ran
crates/gpuchange remains (onlygpu-deepseek41/src/params.rsnamesfactors: None), so the PTX is main's.cargo test --lib: chain 43 passed, runtime 297 passed, model 592 passed; clippy on chain, runtime, model and gpu-deepseek41: 0 warnings.What holds the host twins to a kernel
Each twin is the reference of a C2 gate clause (
gate_lfm3_kernels, C2):shortconv::short_convfor the short-conv kernel,out_gate::out_gate(ProjHead) for the per-head gate argument ofattn_out_gate_sigmoid,residual::sandwich_addfor the sandwich residual node, andRopeSpec::with_factorswithHparams::rope_factor_valuesfor the factored rope table.Hardware
Host code only; the canon-check ran on the maintainer's box (sm_86).
🤖 Generated with Claude Code