[MoE Refactor] Introduce MoERunner abstraction and move execution logic from FusedMoE to DefaultMoERunner (#32344)
Signed-off-by: Bill Nell <bnell@redhat.com>
This commit is contained in:
@@ -913,12 +913,16 @@ class FusedMoEParallelConfig:
|
||||
pcp_rank: int
|
||||
dp_rank: int
|
||||
ep_rank: int
|
||||
sp_size: int
|
||||
|
||||
use_ep: bool # whether to use EP or not
|
||||
all2all_backend: str # all2all backend for MoE communication
|
||||
is_sequence_parallel: bool # whether sequence parallelism is used
|
||||
enable_eplb: bool # whether to enable expert load balancing
|
||||
|
||||
@property
|
||||
def is_sequence_parallel(self) -> bool:
|
||||
return self.sp_size > 1
|
||||
|
||||
@property
|
||||
def use_all2all_kernels(self):
|
||||
return self.dp_size > 1 and self.use_ep
|
||||
@@ -974,6 +978,7 @@ class FusedMoEParallelConfig:
|
||||
tp_size_: int,
|
||||
pcp_size_: int,
|
||||
dp_size_: int,
|
||||
sp_size_: int,
|
||||
vllm_parallel_config: ParallelConfig,
|
||||
) -> "FusedMoEParallelConfig":
|
||||
"""
|
||||
@@ -1073,9 +1078,9 @@ class FusedMoEParallelConfig:
|
||||
dp_rank=dp_rank,
|
||||
ep_size=1,
|
||||
ep_rank=0,
|
||||
sp_size=sp_size_,
|
||||
use_ep=False,
|
||||
all2all_backend=vllm_parallel_config.all2all_backend,
|
||||
is_sequence_parallel=vllm_parallel_config.use_sequence_parallel_moe,
|
||||
enable_eplb=vllm_parallel_config.enable_eplb,
|
||||
)
|
||||
# DP + EP / TP + EP / DP + TP + EP
|
||||
@@ -1093,9 +1098,9 @@ class FusedMoEParallelConfig:
|
||||
dp_rank=dp_rank,
|
||||
ep_size=ep_size,
|
||||
ep_rank=ep_rank,
|
||||
sp_size=sp_size_,
|
||||
use_ep=True,
|
||||
all2all_backend=vllm_parallel_config.all2all_backend,
|
||||
is_sequence_parallel=vllm_parallel_config.use_sequence_parallel_moe,
|
||||
enable_eplb=vllm_parallel_config.enable_eplb,
|
||||
)
|
||||
|
||||
@@ -1111,10 +1116,10 @@ class FusedMoEParallelConfig:
|
||||
dp_rank=0,
|
||||
ep_size=1,
|
||||
ep_rank=0,
|
||||
sp_size=1,
|
||||
use_ep=False,
|
||||
all2all_backend="naive",
|
||||
enable_eplb=False,
|
||||
is_sequence_parallel=False,
|
||||
)
|
||||
|
||||
|
||||
@@ -1126,6 +1131,7 @@ class FusedMoEConfig:
|
||||
hidden_dim: int
|
||||
intermediate_size_per_partition: int
|
||||
num_local_experts: int
|
||||
num_logical_experts: int
|
||||
activation: str
|
||||
device: torch.device | str
|
||||
routing_method: RoutingMethodType
|
||||
@@ -1175,6 +1181,14 @@ class FusedMoEConfig:
|
||||
def ep_size(self):
|
||||
return self.moe_parallel_config.ep_size
|
||||
|
||||
@property
|
||||
def sp_size(self):
|
||||
return self.moe_parallel_config.sp_size
|
||||
|
||||
@property
|
||||
def is_sequence_parallel(self):
|
||||
return self.moe_parallel_config.is_sequence_parallel
|
||||
|
||||
@property
|
||||
def tp_rank(self):
|
||||
return self.moe_parallel_config.tp_rank
|
||||
|
||||
Reference in New Issue
Block a user