Skip to content

[JAX] Fix EP=1 case in TE MoEBlock - #3725

Draft
jberchtold-nvidia wants to merge 1 commit into
NVIDIA:mainfrom
jberchtold-nvidia:jberchtold/te-jax-ep1-support
Draft

jberchtold-nvidia wants to merge 1 commit into
NVIDIA:mainfrom
jberchtold-nvidia:jberchtold/te-jax-ep1-support

Conversation

@jberchtold-nvidia

Copy link
Copy Markdown
Collaborator

Description

Please include a brief summary of the changes, relevant motivation and context.

Fixes # (issue)

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

Please list the changes introduced in this PR:

  • Change A
  • Change B

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: Jeremy Berchtold <jberchtold@nvidia.com>
@jberchtold-nvidia
jberchtold-nvidia marked this pull request as draft October 21, 2026 20:54
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches JAX expert-parallel MoE partitioning and its test setup.

The fully replicated EP=1 case should be fixed before merging.

Findings

  1. P1 Replicated batches still fail ▶

Summary

The PR allows an omitted singleton ep axis when another batch axis remains.

  • MoE partitioning accepts a missing EP axis when EP size is one.

Reviews (1) · Last reviewed commit: "Fix EP=1 case in TE MoEBlock" · Reviewed by Greptile

Comment on lines 226 to +229
if ep_axis not in elts:
return False, ep_axis, outer_axes
# JAX canonicalizes size-one mesh axes out of PartitionSpec.
if get_ep_config().ep_size != 1:
return False, ep_axis, outer_axes

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.

P1 Replicated batches still fail

With ep=1, no dp_resource or fsdp_resource, and another mesh axis spanning multiple devices, MoE assigns the batch only to ep. Once JAX removes that singleton axis, _leading_axis_ok still rejects the fully replicated spec: a leading None fails the allowed-axis check, and an empty spec fails the length check. Dispatch then raises NotImplementedError, so this valid EP=1 case still cannot compile.

Allow fully replicated leading dimensions when ep_size == 1 and add a regression test without a retained outer axis.

This branch has not been deployed

No deployments
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.

1 participant