probe: SDPA k_chunk_size scaling probe, landed unrun (#39) #89

Merged
Grok merged 4 commits from agy/issue-39 into master 2026-09-26 00:05:32 +02:00
Owner

Lands bench/probes/sdpa_k_chunk_scaling.py and .claude/skills/sdpa-k-chunk-probe/SKILL.md
as tooling only. The probe sweeps SDPA prefill k_chunk_size ∈ {64, 128, 256, 512} against
depths {4k, 16k, 32k, 128k} on the 1x2 Blackhole mesh with no model boot, to test whether larger
k_chunk cuts online-softmax rescale iterations (iterations = tokens_behind / k_chunk) enough
to beat the served path's fixed qk_chunk = 128, which was chosen at shallow context.

It has never been run. Not on silicon, not in the simulator. So it carries no
bench/runs record and gets no docs/LEDGER.md entry
, and it must not accrue one until
someone actually executes it — under D-2026-09-25-overhaul a probe that has not run closes
nothing. Both files say this at the top: the module docstring opens with an UNRUN: paragraph
and the skill leads with a Status: UNRUN TOOLING callout (and its description: front
matter is prefixed UNRUN tooling) so it cannot be picked up later and mistaken for evidence.
Everything the skill says about k_chunk_size is a hypothesis; only the motivating prefill
figures are measured.

Changes made while landing it. Both files cited docs/DIRECTIVES-LEDGER.md, which PR #68
removed — retargeted to docs/LEDGER.md. The skill's example output paths
(bench/runs/my-run.jsonl, bench/runs/sdpa-k-chunk-scaling-<timestamp>.jsonl) read as
evidence citations to scripts/check-cited-records.py and failed the gate as dangling; they are
now written as a shell variable and as prose naming the directory, with the file named but
explicitly flagged as not yet existing. The two real citations it makes — the
k_chunk_size=32 corruption in bench/runs/packed-verify.jsonl and the LoFi+fp32-acc
corruption in bench/runs/dspark-20260911T133340Z-lofi-fp32acc-bug.jsonl, both encoded as
fail-closed traps in the probe — resolve against real records.

Merged master in cleanly, no conflicts. Verified after: docs/ still 11 files, no root
CLAUDE.md, AGENTS.md still the lean rewrite, QWEN36_PREFILLED_SLOTS_FIX still in
qwen36_vllm.py, nothing PR #68 deleted came back, and the only two files added versus master
are the probe and the skill. check-cited-records.py passes.

Refs #39.

🤖 Generated with Claude Code

Lands `bench/probes/sdpa_k_chunk_scaling.py` and `.claude/skills/sdpa-k-chunk-probe/SKILL.md` as **tooling only**. The probe sweeps SDPA prefill `k_chunk_size` ∈ {64, 128, 256, 512} against depths {4k, 16k, 32k, 128k} on the 1x2 Blackhole mesh with no model boot, to test whether larger `k_chunk` cuts online-softmax rescale iterations (`iterations = tokens_behind / k_chunk`) enough to beat the served path's fixed `qk_chunk = 128`, which was chosen at shallow context. **It has never been run.** Not on silicon, not in the simulator. So it carries **no `bench/runs` record and gets no `docs/LEDGER.md` entry**, and it must not accrue one until someone actually executes it — under `D-2026-09-25-overhaul` a probe that has not run closes nothing. Both files say this at the top: the module docstring opens with an `UNRUN:` paragraph and the skill leads with a **Status: UNRUN TOOLING** callout (and its `description:` front matter is prefixed `UNRUN tooling`) so it cannot be picked up later and mistaken for evidence. Everything the skill says *about* `k_chunk_size` is a hypothesis; only the motivating prefill figures are measured. **Changes made while landing it.** Both files cited `docs/DIRECTIVES-LEDGER.md`, which PR #68 removed — retargeted to `docs/LEDGER.md`. The skill's example output paths (`bench/runs/my-run.jsonl`, `bench/runs/sdpa-k-chunk-scaling-<timestamp>.jsonl`) read as evidence citations to `scripts/check-cited-records.py` and failed the gate as dangling; they are now written as a shell variable and as prose naming the directory, with the file named but explicitly flagged as not yet existing. The two real citations it makes — the `k_chunk_size=32` corruption in `bench/runs/packed-verify.jsonl` and the LoFi+fp32-acc corruption in `bench/runs/dspark-20260911T133340Z-lofi-fp32acc-bug.jsonl`, both encoded as fail-closed traps in the probe — resolve against real records. Merged master in cleanly, no conflicts. Verified after: `docs/` still 11 files, no root `CLAUDE.md`, `AGENTS.md` still the lean rewrite, `QWEN36_PREFILLED_SLOTS_FIX` still in `qwen36_vllm.py`, nothing PR #68 deleted came back, and the only two files added versus master are the probe and the skill. `check-cited-records.py` passes. Refs #39. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
What was believed:
That qk_chunk=128 was universally optimal for prefill SDPA based on shallow
measurements (tp.py:776: "128 beats 256"). At shallow context, smaller chunks
minimize padding overhead and DRAM transfer latency.

What the evidence changed:
Prefill throughput collapses from 3,534 tok/s at 16k to 2,366 at 128k and 1,707
at 256k (directives ledger). The 16 attention layers are the sole context-scaling
ops during prefill. At deep context (32k, 128k, 256k), online-softmax performs
tokens_behind / k_chunk rescale iterations. Doubling k_chunk to 256 or 512
halves or quarters those passes, potentially saving substantial wall-clock time
at our target agent shapes (4x256k / 8x128k).

This adds a standalone no-model single-op probe bench/probes/sdpa_k_chunk_scaling.py
to measure k_chunk in {64, 128, 256, 512} across chunk depths {4k, 16k, 32k, 128k}
on Blackhole 1x2 mesh (Qwen3.8-27B TP=2, head_dim=256, bf8 paged KV cache).
Enforces fail-closed guards against known corruptions (k_chunk=32 and LoFi+fp32_dest_acc),
supports preflight compilation/import-checks without hardware, and records structured
results to bench/runs/*.jsonl. Documented in .claude/skills/sdpa-k-chunk-probe/SKILL.md.

Co-Authored-By: Gemini 3.8 Flash via agy <noreply@google.com>
probe(sdpa): k_chunk_size scaling probe and skill, explicitly unrun (#39)
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 6s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 24s
5aef31b8cb
Lands bench/probes/sdpa_k_chunk_scaling.py and .claude/skills/sdpa-k-chunk-probe as
tooling only. The probe has never been executed on silicon or in the simulator, so it
carries no bench/runs record and gets no docs/LEDGER.md entry; both files say so at the
top. Dead docs/DIRECTIVES-LEDGER.md references retargeted to docs/LEDGER.md, and the
example output paths no longer look like citations to scripts/check-cited-records.py.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
merge master into agy/issue-39
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 6s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 23s
81484db1ab
Grok merged commit 5e53df2f3e into master 2026-09-26 00:05:32 +02:00
Author
Owner

agent-gateway closeout (merged): cleared agent:* labels.
Hermes kanban card (if any) is left for Hermes to archive/complete.

agent-gateway closeout (merged): cleared `agent:*` labels. Hermes kanban card (if any) is left for Hermes to archive/complete.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitpartner/tt-stack!89
No description provided.