Repository navigation
Conversation
With one KV split, the BF16 QH64 and QH128 stage-1 kernels write the output but not the per-split LSE, so mla_decode_fwd(return_lse=True) returned uninitialized memory as the LSE. Use two splits in that case so that stage 2 merges the partials and writes the natural-log LSE. Add op_tests/test_mla_decode_lse_single_split.py, which checks the output and the LSE against a torch reference for 1, 2 and 8 splits. Co-authored-by: Claude Signed-off-by: Markus Hartikainen <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
…E guard, DCP merge profiling - Reject DCP with sinks on direct impl construction. - Route DCP ragged (no-LSE) calls through AITER head buckets; on gfx950 FP8 pads 32 heads to 64 and runs 64 natively. - Force at least 2 KV splits for BF16 64/128-head LSE decode (ROCm/aiter#6971). - Run the DCP top-k merge in the indexer profiling branch so the memory profile covers its temporaries. - Tighten the GLM-5.2-MXFP4 PCP GSM8K configs to 0.92 / 0.02. - Add DCP merge, sharded attention and mixed PCP+DCP tests. Co-authored-by: Claude <[email protected]> Signed-off-by: Andreas Karatzas <[email protected]>
Motivation
mla_decode_fwd(..., return_lse=True)returns uninitialized memory as the LSE when the non-persistent decode runs with one KV split, BF16 Q and KV, and 64 or 128 heads. The output is correct, but the LSE is not. Decode context parallelism in vLLM merges partial attention across ranks by this LSE, so the merged output is wrong.get_meta_parampicks one split once the batch fills the GPU, and callers can also passnum_kv_splits=1.Measured on MI355X (gfx950) with AITER 0.1.26,
kv_lora_rank512, rope 64, BF16, against a torch reference:Technical Details
With one split, the BF16 QH64 and QH128 stage-1 kernels write the final output into the FP32 partial buffer and leave the per-split LSE unset, so the stage-2 merge has no LSE to reduce. When
return_lseis set and the shape is BF16 with 64 or 128 heads,mla_decode_fwdnow uses two splits. Stage 2 then merges the two partials into the same output and writes the natural-log LSE. Withoutreturn_lse, and for every other shape, nothing changes.The existing
fp32_single_split_lsepath for gfx1250 FP8 QH64 does not help here. Requesting FP32 partials with one split still leaves the stage-1 LSE unset for these kernels on gfx950.Test Plan
op_tests/test_mla_decode_lse_single_split.py: BF16,nhead16, 32, 64, 128, batch 1, 4, 64, KV length 100 and 2,048,num_kv_splits1, 2, 8, against a torch reference for both the output and the LSE.get_meta_paramitself pick one split.Test Result
nhead64 and 128 case with one split) and all pass after it.The test skips
nhead32 with more than one split when a split gets a short ragged KV tail. That case returns a wrong output and LSE before and after this change, so it is a separate defect.Submission Checklist
This change was prepared with AI assistance (Claude). I reviewed every line and ran the tests above.