Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[shmap/partial-auto] Fixes lowering for jax.lax.axis_index in shard_map for degenerated shmaps. #25699

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yliu120
Copy link
Contributor

@yliu120 yliu120 commented Dec 31, 2024

Please take a look at the test I added for the example.

We found that when the manual axis has size 1, the axis_index will be definitely a replicated constant 0 across all the devices. There is no need to add iota and sharding and go full to shard for that, which actually invokes a sharding normalization inside XLA.

Let's say if we do iota and adding the sharding custom ops, then the sharding will be something like,

devices=[1,8,1]<=[8] {replicated, manual} for the iota result.

Then this sharding is normalized to {replicated} in XLA. FullToShard custom call cannot take replicated sharding which will invoke a crash in GSPMD.

@yliu120
Copy link
Contributor Author

yliu120 commented Dec 31, 2024

@mattjj @pschuh @yashk2810 Can you please take a look? 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.

1 participant