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

Allow scalar all gather #5797

Merged
merged 6 commits into from
Dec 11, 2023
Merged

Allow scalar all gather #5797

merged 6 commits into from
Dec 11, 2023

Conversation

bfontain
Copy link
Contributor

This change allows all gather to work for scalars. This is supported by the normal pytorch distributed API, but if you attempt to all gather scalars under xla, a low level error is emitted as the xla gather axis, 0, is not less than the rank, also 0, of the inputs.

This is fixed by reshaping the scalar tensors to shape (1,) and then reshaping the sliced outputs back to scalars.

This was tested manually on Cloud TPU.

@bfontain bfontain requested a review from JackCaoG November 15, 2023 21:37
Copy link
Collaborator

@JackCaoG JackCaoG left a comment

Choose a reason for hiding this comment

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

Thanks! I will merge it once CI passed. (If I forgot feel free to give me a ping)

@bfontain
Copy link
Contributor Author

bfontain commented Dec 7, 2023

Ping on this PR, the failing tests seem unrelated to this change.

@JackCaoG
Copy link
Collaborator

JackCaoG commented Dec 7, 2023

sorry my bad.. should of merge it earlier. Do you mind resolve the merge conflict and rebase? Do you need this to backport to 2.2 release?

@bfontain
Copy link
Contributor Author

bfontain commented Dec 7, 2023

Resolved the conflict and no need to backport.

@JackCaoG
Copy link
Collaborator

JackCaoG commented Dec 7, 2023

sg, I will merge it once all ci passed.

@JackCaoG JackCaoG merged commit b224350 into pytorch:master Dec 11, 2023
6 of 7 checks passed
@bfontain
Copy link
Contributor Author

Thanks!

chunnienc pushed a commit to chunnienc/xla that referenced this pull request Dec 14, 2023
golechwierowicz pushed a commit that referenced this pull request Jan 12, 2024
bhavya01 pushed a commit that referenced this pull request Apr 22, 2024
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