From 8416544ab07b000cf3b83f5c363754321757a01c Mon Sep 17 00:00:00 2001 From: McZyWu Date: Fri, 3 Jul 2026 15:10:41 +0800 Subject: [PATCH] [NPU] bugfix for Base class add mamba_track_indices parameter (#29999) --- .../npu/attention/ascend_hybrid_linear_attn_backend.py | 2 ++ .../hardware_backend/npu/quantization/fused_moe_method_npu.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/hardware_backend/npu/attention/ascend_hybrid_linear_attn_backend.py b/python/sglang/srt/hardware_backend/npu/attention/ascend_hybrid_linear_attn_backend.py index 3d1e7af81..3595682d5 100644 --- a/python/sglang/srt/hardware_backend/npu/attention/ascend_hybrid_linear_attn_backend.py +++ b/python/sglang/srt/hardware_backend/npu/attention/ascend_hybrid_linear_attn_backend.py @@ -132,6 +132,8 @@ class AscendMambaAttnBackendBase(MambaAttnBackendBase): seq_lens_cpu: Optional[torch.Tensor], num_padding: Optional[int] = None, in_capture: bool = False, + *args, + **kwargs, ): # out_graph passes seq_lens_cpu=None at capture; mirror the base guard. if seq_lens_cpu is None: diff --git a/python/sglang/srt/hardware_backend/npu/quantization/fused_moe_method_npu.py b/python/sglang/srt/hardware_backend/npu/quantization/fused_moe_method_npu.py index d3b18e727..2fed6d73a 100644 --- a/python/sglang/srt/hardware_backend/npu/quantization/fused_moe_method_npu.py +++ b/python/sglang/srt/hardware_backend/npu/quantization/fused_moe_method_npu.py @@ -284,7 +284,7 @@ def npu_fused_moe_without_routing_weights_bf16( # gmm1: gate_up_proj hidden_states = torch.ops.npu.npu_grouped_matmul( x=[hidden_states], - weight=[layer.w13_weight], + weight=[layer.w13_weight.transpose(1, 2)], split_item=2, group_list_type=group_list_type, group_type=0, @@ -297,7 +297,7 @@ def npu_fused_moe_without_routing_weights_bf16( # gmm2: down_proj hidden_states = torch.ops.npu.npu_grouped_matmul( x=[hidden_states], - weight=[layer.w2_weight], + weight=[layer.w2_weight.transpose(1, 2)], split_item=2, group_list_type=group_list_type, group_type=0,