From e1e97e8b4949bd9ec4b3b459b2e631f2410c4bc8 Mon Sep 17 00:00:00 2001 From: Ariel <32339430+arieller@users.noreply.github.com> Date: Sat, 26 Sep 2026 19:43:25 +0300 Subject: [PATCH] Pin triton_kernels num_warps for MXFP4 MoE below Hopper (6x gpt-oss decode on RTX 4090) (#41292) Co-authored-by: Claude Fable 5.1 --- python/sglang/srt/layers/quantization/mxfp4.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/sglang/srt/layers/quantization/mxfp4.py b/python/sglang/srt/layers/quantization/mxfp4.py index 12cbc62c0e..1d25a81feb 100644 --- a/python/sglang/srt/layers/quantization/mxfp4.py +++ b/python/sglang/srt/layers/quantization/mxfp4.py @@ -253,6 +253,10 @@ def _swizzle_mxfp4(quant_tensor, scale, num_warps): opt_flags.update_opt_flags_constraints(constraints) k_size = quant_tensor.shape[-1] * 2 # packed e2m1: 2 fp4 values per byte scale = _pad_hopper_mxfp4_scale(scale=scale, k_size=k_size) + elif get_platform().is_cuda and get_platform().device_capability < (9, 0): + # No scale layout carries the warp count below Hopper, and the tile + # formula gives the batch-1 decode tile a single warp. + opt_flags.update_opt_flags_constraints({"num_warps": num_warps}) # transpose the tensor so that the quantization axis is on dim1 quant_tensor = quant_tensor.transpose(-2, -1) scale = scale.transpose(-2, -1)