Repository navigation
Conversation
… 16] layout run(out=...) also accepts the permute(1, 0, 2) view of a contiguous [batch * Q, H, 16] tensor; the top-k kernel remaps each score row to that layout (out_groups), so callers no longer copy between the indexer and the Q8KV4 decode attention. Flagged by BatchDecodeIndexerWithPagedKVCacheWrapper.supports_head_minor_out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Q8KV4 decode indexer (
BatchDecodeIndexerWithPagedKVCacheWrapper.run) can now write its top-k directly in the layout the Q8KV4 decode attention reads.Today the two disagree:
[H, batch * Q, 16]top-k.attention.decode.q8kv4.BatchDecodeWithPagedKVCacheWrapperexpects a contiguous[batch * Q, H, 16]topk_indices.With more than one index head per rank (2 at TP2 for MiniMax-M3.1), every caller has to copy between the two layouts once per layer.
Changes
run(out=...)also accepts thepermute(1, 0, 2)view of a contiguous[batch * Q, H, 16]tensor. Contiguous[H, batch * Q, 16]outputs behave exactly as before._topk_select(..., out_groups=1): the top-k kernel maps score rowg * (rows / out_groups) + ito output rowi * out_groups + g. The default ofout_groups=1keeps the identity mapping and the existing launch paths.BatchDecodeIndexerWithPagedKVCacheWrapper.supports_head_minor_out = Truelets callers detect the feature.Tests
On B300 (CUDA 13.4):
tests/inference/msa_v1/indexer/_common/topk_selectandtests/inference/msa_v1/indexer/decode/q8kv4: 119 passed. That is the 117 existing tests plustest_head_minor_out_matches_contiguous_outfor 2 and 4 index heads, which checks bitwise equality against the contiguous output. The signature contract test now listsout_groups.Performance
The SGLang side is ispobock/sglang-minimax-collab#65, which ships this change as a patch on top of 1e7bf76 until it lands here.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.