-
Notifications
You must be signed in to change notification settings - Fork 24.9k
[dcp][hf] Improve HF consolidation algorithm #158648
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
Conversation
Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written Differential Revision: [D78489438](https://our.internmc.facebook.com/intern/diff/D78489438/) [ghstack-poisoned]
Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written Differential Revision: [D78489438](https://our.internmc.facebook.com/intern/diff/D78489438/) ghstack-source-id: 297076053 Pull Request resolved: #158648
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/158648
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New FailuresAs of commit 2c6ae1f with merge base f077c24 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D78489438 |
Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written Differential Revision: [D78489438](https://our.internmc.facebook.com/intern/diff/D78489438/) cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta [ghstack-poisoned]
Pull Request resolved: #158648 Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written ghstack-source-id: 297088500 @exported-using-ghexport Differential Revision: [D78489438](https://our.internmc.facebook.com/intern/diff/D78489438/)
This pull request was exported from Phabricator. Differential Revision: D78489438 |
Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written Differential Revision: [D78489438](https://our.internmc.facebook.com/intern/diff/D78489438/) cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D78489438 |
and finding natural boundaries where contiguity breaks. | ||
""" | ||
# Start with elements remaining in the last dimension | ||
max_contiguous = sub_tensor_shape[-1] - indices[-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some validations on the input lists here and log the appropriate errors to avoid index out of bounds errors later which become hard to debug.
sub_tensor_shape[0] == tensor_shape[0] | ||
and sub_tensor_shape[1] < tensor_shape[1] | ||
) | ||
def _calculate_max_contiguous_elements( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method needs robust UT.
Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written Differential Revision: [D78489438](https://our.internmc.facebook.com/intern/diff/D78489438/) cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta [ghstack-poisoned]
Pull Request resolved: #158648 Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written ghstack-source-id: 301722789 @exported-using-ghexport Differential Revision: [D78489438](https://our.internmc.facebook.com/intern/diff/D78489438/)
This pull request was exported from Phabricator. Differential Revision: D78489438 |
Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written Differential Revision: [D78489438](https://our.internmc.facebook.com/intern/diff/D78489438/) cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta [ghstack-poisoned]
Pull Request resolved: #158648 Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written ghstack-source-id: 301740422 @exported-using-ghexport Differential Revision: [D78489438](https://our.internmc.facebook.com/intern/diff/D78489438/)
This pull request was exported from Phabricator. Differential Revision: D78489438 |
@pytorchmergebot merge -i |
Merge startedYour change will be merged while ignoring the following 4 checks: pull / linux-jammy-py3.13-clang12 / test (dynamo_wrapped, 2, 3, lf.linux.2xlarge), pull / linux-jammy-py3.13-clang12 / test (dynamo_wrapped, 1, 3, lf.linux.2xlarge), pull / linux-jammy-py3.9-clang12 / test (dynamo_wrapped, 1, 3, lf.linux.2xlarge), pull / linux-jammy-py3.9-clang12 / test (dynamo_wrapped, 2, 3, lf.linux.2xlarge) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
Before we had a bunch of if-else cases based on sharding strategy to decide how to save the tensor with different logic for different strategies. This can be consolidated into one function that uses an algorithm to handle all cases by finding the max possible contiguous bytes that can be written
Differential Revision: D78489438
cc @H-Huang @awgu @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @pragupta