Repository navigation
[None][fix] Merge back #19593 from release/1.3: Make MoE communication timeouts follow the warmup phase - #20246
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThis change adds runtime timeout controls for MoE communication backends. A shared guard resolves warmup and serving budgets, applies them through backend timeout proxies, and switches timeout state during engine warmup and CUDA-graph capture. ChangesMoE communication timeout control
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant PyTorchModelEngine
participant MoECommTimeoutGuard
participant TimeoutProxies
participant CudaGraphRunner
PyTorchModelEngine->>MoECommTimeoutGuard: set_moe_comm_warmup updates timeout state
MoECommTimeoutGuard->>TimeoutProxies: apply warmup timeout
CudaGraphRunner->>MoECommTimeoutGuard: enter serving_timeouts during capture
MoECommTimeoutGuard->>TimeoutProxies: apply serving timeout
CudaGraphRunner->>MoECommTimeoutGuard: exit serving_timeouts
MoECommTimeoutGuard->>TimeoutProxies: restore prior timeout state
Possibly related PRs
Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
|
/bot run --disable-fail-fast |
|
PR_Github #77625 [ run ] triggered by Bot. Commit: |
Barry-Delaney
left a comment
There was a problem hiding this comment.
Reviewed a5e1d84 for code correctness and shared-path regressions. Traced warmup/serving transitions, the separate graph warmup and capture passes, proxy lifetime and native-default restoration, timeout units, and DeepGEMM host/kernel argument propagation. All 39 focused CPU tests passed against the actual guard and extracted engine/runner methods with torch/logger dependencies stubbed. The DeepEP, NCCL-EP and DeepGEMM patches apply to their exact pinned sources and pass reverse-applicability checks; existing DeepEP CMake enables separate device compilation. All 15 changed Python sources parse, removed-helper callers are gone, and diff --check passes using the PR attributes. No blocking code findings. Native CUDA/GPU/MPI execution was not run locally.
|
Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements. |
…3: Make MoE communication timeouts follow the warmup phase Merge back the change of NVIDIA#19593 (release/1.3, f5eaf58) to main. MoE communication kernels that wait for peers inside the kernel trap once a peer is late by more than a device-side timeout. During warmup, one-time per-rank work such as JIT compilation and autotuning can delay a healthy rank by minutes, so a process-wide MoECommTimeoutGuard now relaxes those timeouts while the engine warms up and restores them for serving. NVLinkOneSided, DeepGEMM MegaMoE, DeepEP and NcclEP each register a MoECommTimeoutProxy. Only the CUDA-graph capture pass runs with the serving timeouts, because captured graphs keep their launch arguments. Adaptations to main: - Replace the NVLinkOneSided-only warmup budget of NVIDIA#19610 with the guard; TRTLLM_NVLINK_ONE_SIDED_A2A_[WARMUP_]TIMEOUT_SEC become deprecated aliases of TRTLLM_MOE_COMM_[WARMUP_]TIMEOUT_SEC, like TRTLLM_MOE_A2A_*. - Move the capture-pass switch into DecoderRunner after the runner refactor. - Re-author the DeepGEMM barrier-timeout patch for b64107f2. NVIDIA#19727 dropped the NVIDIA#18179 patch when it bumped DeepGEMM, so this also makes DG_JIT_BARRIER_TIMEOUT_SECONDS take effect again. - Let a fetch_content.json dependency list several patch files. Signed-off-by: xxi <xxi@nvidia.com>
a5e1d84 to
d9ece37
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #77674 [ run ] triggered by Bot. Commit: |
|
PR_Github #77625 [ run ] completed with state |
Barry-Delaney
left a comment
There was a problem hiding this comment.
Re-reviewed d9ece37 after the rebase. Range-diff against the previously approved a5e1d84 shows the MoE timeout implementation and dependency patches are unchanged; the substantive adaptation is the CMake integration with main's patch_dependency.py. Configured the actual 3rdparty CMake declarations in an isolated project and verified fresh application, repeated application and reverse checks for DeepEP (including the concatenated patch), NCCL-EP and DeepGEMM against their pinned sources. No new blocking code findings. The earlier 39 isolated CPU checks remain applicable to unchanged runtime code; native GPU/MPI execution was not run locally.
|
PR_Github #77674 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #77777 [ run ] triggered by Bot. Commit: |
|
PR_Github #77777 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #77792 [ run ] triggered by Bot. Commit: |
|
PR_Github #77792 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #77829 [ run ] triggered by Bot. Commit: |
|
PR_Github #77829 [ run ] completed with state |
Upstream NVIDIA#20134 moved the decoder warmup out of DecoderRunner into DecoderWarmup (warmup.py) and the two-pass CUDA graph capture into DecoderCudaGraphs.warmup_and_capture; NVIDIA#20246 replaced the steady-state MoE all-to-all budget with the serving-timeout switch around the capture pass. The pre-capture JIT warmup barrier moves with them: DecoderWarmup runs the drain and rank sync before warmup_and_capture, and the barrier test drives DecoderWarmup.run with the graph passes and the timeout switch recorded. Signed-off-by: Aaron Meoded <aaron.meoded@baseten.co>
Dev Engineer Review
MoECommTimeoutGuardcentralizes warmup and serving timeout budgets across NVLinkOneSided, DeepGEMM MegaMoE, DeepEP, and NCCL-EP. It validates values, resolves deprecated aliases, and rejects conflicting values.DG_JIT_BARRIER_TIMEOUT_SECONDSas the JIT-time default. DeepEP and NCCL-EP patches add runtime timeout APIs. Verify compatibility with the pinned dependencies and CUDA graph replay behavior.QA Engineer Review
The change adds tests for budget resolution, aliases, validation, guard transitions, backend proxies, engine warmup transitions, and CUDA-graph capture behavior. It also adds communication-factory and DeepGEMM import compatibility tests. The B200 test list includes the timeout-guard test and the DeepGEMM import test. GPU-dependent proxy tests may skip when runtime requirements are unavailable. Test execution results were not supplied. Coverage verdict: needs follow-up, pending CI results for GPU-dependent behavior and dependency patch builds.
Per-File QA Perspective
3rdparty/CMakeLists.txt: Verify ordered patch application and the failure paths for inconsistent patch state.3rdparty/fetch_content.json: Verify the DeepEP, NCCL-EP, and DeepGEMM patch assignments against the pinned dependency sources.3rdparty/patches/deep_ep_runtime_timeout.patch: Verify setter bounds, default restoration, and timeout behavior during kernel launches and graph replay.3rdparty/patches/deepgemm_configurable_barrier_timeout.patch: Verify JIT defaults, runtime overrides, and timeout reporting on supported kernels.3rdparty/patches/nccl_ep_group_timeout.patch: Verify group timeout conversion, reset behavior, and invalid-value handling.cpp/tensorrt_llm/thop/moe/communication/moeAlltoAllOp.cpp: Verify that zero restores the native default and the getter reports the current timeout.docs/source/developer-guide/overview.md: Verify the documented warmup and serving defaults match runtime behavior.tensorrt_llm/_torch/moe/fused_moe/MOE_DEVELOPER_GUIDE.md: Verify the documented aliases, transitions, and proxy ownership match implementation.tensorrt_llm/_torch/moe/fused_moe/communication/communication_factory.py: Verify invalid timeout values fail before backend construction and unsupported NCCL-EP versions are rejected clearly.tensorrt_llm/_torch/moe/fused_moe/communication/nvlink_one_sided.py: Verify the proxy applies and resets NVLinkOneSided timeouts. The previous module-level timeout API was removed.tensorrt_llm/_torch/moe/fused_moe/deep_ep_utils.py: Verify proxy registration and confirm which DeepEP kernel modes use the process-wide timeout.tensorrt_llm/_torch/moe/fused_moe/mega_moe/mega_moe_deepgemm.py: Verify DeepGEMM proxy registration and runtime timeout updates.tensorrt_llm/_torch/moe/fused_moe/moe_comm_timeout_guard.py: Verify budget parsing, validation, proxy lifecycle, capture-time transition rejection, and serving-timeout restoration.tensorrt_llm/_torch/moe/fused_moe/nccl_ep_utils.py: Verify NCCL-EP capability detection, timeout conversion, registration, and cleanup.tensorrt_llm/_torch/moe/fused_moe/quantization.py: Verify DeepGEMM builds without the new setter fail with the intended compatibility error.tensorrt_llm/_torch/pyexecutor/engine/runners/common.py: Verify no remaining call paths require the removed timeout helpers.tensorrt_llm/_torch/pyexecutor/engine/runners/decoder/runner.py: Verify only serving graph capture uses serving timeouts and warmup remains on the warmup budget.tensorrt_llm/_torch/pyexecutor/model_engine.py: Verify each engine warmup-state transition updates the communication guard.tests/integration/test_lists/test-db/l0_b200.yml: Adds the timeout-guard and DeepGEMM import-rejection tests to the B200 test list.tests/unittest/_torch/executor/test_moe_comm_timeout_warmup.py: Covers engine warmup transitions and graph warmup/capture timeout selection. The supplied test-list change does not show this test in the B200 list.tests/unittest/_torch/moe/multi_gpu/test_nvlink_one_sided.py: Verify MPI workers use the canonical timeout variables and retain the intended values.tests/unittest/_torch/moe/test_communication_factory.py: Covers early validation and NCCL-EP timeout capability detection. The supplied test-list change does not show this test in the B200 list.tests/unittest/_torch/moe/test_moe_backend.py: Covers rejection of DeepGEMM without the runtime setter. The B200 list includes the associated import-rejection test.tests/unittest/_torch/moe/test_moe_comm_timeout_guard.py: Covers budget resolution, guard transitions, and backend proxies. GPU-dependent tests can skip when runtime requirements are unavailable. The supplied test-list change does not show this test in the B200 list.Description
This PR is a merge-back of #19593 from
release/1.3(merged there as f5eaf58) tomain. It brings the same feature tomain. The differences listed below exist becausemainchanged the same areas afterrelease/1.3branched.What #19593 does
Several MoE communication kernels wait for their peers inside the kernel and trap once a peer is late by more than a device-side timeout. The trap is a sticky CUDA error, so every waiting rank dies. During warmup, a healthy rank can arrive minutes late while it pays for one-time work such as kernel JIT, autotuning or module loading. On GB300, single ranks reached their first DeepGEMM MegaMoE launch 55-73 s late, and the other ranks trapped with
DeepGEMM grid sync timeout (60s).A process-wide
MoECommTimeoutGuard(tensorrt_llm/_torch/moe/fused_moe/moe_comm_timeout_guard.py) relaxes the timeouts of every MoE communication backend while the engine warms up, and restores them for serving:TRTLLM_MOE_COMM_WARMUP_TIMEOUT_SECsets the warmup budget for every backend (default 1800 s).TRTLLM_MOE_COMM_TIMEOUT_SECsets the serving budget. When it is unset, each backend keeps its native timeout.PyTorchModelEngine.is_warmupsetter switches the guard. The CUDA-graph pass that captures runs with the serving timeouts, because a captured graph keeps the timeouts that were current at capture and serving replays it.torch.ops.trtllm.moe_a2a_set_timeoutdeep_gemm.set_barrier_timeout_seconds(3rdparty/patches/deepgemm_configurable_barrier_timeout.patch)DG_JIT_BARRIER_TIMEOUT_SECONDSdeep_ep.set_timeout_seconds(3rdparty/patches/deep_ep_runtime_timeout.patch)nccl.ep.Group.set_timeout_ns(3rdparty/patches/nccl_ep_group_timeout.patch)NCCL_EP_TIMEOUT_MS, elseGroupConfig.timeout_ns, else ~100 sThe design discussion and review are in #19593.
Differences from #19593
NVLinkOneSided timeouts (#19610). On
main, #19610 had already given NVLinkOneSided its own warmup budget, read fromTRTLLM_NVLINK_ONE_SIDED_A2A_[WARMUP_]TIMEOUT_SECand applied throughNVLinkOneSided.set_timeout. The guard replaces it:_NVLinkOneSidedTimeoutProxyreplacesNVLinkOneSided.set_timeoutandget_timeout_seconds. The helpers inengine/runners/common.pythat drove them are removed.moe_a2a_set_timeoutnow accepts 0, which restores the native 300 s budget. A newmoe_a2a_get_timeoutop reads the budget back for tests.TRTLLM_MOE_COMM_[WARMUP_]TIMEOUT_SEC:TRTLLM_NVLINK_ONE_SIDED_A2A_[WARMUP_]TIMEOUT_SECfrom [None][refactor] overhaul NVLink one-sided all-to-all #19610, andTRTLLM_MOE_A2A_[WARMUP_]TIMEOUT_SEC, whichmainused before [None][refactor] overhaul NVLink one-sided all-to-all #19610 andrelease/1.3still accepts. Each alias logs a deprecation warning and now applies to every backend. Conflicting values raise.ValueErrorthat names the variable.CommunicationFactory.create_strategyraises it before trying any backend. [None][refactor] overhaul NVLink one-sided all-to-all #19610 logged a warning and used the default instead. The accepted range is still 1..86400 s.CUDA-graph capture (#19896). Capture moved from the model engine to the decoder runner, so the capture-pass switch now lives in a new
DecoderRunner._warmup_and_capture_cuda_graphs. #19610 deleted the engine-level test that #19593 rewrote (tests/unittest/_torch/misc/test_moe_a2a_warmup_timeout.py). It is re-added astests/unittest/_torch/executor/test_moe_comm_timeout_warmup.py.DeepGEMM patch (#19727). #19727 bumped DeepGEMM from 8b1392b9 to b64107f2 and dropped
deepgemm_configurable_barrier_timeout.patchfrom #18179. As a result, the in-kernel barrier timeout onmainis a fixed 60 s, andDG_JIT_BARRIER_TIMEOUT_SECONDS, whichdocs/source/developer-guide/overview.mddocuments, has no effect. The patch is re-authored for b64107f2:DG_JIT_BARRIER_TIMEOUT_SECONDSas the JIT-time default.set_barrier_timeout_seconds, which is passed as a kernel argument to the SM100 BF16, FP8×FP4 and FP4×FP4 MegaMoE kernels and to the SM90 FP8 MegaMoE kernel. Changing it does not recompile.overview.mdgains a paragraph on how the TRT-LLM runtime overrides the default.Several patches per dependency.
3rdparty/CMakeLists.txttakes #19593's support for a list of patches inpatch_file, applied and verified in order. It builds on #19957's single-argument patch command. DeepEP now carries two patches.Test Coverage
tests/unittest/_torch/moe/test_moe_comm_timeout_guard.py:TestBudgetResolutionandTestGuardarecpu_onlyand run inl0_cpu.ymlthroughunittest/_torch/moe. They cover budget resolution, both deprecated alias families (including conflicts and invalid values), validation, warmup transitions, weak proxy registration, and the capture check.TestBackendProxiesis added tol0_b200.yml. Each proxy round-trips through its native setter.tests/unittest/_torch/executor/test_moe_comm_timeout_warmup.pyiscpu_onlyand runs inl0_cpu.ymlthroughunittest/_torch/executor. It checks that the engine switches the timeouts both ways, and that only the capturing CUDA-graph pass uses the serving timeouts.tests/unittest/_torch/moe/test_communication_factory.py: an invalid timeout fails before any strategy is constructed, and NcclEP is rejected with a reason whenGroup.set_timeout_nsis missing.tests/unittest/_torch/moe/test_moe_backend.py::test_import_deep_gemm_rejects_mega_moe_without_barrier_timeoutis new and added tol0_b200.yml.tests/unittest/_torch/moe/multi_gpu/test_nvlink_one_sided.pynow sets the new variable names.Checked locally without a GPU:
The GPU tests run in CI.
Notes for reviewers
Patch state for <dep> is inconsistent, remove_deps/<dep>-srcand reconfigure. CI builds from scratch.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.