fix(fsdp): recognize legacy GDN TP metadata#4664
Open
Glitchfix wants to merge 4 commits intoNVIDIA:mainfrom
Open
fix(fsdp): recognize legacy GDN TP metadata#4664Glitchfix wants to merge 4 commits intoNVIDIA:mainfrom
Glitchfix wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
966d3b8 to
26e76ec
Compare
GDN conv1d parameters use Megatron's legacy tensor_model_parallel and partition_dim attributes. The FSDP DTensor checkpoint splitter copies those attributes to meta tensors before calling make_fsdp_dtensor, but the FSDP TP detection path only handled _tensor_parallel_mode. Honor the legacy metadata so split GDN checkpoint tensors keep the TP placement and validate against the full FSDP plus TP mesh. Add regression coverage for copied legacy TP attributes and replicated attributes. Fixes NVIDIA#4553. Signed-off-by: Shivanjan Chakravorty <shivanjanc@nvidia.com>
26e76ec to
5bd5fec
Compare
Member
|
/ok to test e7c49ea |
Member
|
/ok to test 118a63e |
Member
|
@Glitchfix FYI don't rebase on |
Author
gotcha, will be careful for upcoming PRs |
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 ?
Fix Megatron-FSDP DTensor checkpoint saving for GDN fused tensors whose copied meta tensors only carry legacy Megatron tensor-parallel metadata.
GDN conv1d parameters are annotated with
tensor_model_parallelandpartition_dim.handle_gdn_in_state_dict()copies those attributes to meta tensors before callingmake_fsdp_dtensor(), but the FSDP tensor-parallel detection path only recognized_tensor_parallel_mode. This could make split GDN checkpoint tensors lose their TP placement and validate against a DP-only mesh.This change makes Megatron-FSDP recognize the legacy TP attributes documented by
make_fsdp_dtensor().Issue tracking
Linked issue: Fixes #4553
Validation
tools/autoformat.shviauv run --with black --with isort --with pylint --with ruff --with mypy tools/autoformat.shblack,isort,pylint, andruffpassed; no files were modified.mypyreported environment missing-import/type issues in the checked files, and the script ignores mypy failures by design.pytest -q tests/unit_tests/transformer/test_fsdp_dtensor_checkpoint.py(58 passed)git diff --checkContribution process
Pre-checks