[Fix] Add _MOE_TP to graph_capture for MoE models with ep>1 (#21907)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Baizhou Zhang <sobereddiezhang@gmail.com>
This commit is contained in:
Kangyan-Zhou
2026-04-03 02:33:16 -07:00
committed by GitHub
co-authored by Claude Opus 4.6 Baizhou Zhang
parent ac593fed90
commit 56ac9c9932
2 changed files with 9 additions and 5 deletions
@@ -1532,11 +1532,12 @@ def graph_capture(stream: Optional[torch.cuda.Stream] = None):
with get_tp_group().graph_capture(
stream=stream
) as context, get_pp_group().graph_capture(context):
moe_ep = _MOE_EP
if moe_ep is not None and moe_ep is not _TP:
with moe_ep.graph_capture(context):
yield context
else:
with contextlib.ExitStack() as stack:
seen = {id(_TP)}
for group in (_MOE_EP, _MOE_TP):
if group is not None and id(group) not in seen:
seen.add(id(group))
stack.enter_context(group.graph_capture(context))
yield context
+3
View File
@@ -1133,6 +1133,9 @@ class ServerArgs:
# 16. Expert distribution recorder
if self.enable_eplb or self.expert_distribution_recorder_mode is not None:
self.disable_piecewise_cuda_graph = True
# 17. Context parallel
if self.attn_cp_size > 1:
self.disable_piecewise_cuda_graph = True
def _handle_gpu_memory_settings(self, gpu_mem):
"""