[Fix] Route asymmetric-KV models to fa4 on SM100 and pin MiMoV2 FP8 MoE to flashinfer_trtllm (#32818)
This commit is contained in:
@@ -448,10 +448,21 @@ def _deepseek_family_overrides(server_args: Any, hf_config: Any) -> dict:
|
||||
# Keep in sync with MIMO_V2_MODEL_ARCHS (server_args.py / configs/hf_config.py).
|
||||
@_register_for("MiMoV2ForCausalLM", "MiMoV2FlashForCausalLM")
|
||||
def _mimo_v2_overrides(server_args: Any, hf_config: Any) -> dict:
|
||||
overrides: Dict[str, Any] = {}
|
||||
if server_args.speculative_algorithm == "EAGLE":
|
||||
logger.info("Enable multi-layer EAGLE speculative decoding for MiMoV2 model.")
|
||||
return {"enable_multi_layer_eagle": True}
|
||||
return {}
|
||||
overrides["enable_multi_layer_eagle"] = True
|
||||
|
||||
# On Blackwell "auto" falls through to the triton fused-MoE runner, ~12%
|
||||
# slower at bs=1 decode. FP4 checkpoints use flashinfer_mxfp4 instead.
|
||||
if (
|
||||
is_sm100_supported()
|
||||
and server_args.moe_runner_backend == "auto"
|
||||
and get_quantization_config(hf_config) == "fp8"
|
||||
):
|
||||
overrides["moe_runner_backend"] = "flashinfer_trtllm"
|
||||
logger.info("MiMoV2 FP8 on SM100: moe_runner_backend=flashinfer_trtllm.")
|
||||
return overrides
|
||||
|
||||
|
||||
@_register_for("MiniMaxM2ForCausalLM")
|
||||
|
||||
@@ -713,6 +713,17 @@ class ModelConfig:
|
||||
def linear_attn_registry_result(self) -> Any:
|
||||
return get_linear_attn_config(self.hf_config)
|
||||
|
||||
@property
|
||||
def has_asymmetric_kv(self) -> bool:
|
||||
"""Whether K and V rows differ in width (MiMoV2 is 192 / 128).
|
||||
|
||||
Not an ``__init__`` field because the MLA special-casing below still
|
||||
rewrites ``v_head_dim``.
|
||||
"""
|
||||
return (
|
||||
self.head_dim != self.v_head_dim or self.swa_head_dim != self.swa_v_head_dim
|
||||
)
|
||||
|
||||
def _detect_attention_sinks(self) -> bool:
|
||||
"""Check whether the model uses learned attention sinks.
|
||||
|
||||
|
||||
@@ -5565,6 +5565,10 @@ class ServerArgs:
|
||||
or self.speculative_eagle_topk is not None
|
||||
)
|
||||
):
|
||||
# trtllm_mha requires equal K/V row widths; fa4 carries
|
||||
# v_head_dim through.
|
||||
if model_config.has_asymmetric_kv:
|
||||
return "fa4"
|
||||
return "trtllm_mha"
|
||||
elif is_hip():
|
||||
return "aiter"
|
||||
|
||||
Reference in New Issue
Block a user