Order packed microbatches largest-first per DP rank - #3476
Open
wdykas wants to merge 1 commit into
Open
Conversation
Signed-off-by: William Dykas <73254672+wdykas@users.noreply.github.com>
shanmugamr1992
approved these changes
Aug 4, 2026
wdykas
marked this pull request as ready for review
August 4, 2026 20:56
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do ?
This PR makes it so the largest micro batches go first in packed sequence training. This is an optimization for memory. If go with the default path now where we blow up reserved memory because we keep needing new reservations for larger shapes. Then when stuff like collective buffers try to establish we can hit ooms even though we have low active memory
On nano run before:
162,286 MiB (158.5 GiB) PyTorch reserved. The job failed with only 19,191 MiB (18.7 GiB) live
After:
72,916 MiB (71.2 GiB) maximum reserved, with a 63,997 MiB (62.5 GiB) live peak
Issues
List issues that this PR closes (syntax):
Usage
# Add a code snippet demonstrating how to use thisBefore your PR is "Ready for review"
Pre checks:
Additional Information