[NPU] [bugfix] Fix import of ggml_moe_a8_vec and Fix NPU MLA HiCache backup accessing missing data_ptrs (#36640)

Co-authored-by: sglang-npu-bot <sglangnpu@163.com>
This commit is contained in:
chx96642264
2026-08-27 16:14:48 -07:00
committed by GitHub
co-authored by sglang-npu-bot
parent 5d52f02f22
commit 5640e53cab
2 changed files with 20 additions and 13 deletions
@@ -17,6 +17,7 @@ from sglang.srt.layers.moe.utils import RoutingMethodType
from sglang.srt.runtime_context import get_exec from sglang.srt.runtime_context import get_exec
from sglang.srt.utils import ( from sglang.srt.utils import (
is_flashinfer_available, is_flashinfer_available,
is_npu,
log_info_on_rank0, log_info_on_rank0,
set_weight_attrs, set_weight_attrs,
) )
@@ -380,7 +381,6 @@ def maybe_fuse_routed_scale_and_shared_add(
# alpha=scale)`. With no shared output, the missing scale is applied # alpha=scale)`. With no shared output, the missing scale is applied
# in-place. Otherwise `routed` is already scale-final and we just add # in-place. Otherwise `routed` is already scale-final and we just add
# `shared` (or pass through if there is none). # `shared` (or pass through if there is none).
from sglang.srt.layers.quantization.expert_pack import ExpertPackMoEMethod
from sglang.srt.layers.quantization.mxfp4_flashinfer_cutlass_moe import ( from sglang.srt.layers.quantization.mxfp4_flashinfer_cutlass_moe import (
Mxfp4FlashinferCutlassMoEMethod, Mxfp4FlashinferCutlassMoEMethod,
) )
@@ -388,15 +388,17 @@ def maybe_fuse_routed_scale_and_shared_add(
Mxfp4MarlinMoEMethod, Mxfp4MarlinMoEMethod,
) )
fused = isinstance( fused_methods = [
experts.quant_method,
(
Mxfp4FlashinferTrtllmMoEMethod, Mxfp4FlashinferTrtllmMoEMethod,
Mxfp4FlashinferCutlassMoEMethod, Mxfp4FlashinferCutlassMoEMethod,
Mxfp4MarlinMoEMethod, Mxfp4MarlinMoEMethod,
ExpertPackMoEMethod, ]
), if not is_npu():
) from sglang.srt.layers.quantization.expert_pack import ExpertPackMoEMethod
fused_methods.append(ExpertPackMoEMethod)
fused = isinstance(experts.quant_method, tuple(fused_methods))
if fused: if fused:
already_scaled = experts.should_fuse_routed_scaling_factor_in_topk already_scaled = experts.should_fuse_routed_scaling_factor_in_topk
if shared is not None: if shared is not None:
@@ -436,6 +436,11 @@ class MLATokenToKVPoolHost(HiSparseHostPoolMixin, HostKVCache):
) )
return return
if io_backend == "kernel_ascend":
# NPU pools use contiguous multi-layer tensors and intentionally do
# not build the CUDA-style data_ptrs array.
device_data_ptrs, device_kv_buffers = None, None
else:
device_data_ptrs, device_kv_buffers = self._resolve_device_transfer_buffers( device_data_ptrs, device_kv_buffers = self._resolve_device_transfer_buffers(
device_pool device_pool
) )