Repository navigation
[codex] Add DMuon param policy and isolated process groups - #12
Merged
Merged
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
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.
Summary
This PR adds a structured DMuon parameter policy and isolated process group support for Pure DMuon training.
The main changes are:
param_policysupport to configure per-parameter optimizer route and dtype policy.process_group_policy="isolated"so DMuon can own dedicated communication process groups instead of reusing trainer process groups.DMUON_ISOLATED_PG_BARRIERdisabled by default to preserve cross-step overlap.Motivation
Pure DMuon integrations need more precise control than the previous global
compute_dtypeand route hint API could express. In WallX, action-headmodules may require fp32 forward compute, while the rest of the model should continue using bf16. The previous API could not represent this cleanly.
Separately, DMuon communication should not depend on trainer-owned process groups. Isolating DMuon process groups makes integration safer across
different training frameworks and avoids subtle process-group ownership or ordering issues.
Implementation Notes
dmuon.policywith structuredDMuonParamPolicy.dedicate_params()to acceptparam_policyandparam_policy_fn.route_hint_fnbehavior, but disallow mixing it with structured policy.DMUON_ISOLATED_PG_BARRIER=1; default remains off.Validation
python -m compileall -q dmuon testspython -m pytest -q tests/unit/test_param_policy.py tests/unit/test_param_policy_state_cast.py tests/unit/test_diagnostics.pytorchrun --standalone --nproc_per_node=2 tests/distributed/test_process_group_policy.py