From 51f7ea84c794a747ef56a440e4fd44d6af075cc5 Mon Sep 17 00:00:00 2001 From: Michael <13900043+michaelzhang-ai@users.noreply.github.com> Date: Fri, 9 Oct 2026 14:22:19 +0800 Subject: [PATCH] [AMD] Keep MiniMax decode-score tile at 128 tokens off gfx950 (#42772) --- .../minimax_sparse/decode/flash_with_topk_idx.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/sglang/kernels/ops/attention/minimax_sparse/decode/flash_with_topk_idx.py b/python/sglang/kernels/ops/attention/minimax_sparse/decode/flash_with_topk_idx.py index c2fa2a8fdc..42ecd23da3 100644 --- a/python/sglang/kernels/ops/attention/minimax_sparse/decode/flash_with_topk_idx.py +++ b/python/sglang/kernels/ops/attention/minimax_sparse/decode/flash_with_topk_idx.py @@ -7,7 +7,7 @@ import triton import triton.language as tl from sglang.srt.environ import envs -from sglang.srt.utils import is_xpu +from sglang.srt.utils import is_gfx95_supported, is_xpu from ..common.utils import ( _bitonic_merge, @@ -39,8 +39,10 @@ _ON_HIP = torch.version.hip is not None def _decode_score_block_n(args): - # gfx950 pick: 512 for tiny batches (few CTAs), else 128. - return max(512 if args["batch_size"] <= 4 else 128, args["block_size"]) + # gfx950 pick: 512 for tiny batches (few CTAs), else 128. A 512-token bf16 + # K tile needs 128 KB of LDS, more than gfx942's 64 KB, so other archs keep 128. + small_batch = args["batch_size"] <= 4 and is_gfx95_supported() + return max(512 if small_batch else 128, args["block_size"]) # On ROCm the autotune sweep is replaced by a fixed config plus the