Skip to content

Commit 9558f43

Browse files
[Bugfix] Size FlashInfer NVLink MNNVL workspace to EP group (#40893)
Signed-off-by: Dao Le <Dao007forever@gmail.com>
1 parent 8cd174f commit 9558f43

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

vllm/distributed/device_communicators/all2all.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -492,15 +492,18 @@ def initialize(
492492
CustomCommunicator,
493493
)
494494

495-
dp_config = MnnvlConfig(
496-
comm_backend=CustomCommunicator(get_dp_group().cpu_group),
495+
# MNNVL workspace is allocated per rank in the comm_backend's group; the
496+
# flashinfer kernel asserts workspace.size(0) == moe_ep_size, so the backend
497+
# must span the EP group (= DP*PCP*TP), not the DP group.
498+
ep_config = MnnvlConfig(
499+
comm_backend=CustomCommunicator(self.cpu_group),
497500
fabric_page_size=1 << 29, # 512MB
498501
allocation_granularity=0, # Auto-detect
499502
)
500503

501-
self.workspace_tensor = MnnvlMoe.get_moe_workspaces(self.mapping, dp_config)
504+
self.workspace_tensor = MnnvlMoe.get_moe_workspaces(self.mapping, ep_config)
502505
self.prepare_workspace_tensor = MnnvlMoe.get_moe_prepare_workspace(
503-
self.mapping, dp_config
506+
self.mapping, ep_config
504507
)
505508

506509
self.world_size = world_size
@@ -605,8 +608,11 @@ def initialize(
605608
CustomCommunicator,
606609
)
607610

608-
dp_config = MnnvlConfig(
609-
comm_backend=CustomCommunicator(get_dp_group().cpu_group),
611+
# MNNVL workspace is allocated per rank in the comm_backend's group; the
612+
# flashinfer kernel asserts workspace.size(0) == moe_ep_size, so the backend
613+
# must span the EP group (= DP*PCP*TP), not the DP group.
614+
ep_config = MnnvlConfig(
615+
comm_backend=CustomCommunicator(self.cpu_group),
610616
)
611617
total_dispatch_payload_size_per_token = (
612618
hidden_size // 2 # nvfp4 hidden states
@@ -628,7 +634,7 @@ def initialize(
628634
top_k=top_k,
629635
num_experts=num_experts,
630636
workspace_size_per_rank=self.workspace_size,
631-
mnnvl_config=dp_config,
637+
mnnvl_config=ep_config,
632638
)
633639

634640
self.gpus_per_node = gpus_per_node

0 commit comments

Comments
 (0)