Skip to content

feat(megatron): select MXFP4 forward precision - #986

Merged
gphuang merged 2 commits into
fix/megatron/energon-resume-statefrom
feat/megatron/mxfp4-forward-precision
Aug 13, 2026
Merged

feat(megatron): select MXFP4 forward precision#986
gphuang merged 2 commits into
fix/megatron/energon-resume-statefrom
feat/megatron/mxfp4-forward-precision

Conversation

@gphuang

@gphuang gphuang commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Tracks Issue 220.

Add independent MXFP4 forward precision selection so late recovery runs can use FP8 or BF16 forward GEMMs while keeping MXFP4 data- and weight-gradient GEMMs.

  • Add fail-closed mxfp4_forward_precision config plumbing and runtime mode census.
  • Reuse existing FP8 and BF16 operators; no new kernel implementation.
  • Cover direct autograd, compile, Flux integration, config validation, and audit modes.

Test plan

  • Python compile check
  • git diff --check
  • Targeted CPU-safe unit tests in the v26.5 container
  • MI355X direct linear and Flux 535M forward/backward tests
  • Option 6/7 resume smoke with exact mode census

Guangpu Huang added 2 commits August 13, 2026 15:34
Allow late-stage recovery runs to raise only forward GEMM precision while retaining the validated MXFP4 backward path.
Exercise FP8 and BF16 forward paths through PrimusUT-compatible subtests and align the precision census assertion with logger output.
@gphuang

gphuang commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Verdict: forward-only MXFP4 routing approved

No blocking findings in the full base-to-head diff through add77c6.

  • Verified FP8/BF16 forward routing while MXFP4 backward remains unchanged.
  • Verified autograd arity, saved tensors, fail-closed config, audit census, and test coverage.
  • GPU checks passed for numerical finiteness, zero graph breaks, and the Flux integration path.
  • Required CI checks are green.

Ready to merge.

@gphuang
gphuang marked this pull request as ready for review August 13, 2026 16:26
@gphuang
gphuang merged commit 1e3c9ac into fix/megatron/energon-resume-state Aug 13, 2026
7 checks passed
gphuang added a commit that referenced this pull request Aug 13, 2026
## Summary

Closes the post-merge review gap from PR #986.

Adds regression coverage for FP8/BF16 forward with MXFP4 backward
through `torch.compile`, including exact eager/compiled output and
gradient comparisons. It also covers YAML-to-`FluxConfig` precision
propagation and runtime mode-census emission.

## Test plan

- [x] 35 config and audit tests passed
- [x] Compiled-backward checks passed for FP8 and BF16 forward modes
- [x] Flux 535M forward-only integration test passed
- [x] `black` formatting verified
- [x] GPU memory returned to idle

Co-authored-by: Guangpu Huang <guangphu@crs-m2m-cpu-spur-012.us-east2-a.compute.internal>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant