[ROCm][Bugfix] Explicitly reject FSE=1 with DPA+ETP deployment for DeepSeek-V4 (#57919)

Signed-off-by: Shanshan Shen <87969357+shen-shanshan@users.noreply.github.com>
This commit is contained in:
Shanshan Shen
2026-09-22 04:45:53 +00:00
committed by GitHub
parent 639461eda4
commit 42a85a4976
2 changed files with 43 additions and 5 deletions
+21 -4
View File
@@ -12,7 +12,7 @@ import torch.nn as nn
import vllm.envs as envs
from vllm._aiter_ops import rocm_aiter_ops
from vllm.config import VllmConfig, get_current_vllm_config
from vllm.config import ParallelConfig, VllmConfig
from vllm.distributed import (
get_pp_group,
get_tensor_model_parallel_rank,
@@ -504,11 +504,28 @@ class DeepseekV4HeterogeneousSharedRoutedExperts(RoutedExperts):
return routed + shared_out
def _fuse_shared_experts_enabled(config) -> bool:
def _fuse_shared_experts_enabled(config, parallel_config: ParallelConfig) -> bool:
if (
getattr(config, "n_shared_experts", None)
and envs.VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS
and not parallel_config.enable_expert_parallel
and parallel_config.data_parallel_size > 1
):
# Fused shared experts are not supported under data parallelism:
# the fused path cannot load the FP8 shared expert into the MXFP4
# routed slot, which fails obscurely during weight loading. Fail
# fast with an actionable message instead.
raise ValueError(
"DeepSeek-V4 fused shared experts "
"(VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1) are not supported "
"with data parallelism (data_parallel_size > 1). Set "
"VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=0 to run the shared "
"expert as an unfused FP8 MLP."
)
return bool(
getattr(config, "n_shared_experts", None)
and envs.VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS
and not get_current_vllm_config().parallel_config.enable_expert_parallel
and not parallel_config.enable_expert_parallel
)
@@ -586,7 +603,7 @@ class DeepseekV4MoE(nn.Module):
# This should be cleaned up and use `resolve_layer_fused_shared_expert`.
self.fuse_heterogeneous_shared_expert = fuse_heterogeneous_shared_expert
fse_requested = (
_fuse_shared_experts_enabled(config)
_fuse_shared_experts_enabled(config, vllm_config.parallel_config)
and not self.fuse_heterogeneous_shared_expert
)
fse_compatible = False