Skip to content

Add P.UNCONSTRAINED condition in remove size one mesh axis #2947

Merged
copybara-service[bot] merged 1 commit intomainfrom
chengnuojin-debug-unconstrained
Jan 14, 2026
Merged

Add P.UNCONSTRAINED condition in remove size one mesh axis #2947
copybara-service[bot] merged 1 commit intomainfrom
chengnuojin-debug-unconstrained

Conversation

@NuojCheng
Copy link
Copy Markdown
Collaborator

@NuojCheng NuojCheng commented Jan 14, 2026

Description

For MaxText.sharding.remove_size_one_mesh_axis function we always assume the given partition spec exists in mesh, but using jax.sharding.PartitionSpec.UNCONSTRAINED violates this setting. This PR fixes this connor case to avoid possible bugs (mostly using pipeline parallelism + debug_sharding=True).

Tests

Before change: https://paste.googleplex.com/6298233649364992

After change: https://paste.googleplex.com/6317784340496384

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/MaxText/sharding.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@richjames0 richjames0 left a comment

Choose a reason for hiding this comment

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

lgtm

@copybara-service copybara-service Bot merged commit 91363de into main Jan 14, 2026
35 checks passed
@copybara-service copybara-service Bot deleted the chengnuojin-debug-unconstrained branch January 14, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants