Skip to content

[JAX] Migrate EP collective-stream annotation to compute_on2 - #3304

Open
phu0ngng wants to merge 1 commit into
NVIDIA:mainfrom
phu0ngng:jax_compute_on_version
Open

[JAX] Migrate EP collective-stream annotation to compute_on2#3304
phu0ngng wants to merge 1 commit into
NVIDIA:mainfrom
phu0ngng:jax_compute_on_version

Conversation

@phu0ngng

@phu0ngng phu0ngng commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Recent JAX removed jax.experimental.compute_on.compute_on in favor of compute_on2, breaking the import of ep.py (the annotation decorates EP helpers at module load). This migrates to compute_on2.

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

  • _on_collective_stream uses compute_on2, closing over the static EpLayerConfig/PartitionSpec args in a nullary thunk since compute_on2 abstract-evals every argument.
  • compute_on2 moves _xla_stream_annotation onto the async wrapper XLA generates, so test_z_dispatch_combine_on_collective_stream now checks each EP call is reachable from a collective-annotated wrapper.
  • compute_on2 and jax.memory.Space exist since JAX 0.10.1, the current collective-stream floor, so no min-version bump is needed.

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

Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
@phu0ngng

phu0ngng commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Pipeline #60891724 with the nightly JAX image.

@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Migrates JAX expert-parallel collective-stream annotation from the removed compute_on API to compute_on2.

  • Wraps EP helper calls in nullary thunks so static configuration arguments are captured rather than abstract-evaluated as operands.
  • Places outputs in device memory while scheduling the generated async wrapper on the collective stream.
  • Updates the multi-process HLO test to verify that every EP custom call is transitively reachable from a collective-annotated wrapper.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

The implementation preserves the compatibility fallback and the updated distributed compilation test exercises the new wrapper while checking that all emitted EP custom calls remain under collective-stream-annotated computations.

Important Files Changed

Filename Overview
transformer_engine/jax/cpp_extensions/ep.py Replaces the removed compute_on decorator with a compute_on2 thunk wrapper while retaining the existing version-based no-op fallback.
tests/jax/test_multi_process_ep.py Reworks the collective-stream assertion to follow HLO call edges from annotated async wrappers to nested EP custom calls.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[EP helper invocation] --> B[Nullary thunk captures static config and array operands]
  B --> C[compute_on2 collective-stream annotation]
  C --> D[XLA async wrapper]
  D --> E[EP FFI custom call]
  F[HLO regression test] --> G[Parse computations and call edges]
  G --> H[Verify each EP call is reachable from an annotated wrapper]
  H --> E
Loading

Reviews (1): Last reviewed commit: "[JAX] Migrate EP collective-stream annot..." | Re-trigger Greptile

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

LGTM, thanks!

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