Skip to content

[TRTLLM-13550][feat] WideEP FT: add MPI signal handler replacement (1d.0)#14160

Merged
chienchunhung merged 1 commit into
NVIDIA:mainfrom
chienchunhung:WideEP-FT/1d.0-mpi-signal-handler
Jun 23, 2026
Merged

[TRTLLM-13550][feat] WideEP FT: add MPI signal handler replacement (1d.0)#14160
chienchunhung merged 1 commit into
NVIDIA:mainfrom
chienchunhung:WideEP-FT/1d.0-mpi-signal-handler

Conversation

@chienchunhung

@chienchunhung chienchunhung commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added fault-tolerance mode to improve resilience in distributed MPI operations. When enabled, the system gracefully handles critical signals allowing fault-tolerance layers to continue execution after peer node failures.
  • Tests

    • Added unit tests validating fault-tolerance signal handling, idempotent handler installation, and behavior across different scenarios.

Summary

Mode A fix from the WideEP fault-tolerance design (§5.4). Today, any rank hitting SIGABRT/SIGSEGV calls MPI_Abort(MPI_COMM_WORLD), which propagates through mpirun and kills the entire 72-rank EP group within ~20s — before kernel rank-mask, EPLB remap, AlltoAll watchdog, or FT subcomm get a chance to run. This PR adds a non-propagating handler variant that calls _exit(137) instead.

What this PR does

  • tensorrt_llm::mpi::isFaultToleranceModeEnabled() — reads TLLM_FAULT_TOLERANCE_MODE; enables iff value is the string "1".
  • tensorrt_llm::mpi::installFaultToleranceSignalHandlers() — replaces the default SIGABRT/SIGSEGV handlers with _exit(137). Async-signal-safe (_exit is in POSIX's safe set; MPI_Abort and printf are not). Skips atexit/Python finalizers/MPI_Finalize, all of which can deadlock on a poisoned state.
  • mpi::initialize() — picks the new branch when the env var is set, overriding both the legacy MPI_Abort and the forwardAbortToParent kill(parent, SIGKILL) paths. The two existing branches are untouched.

The kill(parent, SIGKILL) skip in FT mode is deliberate: killing the parent defeats the entire purpose of letting survivors outlive a peer death.

Scoping decisions

Decision Rationale
Env var, not LLMArgs field Internal/dev knob for the MVP; the user-facing LLMArgs field is PR 1d.1 (depends on 1c.3/1c.4 which aren't landed yet). Documented as such in code comments.
Exit code 137 Mirrors the SIGKILL convention (128 + 9) so logs distinguish "rank died in FT mode" from generic crashes (EXIT_FAILURE = 1).
Only SIGABRT + SIGSEGV Matches the existing handler scope; audit Day 2 empirically validated this set. SIGINT/SIGTERM deliberately skipped (graceful-shutdown intent).
--mca orte_enable_recovery 1 not enforced here Runtime mpirun flag, not a source-level concern. Logged as a TLLM_LOG_INFO reminder at initialize time; will be wired into trtllm-serve as a follow-up.

Tests

cpp/tests/unit_tests/runtime/mpiUtilsTest.cpp — 9 items:

  • 5 env-var parsing cases (unset, "1", "0", "", truthy synonyms)
  • 3 fork-based handler-behavior cases (SIGABRT, SIGSEGV, idempotent install)
  • 1 negative control (default handler kills via signal — locks the contract that the FT handler is the actual interceptor)

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-compatible or api-breaking. For api-breaking, include BREAKING in 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.

chienchunhung added a commit to chienchunhung/TensorRT-LLM that referenced this pull request May 15, 2026
…al handler)

Adds the upstream PR number for 1d.0 (MPI signal handler replacement) to
all six places that already track in-flight Phase 1 MVP PRs:

  * README.md: new row in the In-flight PRs table.
  * 00-executive-summary.md: Mode A line + Phase 1 MVP status row.
  * 03-failure-modes-and-gaps.md: Mode A narrative + post-1d.0 inversion
    (also opportunistically backfills the existing 1a.2 PR# in the same
    Mode B sentence for symmetry).
  * 05-phase-1-immediate-survival.md §5.4: Signal handler replacement
    sub-section header (notes the env-var MVP gate vs the LLMArgs field
    that lands in PR 1d.1).
  * 08-implementation-plan.md: Status (April 2026) bullet + Gantt
    annotation marking the row done.
  * 09-risks-and-open-questions.md: Audit 1a Day 2 row.

Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
chienchunhung added a commit to chienchunhung/TensorRT-LLM that referenced this pull request May 16, 2026
…ype scaffold

Adds PR NVIDIA#14198 (DO NOT SUBMIT — preview only) to the in-flight PRs table in
the README and updates mvp-prototype-plan.md to reflect that the prototype
scaffolding is now shipped on branch WideEP-FT/mvp-prototype:

  * README.md In-flight PRs table: new row for NVIDIA#14198 (status flagged as
    "Draft (DO NOT SUBMIT — preview only)" to distinguish from the MVP
    component PRs).
  * README.md prototype paragraph: links NVIDIA#14198 alongside the cherry-picked
    NVIDIA#13302 and NVIDIA#14160; notes the discardable prototypes/wide_ep_ft_mvp/
    directory.
  * mvp-prototype-plan.md Status header: bumped to reflect scaffolding-shipped
    state.
  * mvp-prototype-plan.md §6 sequencing: new "Current status (2026-05-15)"
    paragraph documenting that both 1a.1 (NVIDIA#13302) and 1d.0 (NVIDIA#14160) are
    private cherry-picks on the prototype branch pending their merges to
    main, and that the kernel-side 1a.2 + 1a.3 work is deferred per
    prototypes/wide_ep_ft_mvp/kernel/README.md.

Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
@chienchunhung
chienchunhung force-pushed the WideEP-FT/1d.0-mpi-signal-handler branch from d0e705d to 72c1d8e Compare June 13, 2026 02:40
@chienchunhung

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #53997 [ run ] triggered by Bot. Commit: 72c1d8e Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #53997 [ run ] completed with state FAILURE. Commit: 72c1d8e
/LLM/main/L0_MergeRequest_PR pipeline #43081 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@chienchunhung
chienchunhung force-pushed the WideEP-FT/1d.0-mpi-signal-handler branch from 72c1d8e to 78dc051 Compare June 13, 2026 06:15

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --stage-list "x86_64-Linux,SBSA-Linux"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54022 [ run ] triggered by Bot. Commit: 78dc051 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54022 [ run ] completed with state FAILURE. Commit: 78dc051
/LLM/main/L0_MergeRequest_PR pipeline #43106 (Partly Tested) completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@chienchunhung
chienchunhung force-pushed the WideEP-FT/1d.0-mpi-signal-handler branch from 78dc051 to 93cb089 Compare June 14, 2026 17:25

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54149 [ run ] triggered by Bot. Commit: 93cb089 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54149 [ run ] completed with state SUCCESS. Commit: 93cb089
/LLM/main/L0_MergeRequest_PR pipeline #43232 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@chienchunhung
chienchunhung force-pushed the WideEP-FT/1d.0-mpi-signal-handler branch from 93cb089 to cca3484 Compare June 15, 2026 23:40

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54377 [ run ] triggered by Bot. Commit: cca3484 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54377 [ run ] completed with state FAILURE. Commit: cca3484
/LLM/main/L0_MergeRequest_PR pipeline #43446 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
@chienchunhung
chienchunhung force-pushed the WideEP-FT/1d.0-mpi-signal-handler branch from cca3484 to 2ba2d25 Compare June 16, 2026 05:44

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54484 [ run ] triggered by Bot. Commit: 2ba2d25 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54484 [ run ] completed with state SUCCESS. Commit: 2ba2d25
/LLM/main/L0_MergeRequest_PR pipeline #43547 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --stage-list "DGX_H100-PyTorch-2,H100_PCIe-PyTorch-Ray-1"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54634 [ run ] triggered by Bot. Commit: 2ba2d25 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54634 [ run ] completed with state SUCCESS. Commit: 2ba2d25
/LLM/main/L0_MergeRequest_PR pipeline #43666 (Partly Tested) completed with status: 'SUCCESS'

CI Report

Link to invocation

@chienchunhung

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54667 [ run ] triggered by Bot. Commit: 2ba2d25 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54667 [ run ] completed with state SUCCESS. Commit: 2ba2d25
/LLM/main/L0_MergeRequest_PR pipeline #43699 completed with status: 'SUCCESS'

CI Report

Link to invocation

@chienchunhung
chienchunhung marked this pull request as ready for review June 16, 2026 21:43
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds two new public functions to the MPI utilities: isFaultToleranceModeEnabled() (checks TLLM_FAULT_TOLERANCE_MODE=1) and installFaultToleranceSignalHandlers() (installs async-signal-safe SIGABRT/SIGSEGV handlers that call _exit(137) instead of MPI_Abort). MPI initialize() is updated to branch on FT mode. Unit tests cover env-var semantics and fork-based signal behavior.

Changes

WideEP MPI Fault-Tolerance Signal Handlers

Layer / File(s) Summary
Public API declarations
cpp/include/tensorrt_llm/runtime/utils/mpiUtils.h
Declares isFaultToleranceModeEnabled() and installFaultToleranceSignalHandlers() in the tensorrt_llm::mpi namespace with documentation describing the TLLM_FAULT_TOLERANCE_MODE env-var contract and _exit(137) replacement behavior.
FT helper implementation and MPI initialization wiring
cpp/tensorrt_llm/runtime/utils/mpiUtils.cpp
Adds string_view include and SignalHandler type alias; implements isFaultToleranceModeEnabled() (env-var read) and installFaultToleranceSignalHandlers() (SIGABRT/SIGSEGV_exit(137)); branches initialize() to call the FT installer with a log message or retain legacy MPI_Abort/parent-kill handlers.
Unit tests for env-var parsing and fork-based signal behavior
cpp/tests/unit_tests/runtime/mpiUtilsTest.cpp, cpp/tests/unit_tests/runtime/CMakeLists.txt
Defines FaultToleranceModeEnvGuard and runInChildAndWait fork harness; tests isFaultToleranceModeEnabled() across all env-var states; verifies installFaultToleranceSignalHandlers() yields WIFEXITED/_exit(137) for SIGABRT and SIGSEGV (including idempotent double-install); adds a sanity check that without FT handlers SIGABRT produces WIFSIGNALED. Registers target in CMakeLists.txt.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and specifically describes the main change: adding WideEP fault-tolerance MPI signal handler replacement, with proper JIRA ticket reference and feature type.
Description check ✅ Passed The description provides comprehensive coverage of all required sections: clear problem statement, detailed solution explanation, design rationale, test coverage overview, and completion of PR checklist items.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
cpp/include/tensorrt_llm/runtime/utils/mpiUtils.h (1)

1-15: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the copyright year to include 2026.

The copyright header shows 2021-2023, but this file is being modified in 2026. Per coding guidelines, the copyright header should include the year of the latest meaningful modification.

Suggested fix
 /*
- * Copyright (c) 2021-2023, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2021-2026, NVIDIA CORPORATION.  All rights reserved.
  *
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/include/tensorrt_llm/runtime/utils/mpiUtils.h` around lines 1 - 15,
Update the copyright year range in the header comment of mpiUtils.h from
"2021-2023" to "2021-2026" to reflect the current modification year. Change the
copyright line that currently reads "Copyright (c) 2021-2023" to "Copyright (c)
2021-2026" to comply with coding guidelines requiring the latest modification
year.

Source: Coding guidelines

cpp/tensorrt_llm/runtime/utils/mpiUtils.cpp (1)

1-15: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the copyright year to include 2026.

The copyright header shows 2022-2024, but this file is being modified in 2026.

Suggested fix
 /*
- * Copyright (c) 2022-2024, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2022-2026, NVIDIA CORPORATION.  All rights reserved.
  *
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tensorrt_llm/runtime/utils/mpiUtils.cpp` around lines 1 - 15, The
copyright year range in the header comment shows "2022-2024" but needs to be
updated to reflect the current year. Change the year range in the NVIDIA
CORPORATION copyright line from "2022-2024" to "2022-2026" to accurately reflect
that the file has been modified in 2026.

Source: Coding guidelines

🧹 Nitpick comments (1)
cpp/tests/unit_tests/runtime/mpiUtilsTest.cpp (1)

26-27: 💤 Low value

Consider adding a platform guard or CMake condition for POSIX-only tests.

This test file includes POSIX-specific headers (<sys/wait.h>, <unistd.h>) and uses fork()/waitpid() which have no Windows equivalents. The implementation file guards <unistd.h> with #ifndef _WIN32, but this test file would fail to compile on Windows.

If Windows builds are in scope, consider either:

  1. Wrapping the entire file in #ifndef _WIN32 / #endif
  2. Conditionally excluding the test target in CMakeLists.txt for Windows
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tests/unit_tests/runtime/mpiUtilsTest.cpp` around lines 26 - 27, The file
cpp/tests/unit_tests/runtime/mpiUtilsTest.cpp includes POSIX-specific headers
(sys/wait.h and unistd.h) and uses POSIX functions like fork() and waitpid()
without any platform guards, which will cause compilation failures on Windows.
To fix this, wrap the POSIX-specific includes and the entire test implementation
with a preprocessor guard using `#ifndef` _WIN32 at the beginning of the file and
`#endif` at the end to conditionally compile this test only on non-Windows
platforms. Alternatively, if you prefer to keep the test file unchanged, you can
add a CMake condition to exclude this test target from Windows builds in the
CMakeLists.txt configuration. Choose one approach and apply it consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@cpp/include/tensorrt_llm/runtime/utils/mpiUtils.h`:
- Around line 1-15: Update the copyright year range in the header comment of
mpiUtils.h from "2021-2023" to "2021-2026" to reflect the current modification
year. Change the copyright line that currently reads "Copyright (c) 2021-2023"
to "Copyright (c) 2021-2026" to comply with coding guidelines requiring the
latest modification year.

In `@cpp/tensorrt_llm/runtime/utils/mpiUtils.cpp`:
- Around line 1-15: The copyright year range in the header comment shows
"2022-2024" but needs to be updated to reflect the current year. Change the year
range in the NVIDIA CORPORATION copyright line from "2022-2024" to "2022-2026"
to accurately reflect that the file has been modified in 2026.

---

Nitpick comments:
In `@cpp/tests/unit_tests/runtime/mpiUtilsTest.cpp`:
- Around line 26-27: The file cpp/tests/unit_tests/runtime/mpiUtilsTest.cpp
includes POSIX-specific headers (sys/wait.h and unistd.h) and uses POSIX
functions like fork() and waitpid() without any platform guards, which will
cause compilation failures on Windows. To fix this, wrap the POSIX-specific
includes and the entire test implementation with a preprocessor guard using
`#ifndef` _WIN32 at the beginning of the file and `#endif` at the end to
conditionally compile this test only on non-Windows platforms. Alternatively, if
you prefer to keep the test file unchanged, you can add a CMake condition to
exclude this test target from Windows builds in the CMakeLists.txt
configuration. Choose one approach and apply it consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 488d33c9-9c64-4d45-bb3f-8be14ef395a6

📥 Commits

Reviewing files that changed from the base of the PR and between 09449d4 and 2ba2d25.

📒 Files selected for processing (4)
  • cpp/include/tensorrt_llm/runtime/utils/mpiUtils.h
  • cpp/tensorrt_llm/runtime/utils/mpiUtils.cpp
  • cpp/tests/unit_tests/runtime/CMakeLists.txt
  • cpp/tests/unit_tests/runtime/mpiUtilsTest.cpp

@chienchunhung chienchunhung changed the title [None][feat] WideEP FT: add MPI signal handler replacement (1d.0) [TRTLLM-13550][feat] WideEP FT: add MPI signal handler replacement (1d.0) Jun 22, 2026
@chienchunhung
chienchunhung merged commit 683a70c into NVIDIA:main Jun 23, 2026
14 checks passed
xinhe-nv pushed a commit to tensorrt-cicd/TensorRT-LLM that referenced this pull request Jun 24, 2026
…d.0) (NVIDIA#14160)

Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Signed-off-by: GitLab CI Bot <gitlab-ci@nvidia.com>
BrianLi23 pushed a commit to BrianLi23/TensorRT-LLM that referenced this pull request Jul 9, 2026
…d.0) (NVIDIA#14160)

Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants