[Bugfix][MiniMax-M3] Fix token-major top-k buffer handling in Triton … (#49149)

Signed-off-by: rongfu.leng <lenronfu@gmail.com>
This commit is contained in:
rongfu.leng
2026-07-25 06:45:27 -07:00
committed by GitHub
parent 1423569ff5
commit d1a8ba63d9
2 changed files with 13 additions and 3 deletions
@@ -384,7 +384,14 @@ class MiniMaxM3SparseTritonImpl(MiniMaxM3SparseImpl):
nd = main_md.num_decode_tokens
num_tokens = main_md.num_actual_tokens
# Indexer top-k from the shared buffer: decode [:, :nd], prefill [:, nd:].
topk = layer.topk_indices_buffer # type: ignore[attr-defined]
topk_buffer = layer.topk_indices_buffer # type: ignore[attr-defined]
assert topk_buffer is not None
topk = (
topk_buffer
if current_platform.is_rocm()
else topk_buffer[:num_tokens].transpose(0, 1)
)
assert topk is not None
hd = self.head_size
q = query[:num_tokens].view(-1, self.num_heads, hd)