From ba2ffcf156b5b77291967ab4af4de24e8401fab7 Mon Sep 17 00:00:00 2001 From: xieminghe1 <141820649+xieminghe1@users.noreply.github.com> Date: Mon, 18 May 2026 21:35:32 +0800 Subject: [PATCH] Add DeepSeekV4 fused MoE Triton autotune support (#25569) Co-authored-by: undefined Co-authored-by: xq25478 Co-authored-by: xieminghe.simon --- benchmark/kernels/fused_moe_triton/common_utils.py | 1 + .../kernels/fused_moe_triton/tuning_fused_moe_triton.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/benchmark/kernels/fused_moe_triton/common_utils.py b/benchmark/kernels/fused_moe_triton/common_utils.py index 4580732c6..66c1f495c 100644 --- a/benchmark/kernels/fused_moe_triton/common_utils.py +++ b/benchmark/kernels/fused_moe_triton/common_utils.py @@ -85,6 +85,7 @@ def get_model_config( "DeepseekV2ForCausalLM", "DeepseekV3ForCausalLM", "DeepseekV32ForCausalLM", + "DeepseekV4ForCausalLM", "Glm4MoeForCausalLM", "GlmMoeDsaForCausalLM", "MistralLarge3ForCausalLM", diff --git a/benchmark/kernels/fused_moe_triton/tuning_fused_moe_triton.py b/benchmark/kernels/fused_moe_triton/tuning_fused_moe_triton.py index ea237e360..3efd128a5 100644 --- a/benchmark/kernels/fused_moe_triton/tuning_fused_moe_triton.py +++ b/benchmark/kernels/fused_moe_triton/tuning_fused_moe_triton.py @@ -35,6 +35,7 @@ from sglang.srt.server_args import ( set_global_server_args_for_scheduler, ) from sglang.srt.utils import get_device, is_hip, is_xpu +from sglang.srt.utils.hf_transformers_utils import get_config _is_hip = is_hip() _is_xpu = is_xpu() @@ -174,8 +175,12 @@ def benchmark_config( topk_output.router_logits.copy_(new_topk_output.router_logits) def run(): + model_config = get_config(args.model, trust_remote_code=True) + architecture = model_config.architectures[0] + is_dsv4 = architecture == "DeepseekV4ForCausalLM" moe_runner_config = MoeRunnerConfig( inplace=True, + swiglu_limit=10.0 if is_dsv4 else None, ) with override_config(config):