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

[BE] replace the extra DeviceMesh _flatten with mesh access #667

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

XilunWu
Copy link
Contributor

@XilunWu XilunWu commented Oct 31, 2024

Stack from ghstack (oldest at bottom):

Note: This PR is a reland of #666 where the PR was mistakenly merged into a wrong branch.

Summary
pytorch/pytorch#138945 fixes DeviceMesh access on flattened mesh which are constructed from more than 2 meshes. Refer to the fix PR for details if interested.

In #592 we avoided this issue by calling _flatten instead of direct accessing the flattened mesh. We want to turn back to mesh access which is more straightforward since the fix has been merged in PyTorch.

… with mesh access"


**Summary**
pytorch/pytorch#138945 fixes DeviceMesh access on flattened mesh which are constructed from more than 2 meshes. Refer to the fix PR for details if interested.

In #592 we avoided this issue by calling `_flatten` instead of direct accessing the flattened mesh. We want to turn back to mesh access which is more straightforward since the fix has been merged in PyTorch.


[ghstack-poisoned]
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* __->__ #666

**Summary**
pytorch/pytorch#138945 fixes DeviceMesh access
on flattened mesh which are constructed from more than 2 meshes. Refer
to the fix PR for details if interested.

In #592 we avoided this issue by calling `_flatten` instead of direct
accessing the flattened mesh. We want to turn back to mesh access which
is more straightforward since the fix has been merged in PyTorch.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 31, 2024
@XilunWu XilunWu changed the title Gh/xilun wu/9/base [BE] replace the extra DeviceMesh _flatten with mesh access Oct 31, 2024
@XilunWu XilunWu requested a review from tianyu-l October 31, 2024 05:39
Copy link
Contributor

@fegin fegin left a comment

Choose a reason for hiding this comment

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

stamped as it was approved in another PR.

# note: this is a workaround of the above logic for old pytorch version
# where https://github.com/pytorch/pytorch/pull/138945 is not included
# throw a warning to encourage users to upgrade to a newer pytorch version
check_if_feature_in_pytorch(
Copy link
Contributor

Choose a reason for hiding this comment

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

@fegin
Since we are already suggesting user to use latest PyTorch nightly, I wonder how necessary it is to include such messages, as multiple features would depend on non-stable release. E.g. for PP, we constantly see new features, without such try-catches.

Not saying this is not good, but there seems to be a trade-off / sacrifice for dev velocity and simplicity.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm okay to remove it. Or we can periodically cleanup (like weekly). In general, this is not just for the end users but also for developers like us who may not up the local PyTorch reguarly.

@XilunWu XilunWu merged commit d7cabfb into main Oct 31, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants