-
Notifications
You must be signed in to change notification settings - Fork 564
Allow the ability for uneven row wise sharding based on number of buckets for zch (#3341) #3452
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
Open
nipung90
wants to merge
1
commit into
meta-pytorch:main
Choose a base branch
from
nipung90:export-D84384489
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4e65ba1
to
6d75a08
Compare
nipung90
added a commit
to nipung90/torchrec
that referenced
this pull request
Oct 15, 2025
…kets for zch (meta-pytorch#3452) Summary: X-link: meta-pytorch#3341 This diff enables the use of num_buckets ParameterConstraint in the planner. The presence of this planner will indicate the use of ZCH bucketing as part of rowwise sharding plans. ## Without num_buckets present: The current row-wise sharding strategy will be used. ## With num_buckets present: * When devices have the same amount of memory available: We will divide the buckets to be evenly distributed across hosts and distribute an additional bucket to the required number of hosts to handle the remainders. For eg. if Test case 2: hash_size = 100, num_devices = 4, num_buckets = 10 Each bucket has 10 rows, buckets distributed as [3,3,2,2] So rows are distributed as [30,30,20,20] * When devices have uneven amount of memory We will distribute the buckets in the proportion of the memory of the device to the total memory of all devices and all the remaining buckets left are stored on the last device in the case where buckets do not completely fit based on the memory ratios. for eg hash_size = 45, num_buckets = 9, bucket_size = 5 With memory ratio 2:1:1, buckets should be distributed as [4,2,3] So rows are distributed as [20,10,15] Reviewed By: kausv Differential Revision: D84384489
nipung90
added a commit
to nipung90/torchrec
that referenced
this pull request
Oct 15, 2025
…kets for zch (meta-pytorch#3452) Summary: This diff enables the use of num_buckets ParameterConstraint in the planner. The presence of this planner will indicate the use of ZCH bucketing as part of rowwise sharding plans. ## Without num_buckets present: The current row-wise sharding strategy will be used. ## With num_buckets present: * When devices have the same amount of memory available: We will divide the buckets to be evenly distributed across hosts and distribute an additional bucket to the required number of hosts to handle the remainders. For eg. if Test case 2: hash_size = 100, num_devices = 4, num_buckets = 10 Each bucket has 10 rows, buckets distributed as [3,3,2,2] So rows are distributed as [30,30,20,20] * When devices have uneven amount of memory We will distribute the buckets in the proportion of the memory of the device to the total memory of all devices and all the remaining buckets left are stored on the last device in the case where buckets do not completely fit based on the memory ratios. for eg hash_size = 45, num_buckets = 9, bucket_size = 5 With memory ratio 2:1:1, buckets should be distributed as [4,2,3] So rows are distributed as [20,10,15] Reviewed By: kausv Differential Revision: D84384489
6d75a08
to
f28119d
Compare
…kets for zch (meta-pytorch#3452) Summary: This diff enables the use of num_buckets ParameterConstraint in the planner. The presence of this planner will indicate the use of ZCH bucketing as part of rowwise sharding plans. ## Without num_buckets present: The current row-wise sharding strategy will be used. ## With num_buckets present: * When devices have the same amount of memory available: We will divide the buckets to be evenly distributed across hosts and distribute an additional bucket to the required number of hosts to handle the remainders. For eg. if Test case 2: hash_size = 100, num_devices = 4, num_buckets = 10 Each bucket has 10 rows, buckets distributed as [3,3,2,2] So rows are distributed as [30,30,20,20] * When devices have uneven amount of memory We will distribute the buckets in the proportion of the memory of the device to the total memory of all devices and all the remaining buckets left are stored on the last device in the case where buckets do not completely fit based on the memory ratios. for eg hash_size = 45, num_buckets = 9, bucket_size = 5 With memory ratio 2:1:1, buckets should be distributed as [4,2,3] So rows are distributed as [20,10,15] Reviewed By: kausv Differential Revision: D84384489
f28119d
to
5dae96c
Compare
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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
meta-exported
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
X-link: #3341
This diff enables the use of num_buckets ParameterConstraint in the planner. The presence of this planner will indicate the use of ZCH bucketing as part of rowwise sharding plans.
Without num_buckets present:
The current row-wise sharding strategy will be used.
With num_buckets present:
We will divide the buckets to be evenly distributed across hosts and distribute an additional bucket to the required number of hosts to handle the remainders.
For eg. if
Test case 2: hash_size = 100, num_devices = 4, num_buckets = 10
Each bucket has 10 rows, buckets distributed as [3,3,2,2]
So rows are distributed as [30,30,20,20]
We will distribute the buckets in the proportion of the memory of the device to the total memory of all devices and all the remaining buckets left are stored on the last device in the case where buckets do not completely fit based on the memory ratios.
for eg
hash_size = 45, num_buckets = 9, bucket_size = 5
With memory ratio 2:1:1, buckets should be distributed as [4,2,3]
So rows are distributed as [20,10,15]
Differential Revision: D84384489