Skip to content

Commit 8a1ec76

Browse files
committed
[MoE] Test masked SITU with DeepEP v2
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: mgoin <mgoin64@gmail.com>
1 parent d3c0239 commit 8a1ec76

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

tests/kernels/moe/test_deepep_v2_moe.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ def _deep_ep_v2_moe_cudagraph(
424424
w1_scale: torch.Tensor | None,
425425
w2_scale: torch.Tensor | None,
426426
moe_backend: str,
427+
activation: MoEActivation,
427428
):
428429
"""Verify DeepEP v2 with an explicit FP8 expert backend."""
429430
import tempfile
@@ -512,6 +513,7 @@ def _deep_ep_v2_moe_cudagraph(
512513
w2_scale=qw.w2_weight_scale,
513514
quant_dtype=torch.float8_e4m3fn,
514515
block_shape=block_shape,
516+
activation=activation,
515517
)
516518

517519
# EP-slice before format conversion
@@ -528,7 +530,13 @@ def _deep_ep_v2_moe_cudagraph(
528530
experts_per_token=config.topk,
529531
hidden_dim=hidden_size,
530532
intermediate_size=config.n,
533+
activation=activation,
531534
)
535+
if activation == MoEActivation.SITU:
536+
moe_config = dataclasses.replace(
537+
moe_config,
538+
activation_situ_beta=1.0,
539+
)
532540
moe_parallel_config = dataclasses.replace(
533541
moe_config.moe_parallel_config,
534542
ep_size=pgi.world_size,
@@ -616,7 +624,7 @@ class activation:
616624
w2=w2_ep,
617625
topk_weights=test_tensors.topk_weights,
618626
topk_ids=test_tensors.topk,
619-
activation=MoEActivation.SILU,
627+
activation=activation,
620628
global_num_experts=config.num_experts,
621629
expert_map=expert_map,
622630
apply_router_weight_on_input=False,
@@ -637,7 +645,18 @@ class activation:
637645
@pytest.mark.parametrize("num_experts", [32])
638646
@pytest.mark.parametrize("topk", [6])
639647
@pytest.mark.parametrize("world_dp_size", [(2, 1)])
640-
@pytest.mark.parametrize("moe_backend", ["flashinfer_trtllm", "humming"])
648+
@pytest.mark.parametrize(
649+
("moe_backend", "activation"),
650+
[
651+
pytest.param(
652+
"flashinfer_trtllm",
653+
MoEActivation.SILU,
654+
id="flashinfer_trtllm-silu",
655+
),
656+
pytest.param("humming", MoEActivation.SILU, id="humming-silu"),
657+
pytest.param("humming", MoEActivation.SITU, id="humming-situ"),
658+
],
659+
)
641660
@multi_gpu_test(num_gpus=2)
642661
@requires_deep_ep_v2
643662
def test_deep_ep_v2_moe_cudagraph(
@@ -648,6 +667,7 @@ def test_deep_ep_v2_moe_cudagraph(
648667
topk: int,
649668
world_dp_size: tuple[int, int],
650669
moe_backend: str,
670+
activation: MoEActivation,
651671
workspace_init,
652672
):
653673
set_random_seed(7)
@@ -671,4 +691,5 @@ def test_deep_ep_v2_moe_cudagraph(
671691
None,
672692
None,
673693
moe_backend,
694+
activation,
674695
)

0 commit comments

Comments
 (0)