Skip to content

[JAX] Support single-process-multi-device EP via XLA-borrowed communicator - #3522

Open
phu0ngng wants to merge 3 commits into
NVIDIA:mainfrom
phu0ngng:ep_jax_single_process_backup
Open

phu0ngng wants to merge 3 commits into
NVIDIA:mainfrom
phu0ngng:ep_jax_single_process_backup

Conversation

@phu0ngng

Copy link
Copy Markdown
Collaborator

Description

Support single-process, multi-device JAX EP using XLA-borrowed NCCL communicators.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

  • Manage EP initialization, state, and teardown per device.
  • Size-handle buffers across local devices and reject undersized buffers.
  • Update bootstrap, launchers, examples, and tests for multi-device execution.

Testing

  • EP guard/grouping tests: 7 passed, 1 skipped.
  • All pre-commit checks passed.

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@phu0ngng
phu0ngng requested a review from tdophung September 15, 2026 19:52
@phu0ngng phu0ngng changed the title [JAX] Support single-process, multi-device NCCL EP via XLA-borrowed communicator [JAX] Support single-process-multi-device EP via XLA-borrowed communicator Sep 15, 2026
@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable correctness, security, or repository-rule violations remain.

Summary

This PR adds JAX expert-parallel support for multiple devices controlled by one process using XLA-borrowed NCCL communicators.

  • Stores and tears down EP backend state per CUDA device.
  • Bootstraps borrowed communicators according to JAX mesh EP replica groups.
  • Validates handle-buffer sizes before NCCL EP operations.
  • Adds single-process examples, multi-device launch configurations, and EP lifecycle/grouping tests.
  • Preserves the positional ep_bootstrap API highlighted in the previous review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[JAX ep_bootstrap] --> B{Multiple local devices?}
    B -->|No| C[Self-hosted or borrowed communicator]
    B -->|Yes| D{XLA borrowed communicator available?}
    D -->|No| E[Reject bootstrap]
    D -->|Yes| F[Derive EP replica groups from mesh]
    F --> G[XLA bootstrap executes on each device]
    G --> H[Initialize per-device EPBackend]
    H --> I[Query maximum handle size across devices]
    I --> J[Prepare / dispatch / combine]
    J --> K[Finalize all device backends concurrently]
Loading

Reviews (4) · Last reviewed commit: "[JAX] Preserve positional EP bootstrap a..."

Comment thread transformer_engine/jax/ep.py Outdated
def test_raises_when_borrowed_comm_unavailable(self):
import transformer_engine.jax.ep as ep_mod

with mock.patch.object(ep_mod.jax, "local_device_count", return_value=2), mock.patch.object(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I like this mocking of tests to test our error paths too!

@jberchtold-nvidia jberchtold-nvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great! Thanks!

Once CI passes, all good to merge from my side

phu0ngng and others added 3 commits September 17, 2026 19:16
Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
@phu0ngng

Copy link
Copy Markdown
Collaborator Author

/te-ci L1 JAX

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.

2 participants