[codex] Pad B12X sparse MLA decode heads - #5
voipmonitor wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR introduces decode-head block alignment to optimize kernel execution. A new constant parameterizes block-size padding, the decode head count is computed with alignment, the decode execution plan uses the padded count, and the query tensor is conditionally padded during kernel invocation before outputs are sliced back to the original dimensions. ChangesDecode-head padding optimization
🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)✅ Unit Test PR creation complete.
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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Note Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
|
✅ Created PR with unit tests: #6 |
|
Fixing this another way |
Summary
Pads the B12X sparse MLA decode plan/head dimension to an 8-head block and slices decode outputs back to the actual local head count.
Why
GLM-5.1 TP16 shards have only 4 local MLA heads per rank. The existing prefill/extend path already pads small head counts, but decode used the raw 4-head shard directly. That reproduced as coherent short outputs but eventual CJK/garbage corruption under longer/concurrent Estonia-style decode. TP8 has 8 local heads, so it does not hit this path.
The fix keeps the vLLM binding path eager and caller-scratch-owned:
plan.bind(scratch=...) -> binding -> kernel. It does not introduce b12x workspaces/arenas or cached workspace bindings.Validation
python3 -m py_compile vllm/v1/attention/backends/mla/b12x_mla_sparse.pygit diff --check -- vllm/v1/attention/backends/mla/b12x_mla_sparse.pyB12X_MLA_SPARSE+ B12X NvFp4 MoE and loggedPadding B12X_MLA_SPARSE decode heads from 4 to 8./mnt/test.py --port 5329 --model GLM-5.1-NVFP4-MTP --max-tokens 220returned coherent output withchinese_count=0.max_tokens=4096withtotal_cjk=0and no errors.Summary by CodeRabbit