Repository navigation
[fsdp, model, training_utils, hardware] feat: add MXFP QAT for dense linear and MoE - #1
Merged
Sunwish merged 6 commits intoOct 29, 2026
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.
What does this PR do?
Adds configurable MXFP QAT support to the FSDP2 engine for dense linear layers and packed MoE experts.
The implementation supports MXFP8 W8A8 on the Ascend NPU backend and MXFP4 modes through the Torch QDQ backend. Dense linear layers can independently apply fake quantization and optional seeded block rotation to fprop, dgrad, and wgrad. The MoE path applies QAT at the packed NPU grouped-matmul boundary.
Related work includes #7895, which adds Megatron/ModelOpt MXFP4 expert weight QAT, #8353, which adds MiniMax M3-specific activation QAT, and #6992, which adds W4A8 QAT simulation. This PR adds a configurable FSDP2 path for dense linear transforms and Ascend packed MoE grouped matmuls.
Checklist Before Starting
[fsdp, model, training_utils, hardware] feat: add MXFP QAT for dense linear and MoE.Test
git diff --check f5aabaff..19f96b16passed.python -m pytest tests/utils/test_mxfp_quant_cpu.py tests/utils/test_mxfp_moe_cpu.py -q; collection could not run because PyTorch is not installed in the current environment.API and Usage Example
Example FSDP2 engine configuration for MXFP8 QAT on Ascend: