-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[dev] Refactor: extract and split common logic between GDN & GDN2 (cherry-pick #5843) #6088
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
Merged
yuzhongw-nvidia
merged 22 commits into
NVIDIA:dev
from
yuzhongw-nvidia:yuzhongw/cherry-pick-pr5843-dev
Aug 17, 2026
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a46b579
refactor(ssm): replace GDN files with PR 5765
yuzhongw-nvidia c615423
chore(ssm): reapply dev GDN delta after PR 5765 split
yuzhongw-nvidia 05307f4
Update common.py
yuzhongw-nvidia b530893
fix(ssm): address GDN review comments
yuzhongw-nvidia 2ea70d3
chore(ssm): sync latest PR 5765 updates
yuzhongw-nvidia d2ac2bc
chore(deps): refresh uv lock after dev rebase
yuzhongw-nvidia 13b1952
Update megatron/core/ssm/gated_delta_net/common.py
yuzhongw-nvidia 674a3dc
fix(ssm): address GDN follow-up review comments
yuzhongw-nvidia e43376c
fix(ssm): use runtime CP size in GDN paths
yuzhongw-nvidia 3244f7e
fix(ssm): clean up GDN refactor review nits
yuzhongw-nvidia 9ef0226
fix(ssm): narrow GDN norm recompute region
yuzhongw-nvidia 782e792
chore(deps): drop unrelated GDN dependency bumps
yuzhongw-nvidia 40fb1a9
fix(ssm): revert over-scoped GDN review changes
yuzhongw-nvidia b3cc28b
Apply suggestions from code review
yuzhongw-nvidia 57af510
chore(ssm): apply autoformat fixes
yuzhongw-nvidia 07ff7a2
Update __init__.py
yuzhongw-nvidia de038b1
fix(ssm): skip deterministic GDN test for CP
yuzhongw-nvidia 080ed23
fix(ssm): keep torch GDN rule qkv names
yuzhongw-nvidia 5484feb
fix(ssm): restore pre-GDR tuple contract
yuzhongw-nvidia e398a42
test(ssm): split gated delta net unit tests
yuzhongw-nvidia fe54f6d
test(ssm): group gated delta net tests
yuzhongw-nvidia 1aa8afe
fix(deps): install TileLang for FLA on Hopper
yuzhongw-nvidia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
|
|
||
| """Gated Delta Net (GDN) layer exports. | ||
|
|
||
| This package replaces the former ``megatron/core/ssm/gated_delta_net.py`` module | ||
| at the same import path; the names below preserve that module's public surface. | ||
| """ | ||
|
|
||
| from megatron.core.ssm.gated_delta_net.common import ( | ||
| HAVE_FLA, | ||
| GatedDeltaNetSubmodules, | ||
| _build_head_perm_for_split_sections, | ||
| _build_thd_cp_a2a_perm, | ||
| _split_tensor_factory, | ||
| causal_conv1d, | ||
| chunk_gated_delta_rule, | ||
| get_parameter_local_cp, | ||
| l2norm, | ||
| tensor_a2a_cp2hp, | ||
| tensor_a2a_hp2cp, | ||
| ) | ||
| from megatron.core.ssm.gated_delta_net.gdn import GatedDeltaNet, torch_chunk_gated_delta_rule | ||
|
|
||
| __all__ = [ | ||
| "HAVE_FLA", | ||
| "GatedDeltaNet", | ||
| "GatedDeltaNetSubmodules", | ||
| "_split_tensor_factory", | ||
| "causal_conv1d", | ||
| "chunk_gated_delta_rule", | ||
| "get_parameter_local_cp", | ||
| "l2norm", | ||
| "tensor_a2a_cp2hp", | ||
| "tensor_a2a_hp2cp", | ||
| "torch_chunk_gated_delta_rule", | ||
| ] | ||
|
yuzhongw-nvidia marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
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.
The package docstring says these names "preserve that module's public surface", but the old
gated_delta_net.pyalso exported_build_head_perm_for_split_sectionsand_build_thd_cp_a2a_perm(both were imported from it bytests/unit_tests/ssm/test_gated_delta_net.pybefore this PR, and the test had to be updated to reach into.common). Re-exporting them here would make the path compatible for any out-of-tree importer:(plus the two names in
__all__). Not blocking if you consider the underscore-prefixed helpers private.