Skip to content

[https://nvbugs/6517844][fix] Fall back to DeepEP when NCCL-EP lacks shared memory - #16956

Merged
Tabrizian merged 5 commits into
NVIDIA:mainfrom
nv-lschneider:fix/nccl-ep-deepep-fallback
Aug 3, 2026
Merged

[https://nvbugs/6517844][fix] Fall back to DeepEP when NCCL-EP lacks shared memory#16956
Tabrizian merged 5 commits into
NVIDIA:mainfrom
nv-lschneider:fix/nccl-ep-deepep-fallback

Conversation

@nv-lschneider

@nv-lschneider nv-lschneider commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Dev Engineer Review

  • Added a NCCL-EP low-latency “LL combine” dynamic shared-memory (SMEM) preflight during MoE communication-strategy selection to fix NVBug 6517844 on RTX Pro 6000D.
  • Implemented a helper that computes the required ll_combine dynamic SMEM (bytes) from MoE slot count, hidden size, and GPU SM (multi-processor) count, returning None when the derived warp-group configuration is invalid.
  • Extended _get_nccl_ep_unavailable_reason (when CUDA is available) to:
    • Probe current CUDA device properties.
    • Estimate required_smem and compare it to the device’s maximum supported dynamic SMEM via shared_memory_per_block_optin (falling back to shared_memory_per_block).
    • Return specific unavailability reasons for invalid derived configuration vs. capacity-exceeded cases; otherwise treat NCCL-EP as available.
  • Updated selection behavior:
    • Automatic selection skips NCCL-EP and falls back to DeepEP when the LL combine SMEM requirement exceeds device dynamic SMEM capacity.
    • Forced NCCL_EP selection validates the configuration, rejecting invalid/oversubscribed cases (including the “at most 32 expert warp groups” constraint) with a ValueError.
  • Added unit coverage for SMEM calculation and both auto-selection fallback and forced-selection rejection/acceptance paths.
  • Formatting/linting/codespell/repo checks passed; focused pytest was not run locally because pytest was unavailable.

QA Engineer Review

Tests touched: tests/unittest/_torch/modules/moe/test_communication_factory.py

  • Added/extended coverage for:
    • _get_nccl_ep_ll_combine_smem_requirement returning the expected SMEM value for a known input.
    • Forced NCCL-EP rejection when expert warp groups exceed 32.
    • Forced NCCL-EP acceptance when device dynamic shared-memory is sufficient (parameterized across opt-in vs legacy shared-memory properties).
    • Automatic selection skipping NCCL-EP and falling back to DeepEP when the LL combine SMEM requirement exceeds device capacity.
  • Added a _FakeDeepEP stub to detect DeepEP selection without instantiating the real DeepEP implementation.

Test-list coverage mapping:

  • tests/integration/test_lists/test-db/l0_a10.yml: added unittest/_torch/modules/moe/test_communication_factory.py to the pre-merge A10 (ubuntu) PyTorch test list.

Verdict: needs follow-up.

Description

Fixes NVBug 6517844 on RTX Pro 6000D.

NCCL-EP low-latency combine can require more opt-in dynamic shared memory than the device supports. Previously, this was detected only during NCCL-EP kernel setup, aborting the worker.

Preflight the NCCL-EP low-latency combine shared-memory requirement during communication-strategy selection. When unsupported, automatic selection skips NCCL-EP and falls back to DeepEP. A forced NCCL_EP selection reports a clear validation error.

The affected EP4 DeepSeek-V3-Lite test remains active in the RTX Pro 6000D L0 test list and has no waiver.

Test Coverage

  • Added unit coverage for the NCCL-EP LL combine shared-memory calculation (72 slots, hidden size 2560 → 200,704 bytes).
  • Added unit coverage that verifies automatic selection bypasses NCCL-EP and chooses DeepEP when dynamic shared memory is insufficient.
  • Pre-commit formatting, ruff, codespell, and relevant repository checks passed.
  • Focused pytest was not run locally because the host Python environment lacks pytest.

PR Checklist

  • PR description clearly explains what and why.
  • PR follows TRT-LLM coding guidelines.
  • Test cases are provided for the new code path.
  • No API change.
  • No new dependencies.
  • CODEOWNERS update not needed.
  • Documentation update not needed.
  • TAVA architecture diagram update not needed.
  • Reviewers will be assigned appropriately.

@nv-lschneider
nv-lschneider requested a review from a team as a code owner July 28, 2026 15:47
@nv-lschneider nv-lschneider changed the title [https://nvbugs/6517844][fix] Fall back to DeepEP when NCCL-EP lacks shared memory [https://nvbugs/6517844][fix] Fall back to DeepEP when NCCL-EP lacks shared memory Jul 28, 2026
@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2"

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

NCCL EP eligibility now accounts for LL-combine dynamic shared-memory requirements and warp-group limits. Tests cover requirement calculation, forced-method validation, supported configurations, automatic DeepEP fallback, and A10 test-suite registration.

Changes

NCCL EP shared-memory eligibility

Layer / File(s) Summary
LL-combine shared-memory validation
tensorrt_llm/_torch/modules/fused_moe/communication/communication_factory.py
Calculates LL-combine dynamic-SMEM requirements and reports NCCL EP as unavailable for invalid warp-group configurations or insufficient CUDA device capacity.
Strategy selection and CI coverage
tests/unittest/_torch/modules/moe/test_communication_factory.py, tests/integration/test_lists/test-db/l0_a10.yml
Tests requirement calculation, forced NCCL EP acceptance and rejection, DeepEP fallback when capacity is insufficient, and registers the unit test in the A10 pre-merge suite.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CommunicationFactory
  participant CUDADeviceProperties
  participant NcclEP
  participant DeepEP
  CommunicationFactory->>CUDADeviceProperties: Query SM count and dynamic shared-memory capacity
  CommunicationFactory->>CommunicationFactory: Calculate LL-combine SMEM requirement
  alt Requirement fits device capacity
    CommunicationFactory->>NcclEP: Select NCCL EP
  else Requirement exceeds capacity
    CommunicationFactory->>DeepEP: Select DeepEP
  end
Loading

Suggested reviewers: bowenfu, qijune

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change and follows the required ticket/type format.
Description check ✅ Passed The description includes the required Description, Test Coverage, and PR Checklist sections with clear details.
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.
✨ 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.

🧹 Nitpick comments (2)
tensorrt_llm/_torch/modules/fused_moe/communication/communication_factory.py (1)

42-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use int | None here. Optional[int] can be replaced with PEP 604 union syntax in this helper.

🤖 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 `@tensorrt_llm/_torch/modules/fused_moe/communication/communication_factory.py`
around lines 42 - 44, Update the return annotation of
_get_nccl_ep_ll_combine_smem_requirement to use the PEP 604 int | None syntax
instead of Optional[int], leaving the helper’s behavior unchanged.

Sources: Coding guidelines, Learnings

tests/unittest/_torch/modules/moe/test_communication_factory.py (1)

237-283: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a warp-group boundary test
test_forced_nccl_ep_validates_preconditions already covers the forced NCCL_EP path. Add a case for _get_nccl_ep_ll_combine_smem_requirement(...)=None when num_warp_groups > 32.

Test coverage summary: test_nccl_ep_ll_combine_smem_requirement and test_auto_selection_skips_nccl_ep_when_ll_combine_exceeds_dynamic_smem cover the helper value and fallback path; test_forced_nccl_ep_validates_preconditions covers the forced path. Coverage verdict: needs follow-up.

🤖 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 `@tests/unittest/_torch/modules/moe/test_communication_factory.py` around lines
237 - 283, Add a unit test covering the warp-group boundary where
_get_nccl_ep_ll_combine_smem_requirement returns None when num_warp_groups
exceeds 32. Extend the existing NCCL_EP-related test coverage, particularly near
test_forced_nccl_ep_validates_preconditions, and assert the expected forced-path
validation behavior without changing the existing helper or fallback tests.

Source: Path instructions

🤖 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.

Nitpick comments:
In
`@tensorrt_llm/_torch/modules/fused_moe/communication/communication_factory.py`:
- Around line 42-44: Update the return annotation of
_get_nccl_ep_ll_combine_smem_requirement to use the PEP 604 int | None syntax
instead of Optional[int], leaving the helper’s behavior unchanged.

In `@tests/unittest/_torch/modules/moe/test_communication_factory.py`:
- Around line 237-283: Add a unit test covering the warp-group boundary where
_get_nccl_ep_ll_combine_smem_requirement returns None when num_warp_groups
exceeds 32. Extend the existing NCCL_EP-related test coverage, particularly near
test_forced_nccl_ep_validates_preconditions, and assert the expected forced-path
validation behavior without changing the existing helper or fallback tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 909818cc-f0b5-42b1-b3ca-fa3eb67a7ac5

📥 Commits

Reviewing files that changed from the base of the PR and between 1b9cbfa and f8968d5.

📒 Files selected for processing (2)
  • tensorrt_llm/_torch/modules/fused_moe/communication/communication_factory.py
  • tests/unittest/_torch/modules/moe/test_communication_factory.py

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62220 [ run ] triggered by Bot. Commit: f8968d5 Link to invocation

@nv-lschneider
nv-lschneider force-pushed the fix/nccl-ep-deepep-fallback branch 2 times, most recently from 38996b2 to aa181e2 Compare July 28, 2026 16:15
@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62230 [ run ] triggered by Bot. Commit: aa181e2 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62220 [ run ] completed with state ABORTED. Commit: f8968d5

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62230 [ run ] completed with state FAILURE. Commit: aa181e2
/LLM/main/L0_MergeRequest_PR pipeline #50402 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

@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2" --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62265 [ run ] triggered by Bot. Commit: aa181e2 Link to invocation

@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2" --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62275 [ run ] triggered by Bot. Commit: aa181e2 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62265 [ run ] completed with state ABORTED. Commit: aa181e2

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62275 [ run ] completed with state FAILURE. Commit: aa181e2
/LLM/main/L0_MergeRequest_PR pipeline #50444 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

@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2" --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62323 [ run ] triggered by Bot. Commit: aa181e2 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62323 [ run ] completed with state FAILURE. Commit: aa181e2
/LLM/main/L0_MergeRequest_PR pipeline #50492 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

@nv-lschneider
nv-lschneider requested review from a team as code owners July 29, 2026 13:26
@nv-lschneider
nv-lschneider requested review from BowenFu and QiJune July 29, 2026 13:26
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62907 [ run ] triggered by Bot. Commit: 0ad30c3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62834 [ run ] completed with state ABORTED. Commit: 0ad30c3

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62907 [ run ] completed with state FAILURE. Commit: 0ad30c3
/LLM/main/L0_MergeRequest_PR pipeline #51029 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

@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2"

1 similar comment
@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63031 [ run ] triggered by Bot. Commit: 0ad30c3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63035 [ run ] triggered by Bot. Commit: 0ad30c3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63031 [ run ] completed with state ABORTED. Commit: 0ad30c3

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63035 [ run ] completed with state FAILURE. Commit: 0ad30c3
/LLM/main/L0_MergeRequest_PR pipeline #51139 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: Ludwig Schneider <lschneider@nvidia.com>
Signed-off-by: Ludwig Schneider <lschneider@nvidia.com>
Signed-off-by: Ludwig Schneider <lschneider@nvidia.com>
Signed-off-by: Ludwig Schneider <lschneider@nvidia.com>
Signed-off-by: Ludwig Schneider <lschneider@nvidia.com>
@nv-lschneider
nv-lschneider force-pushed the fix/nccl-ep-deepep-fallback branch from 0ad30c3 to e3040fc Compare July 31, 2026 19:27
@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63107 [ run ] triggered by Bot. Commit: e3040fc Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63107 [ run ] completed with state FAILURE. Commit: e3040fc
/LLM/main/L0_MergeRequest_PR pipeline #51200 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

@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63158 [ run ] triggered by Bot. Commit: e3040fc Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63158 [ run ] completed with state FAILURE. Commit: e3040fc
/LLM/main/L0_MergeRequest_PR pipeline #51242 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

@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63455 [ run ] triggered by Bot. Commit: e3040fc Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63455 [ run ] completed with state FAILURE. Commit: e3040fc
/LLM/main/L0_MergeRequest_PR pipeline #51425 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

@nv-lschneider

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --extra-stage "RTXPro6000D-4_GPUs-PyTorch-Post-Merge-2"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63474 [ run ] triggered by Bot. Commit: e3040fc Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63474 [ run ] completed with state SUCCESS. Commit: e3040fc
/LLM/main/L0_MergeRequest_PR pipeline #51444 completed with status: 'SUCCESS'

CI Report

Link to invocation

@Tabrizian
Tabrizian merged commit 563bf12 into NVIDIA:main Aug 3, 2026
7 checks passed
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.

6 participants