Repository navigation
Conversation
…xer picks each step's keys), check_ctx opened past the dense window; gate_kimi_k3_dsa and gate_kimi_k3_place's K3.1 cases Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XgzWzhZmMb7Ec2SohqrR1A
…he key prefixes by the gguf constants (check-arch rule 3) Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017hHKUuNKmDeQ1U8ejz6LLC
…ach red on the box and reversed Base green: 30 clauses, 0 failed. Each patch applied alone, the gate run, the patch reversed (tree clean after each): - list-scale: 4 clause(s) red, first: list at 2049 rows: the score pass's query and weights the host's bits: no, the list the exact top-20 - list-relu: 5 clause(s) red, first: list at 2049 rows: the score pass's query and weights the host's bits: yes, the list the exact top-2 - list-next-head: 4 clause(s) red, first: list at 2049 rows: the score pass's query and weights the host's bits: yes, the list the exact top-2 - identity-shift: 7 clause(s) red, first: the run raised no fault: an unlabelled launch site cache_pos; sites raised in an unlabelled launch ( - fault-count-past-cache: 1 clause(s) red, first: fault a list entry 128 over a cache of 128 rows (the gather): nothing raised: FAIL - fault-nan-key: 1 clause(s) red, first: fault a key projection holding a NaN (the key launch): nothing raised: FAIL - refusals-pass-past-topk: 1 clause(s) red, first: refusal a pass whose last row sees 2049 keys: ran without a refusal: FAIL - fault-key-past-cache: 1 clause(s) red, first: fault a key position 128 over 128 key rows (the key launch): nothing raised: FAIL - key-bias: 3 clause(s) red, first: key: the 4096 rows the steps wrote vs the key kernel's host rule: 4096 rows differ in a bit: FAIL - identity-nsel: 1 clause(s) red, first: identity: positions 0 .. 2048 selected vs dense, bit for bit: 2046 differ (first at 1): FAIL Host tests (cargo test -p bloomery-model --lib arch::kimi_k3): 36 passed. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017hHKUuNKmDeQ1U8ejz6LLC
…dget pick; the fixture drops the copied split keys The derived K3.1 fixture copied the K3 fixture's split.tensors.count (107) and added the indexer's tensors (112 held): Split::open refused it. The clause then planned at the K3 file's budget plus the indexer's bytes, which left the tier card idle once the plan counted those tensors as dense. The budget is now split_table/pick_budget over the K3.1 inputs at DSA_CTX; the latent key rows and the slack sit in the stage budget and the prompt reserve alike. Box (A6000+3090, fixture tier): gate_kimi_k3_place 30 clauses, 0 failed. Mutant .mutants/k31dsa-pass-split-removed.patch (Batch::prompt passes every id): pass past top-k red, "a pass whose last row sees 24 keys; the indexer picks top_k 16", reversed (file equal to before). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XgzWzhZmMb7Ec2SohqrR1A
There was a problem hiding this comment.
Verdict: CLEAN: the selection reuses the common index-key/indexer/gather kernels, check_pass bounds the passes at both choke points before anything is enqueued, and the pass→step handoff is gate-verified; one coverage gap remains on a tool path.
Non-blocking
⚠ score_crossing has no gate clause: pass.rs:1437. The prompt split (Batch::prompt) is covered by gate_kimi_k3_place's pass past top-k clause and its mutant; the score split (generate --walk pass past top-k) runs in no gate here, the real K3.1 run deferred to the release batch. Plant the clamp mutant passed.min(total - n) → passed at pass.rs:1395: scored rows run as open passes, their logits never read, nothing turns red. Direction: one more leg of the place gate's K3.1 clause — --score --walk pass over ids crossing DSA_TOP_K against the stepped load — or a .mutants/ patch.
Optimization headroom
- E (less work): index.rs:56 — the indexer matrices sit resident F32, 29.75 MB a latent layer (714 MB a token at 24 layers, the card's derivation); Q8_0, a type
TYPESalready takes, is 7.90 MB a layer (~190 MB a token). - E (less work): latent_gated.rs:405 —
attend_selgathers the list's rows into a scratch and the flash reads them back: 2048 × 1152 B written and re-read a layer a token (~113 MB a token at 24 layers); a flash that walks the list against the cache removes the round-trip. - G (per-launch fixed cost): index.rs:290 — the step adds 7 launches a latent layer (168 a token, the card's c_node term); batching
pick's three projections into one launch removes ~48 a token.
Checked
Duplicates: dryer did not run; by Grep the 12 new items each have one owner, the key/score/gather kernels the common owners ml4 and ds41 already run. Complexity: crapper did not run; by hand the growth is even — small new functions, run_mixer and score_placed one delegated branch each, no kernel body split. Silent failure: 6 default sites followed (map_or no-indexer defaults are the K3 semantics, _ => Ok(()) the documented non-selecting pass, let _ = only the gate's temp cleanup). Tests: the 11 .mutants/ patches each name their expected-red line; the gap is score_crossing above. Gates: no pin or band moved; the removed check_ctx refusal is the PR's purpose, its rewritten tests carrying the reason; the new bin declares required-features = ["gpu"]. Escape catalog: none of C1–C4 matched (the justfile recipe has no pipes, substitutions or heredocs).
Notes
dryer and crapper both failed to run (ModuleNotFoundError), so duplication and complexity were checked by hand. The PR body carries the gate commands with output but not the nvidia-smi line nor both commit hashes, so it is not card evidence; the author notes the real K3.1 file past ctx 2048 runs in the release batch.
Card check: needs-gpu. This pull request changes crates/app/src/arch/kimi_k3/mod.rs, crates/gpu-gates/Cargo.toml, crates/gpu-gates/src/bin/gate_kimi_k3_dsa.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)
Kimi K3.1의 DSA(indexer가 고른 key만 attention) decode 경로 — 컨텍스트 2048(top-k) 초과를 엽니다.
What and why
K3.1's latent layers attend only the keys the gated indexer picks once the context passes its top-k. The decode step now runs that selection (score, list, gather) on the card, and
check_ctxno longer refuses a context past the dense window. A prompt runs as placed passes up to the top-k and steps the ids after it, since a pass attends every key.Release notes: Added — Kimi K3.1 runs contexts past 2048 (the indexer's top-k) with its selected attention.
Code shape
crates/gpu/src/{indexer,index_key}.rs, landed earlier); K3.1 uses them.cargo fmtandcargo clippyare clean; lint count unchanged.Duplication found or removed: none.
What I ran
Card line: RTX A6000 + RTX 3090 (sm_86), fixture tier.
tools/gate-batch.sh --tier fixtureoverjust affected main --fast:DONE total=51 red=1. The red wasgate-gpu-kimik3-place's new K3.1 clause (the fixture copied the K3 split keys; the clause planned at the K3 budget). Fixed in the last commit.just gate-gpu-kimik3-placeafter the fix: 30 clauses, 0 failed.gate-gpu-kimik3-dsa: green; 10 FAIL-first mutants (.mutants/k31dsa-*.patch), each red on the box and reversed (commit 9507da5 lists them)..mutants/k31dsa-pass-split-removed.patch:pass past top-kred with "a pass whose last row sees 24 keys; the indexer picks top_k 16", reversed.just remote-static main: rc 0.Not run here: the real K3.1 file past ctx 2048 (needs the real tier; it runs in the release batch).