[Perf][MoE] Use fused MiniMax2 routing with non-unit routed scaling (#58880)
Signed-off-by: zjy0516 <riverclouds.zhu@qq.com>
This commit is contained in:
@@ -167,6 +167,38 @@ def test_single_expert_group_with_non_unit_scale_uses_grouped_topk() -> None:
|
||||
assert isinstance(router, GroupedTopKRouter)
|
||||
|
||||
|
||||
def test_sigmoid_bias_routing_with_routed_scale_is_minimax2() -> None:
|
||||
"""FlashInfer's MiniMax2 routing applies routed_scaling_factor, so a
|
||||
non-unit scale (MiniMax-M3 uses 2.0) must not block fused routing."""
|
||||
router = create_fused_moe_router(
|
||||
top_k=4,
|
||||
global_num_experts=128,
|
||||
scoring_func="sigmoid",
|
||||
renormalize=True,
|
||||
routed_scaling_factor=2.0,
|
||||
e_score_correction_bias=torch.empty(128),
|
||||
)
|
||||
|
||||
assert isinstance(router, FusedTopKBiasRouter)
|
||||
assert router.routing_method_type == RoutingMethodType.MiniMax2
|
||||
|
||||
|
||||
def test_zero_expert_routing_is_unspecified() -> None:
|
||||
"""Zero experts are resolved in the router, so kernels with built-in
|
||||
routing must never be selected for them."""
|
||||
router = create_fused_moe_router(
|
||||
top_k=4,
|
||||
global_num_experts=128,
|
||||
scoring_func="sigmoid",
|
||||
renormalize=True,
|
||||
e_score_correction_bias=torch.empty(160),
|
||||
zero_expert_type="identity",
|
||||
num_logical_experts=160,
|
||||
)
|
||||
|
||||
assert router.routing_method_type == RoutingMethodType.Unspecified
|
||||
|
||||
|
||||
def setup_eplb_state(
|
||||
enable_eplb: bool, global_num_experts: int
|
||||
) -> EplbLayerState | None:
|
||||
|
||||
Reference in New Issue
Block a user