fix(mla): declare compressed decode row capacity - #125
Conversation
Co-authored-by: OpenAI Codex <codex@openai.com>
📝 WalkthroughWalkthroughCompressed MLA split planning now accepts an optional decode row capacity. The value is validated, propagated through scratch planning, applied to decode split selection, and covered by parameterized and CUDA-graph tests. ChangesCompressed MLA decode capacity
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant B12XCompressedMLAScratchCaps
participant compressed_mla_split_config_for_contract
participant DecodeSplitSelection
B12XCompressedMLAScratchCaps->>compressed_mla_split_config_for_contract: provide decode_row_capacity
compressed_mla_split_config_for_contract->>DecodeSplitSelection: apply computed decode row threshold
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/attention/test_attention_mla_compressed.py`:
- Around line 395-485: Add big-page-ID coverage to both compressed-MLA tests: in
tests/attention/test_attention_mla_compressed.py lines 395-485, update
test_declared_decode_capacity_matches_reference_under_graph_replay to use live
page IDs beyond the 2^31 / stride boundary while preserving CUDA Graph replay
and reference comparisons; in tests/attention/test_attention_mla_compressed.py
line 1332, add the equivalent deterministic replay coverage with live pages
beyond that boundary. Use deterministic indices and ensure both paths validate
correct outputs.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 866f705e-3392-4cec-9198-c49fd950de9e
📒 Files selected for processing (3)
b12x/attention/_shared/mla/compressed_config.pyb12x/attention/compressed_mla/_scratch.pytests/attention/test_attention_mla_compressed.py
R7 encoders choose K independently per (expert, projection). The mixed path tiers per expert -- one trellis_bits per tier for FC1 and FC2, a single-row descriptor -- so an expert that is K3-gate/K4-down cannot be expressed. - descriptor_map becomes int32[3 * stride], rows gate/up/down, same (tier << 8) | local encoding. Dispatch resolves the row per projection: FC2 at compile time, FC1 by N-half from output_n_tile, which trellis3_t256_proj keeps projection-aligned. - FC1 and FC2 expert counts may differ per tier. The FC2 count is derived from the W2 payload extent and carried through bounds, W2/global-scale logical layouts, compile arguments, and launches, so both phases keep real bounds and truthful CuTe extents. ABI_VERSION 6 -> 7. - build_tiered_maps() keeps its signature and repeats its single row three times, so existing per-expert mixed checkpoints resolve bit-identically. - New validated public builder build_projection_tiered_maps(); slot arity, range, disjointness and per-tier capacity are enforced. Based on the canonical r33 composition (master 9bbae67 + local-inference-lab#125, local-inference-lab#126, local-inference-lab#133, local-inference-lab#135, local-inference-lab#136, local-inference-lab#137), verified byte-identical to the r33 image kernel tree before these changes. CPU contract tests added; suite parity confirmed against the unmodified base (same 9 pre-existing GPU-dependent failures, 8 additional tests passing). Ruff clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Summary
This fixes compressed-MLA DSpark serving above r27's previously qualified C24
envelope for both K5 and K7. At MNS64, target verification can expose 384 rows
with K5 or 512 rows with K7, while the planner previously had a fixed 256-row
capacity. Capturing the larger workload could therefore overwrite graph-owned
split controls and corrupt later FULL graph replays, producing repetitive/BOS
output instead of a valid completion.
DSpark verifies
1 + draft_tokensrows per request. The integration suppliesthe maximum reachable row count; B12X owns the resulting planner and scratch
contract without changing legacy behavior at or below 256 rows.
Testing
ruff checkandruff format --checkpass for all three changed filesmax_abs <= 0.10, cosine>= 0.9995)No draft-depth default, reasoning template, kernel, or sampling behavior changes;
K5 remains the release default unless the separate K7 qualification succeeds.