From ed0b8f433f887995b1ce361b15aaf9f6ca93483f Mon Sep 17 00:00:00 2001 From: zhaozx-cn <59479021+zhaozx-cn@users.noreply.github.com> Date: Mon, 19 Oct 2026 19:30:41 +0800 Subject: [PATCH] [Fix] [NPU] kimi-k3: skip fused gmm1 for situ activation in Ascend runner (#43837) --- python/sglang/kernels/ops/attention/mla_output_gate.py | 3 +++ python/sglang/srt/layers/moe/moe_runner/ascend.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/python/sglang/kernels/ops/attention/mla_output_gate.py b/python/sglang/kernels/ops/attention/mla_output_gate.py index 30634a3c4b..9b0ca7c2a7 100644 --- a/python/sglang/kernels/ops/attention/mla_output_gate.py +++ b/python/sglang/kernels/ops/attention/mla_output_gate.py @@ -12,11 +12,13 @@ from sglang.kernels.jit.utils import ( load_jit, make_cpp_args, ) +from sglang.srt.utils import is_npu if TYPE_CHECKING: from tvm_ffi.module import Module _THREADS: int = 256 +_is_npu = is_npu() @cache_once @@ -35,6 +37,7 @@ def covered(x: torch.Tensor, gate: torch.Tensor) -> bool: return ( x.is_cuda and gate.is_cuda + and not _is_npu and x.dtype == torch.bfloat16 and gate.dtype == torch.bfloat16 and x.shape == gate.shape diff --git a/python/sglang/srt/layers/moe/moe_runner/ascend.py b/python/sglang/srt/layers/moe/moe_runner/ascend.py index 082276784d..dfdef7b113 100644 --- a/python/sglang/srt/layers/moe/moe_runner/ascend.py +++ b/python/sglang/srt/layers/moe/moe_runner/ascend.py @@ -36,6 +36,8 @@ def _uses_fused_gmm1(kernel, config: MoeRunnerConfig) -> bool: # applied (NPUSwigluMxfp8Quant / NPUSwigluStepAndMul below). has_clamp = config.swiglu_limit is not None and config.swiglu_limit > 0 + if config.activation == "situ": + return False if not isinstance(kernel, (NPUMXFP8MoEMethod, NPUW4A8MXFP4MoEMethod)): return False if has_clamp: