Skip to content

[MoE]Enable Casting-Free FP8-Flow-MoE Blockwise FP8 Dataflow#2764

Open
xiaoxi-wangfj wants to merge 7 commits into
NVIDIA:mainfrom
021ai:FP8-Flow-MoE
Open

[MoE]Enable Casting-Free FP8-Flow-MoE Blockwise FP8 Dataflow#2764
xiaoxi-wangfj wants to merge 7 commits into
NVIDIA:mainfrom
021ai:FP8-Flow-MoE

Conversation

@xiaoxi-wangfj

@xiaoxi-wangfj xiaoxi-wangfj commented Dec 26, 2025

Copy link
Copy Markdown
Contributor

What does this PR do ?

This PR introduces a set of FP8-centric MoE dataflow optimizations that improve FP8 communication performance and reduce CPU overhead through operator fusion, while maintaining numerical stability in existing FP8 training workflows.

This PR is designed to be used in conjunction with PR NVIDIA/TransformerEngine#2544

Further optimizations are introduced via two additional PRs:

Background / Motivation

Detailed optimization points are described in the joint PR NVIDIA/TransformerEngine#2544

Contribution process

flowchart LR
    A[Pre-checks] --> B[PR Tests]
    subgraph Code Review/Approval
        C1[Expert Review] --> C2[Final Review]
    end
    B --> C1
    C2 --> D[Merge]
Loading

Pre-checks

  • I want this PR in a versioned release and have added the appropriate Milestone (e.g., Core 0.8)
  • I have added relevant unit tests
  • I have added relevant functional tests
  • I have added proper typing to my code Typing guidelines
  • I have added relevant documentation
  • I have run the autoformatter.sh on my PR

Code review

The following process is enforced via the CODEOWNERS file for changes into megatron/core. For changes outside of megatron/core, it is up to the PR author whether or not to tag the Final Reviewer team.

For MRs into `main` branch

(Step 1): Add PR label Expert Review

(Step 2): Collect the expert reviewers reviews

  1. Attach the Expert Review label when your PR is ready for review.
  2. GitHub auto-assigns expert reviewers based on your changes. They will get notified and pick up your PR soon.

⚠️ Only proceed to the next step once all reviewers have approved, merge-conflict are resolved and the CI is passing.
Final Review might get declined if these requirements are not fulfilled.

(Step 3): Final Review

  1. Add Final Review label
  2. GitHub auto-assigns final reviewers based on your changes. They will get notified and pick up your PR soon.

(Optional Step 4): Cherry-pick into release branch

If this PR also needs to be merged into core_r* release branches, after this PR has been merged, select Cherry-pick to open a new PR into the release branch.

For MRs into `dev` branch The proposed review process for `dev` branch is under active discussion.

MRs are mergable after one approval by either eharper@nvidia.com or zijiey@nvidia.com.

Merging your PR

Any member of core-adlr and core-nemo will be able to merge your PR.

@copy-pr-bot

copy-pr-bot Bot commented Dec 26, 2025

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@xiaoxi-wangfj xiaoxi-wangfj marked this pull request as ready for review December 29, 2025 08:18
@xiaoxi-wangfj xiaoxi-wangfj requested review from a team as code owners December 29, 2025 08:18
@github-actions github-actions Bot requested a review from Phlip79 December 29, 2025 08:19
@chtruong814 chtruong814 added the needs-follow-up Issue needs follow-up label Jan 11, 2026
@yanring yanring requested a review from yaox12 January 14, 2026 02:21
@Phlip79 Phlip79 removed their request for review January 30, 2026 19:06
@Phlip79 Phlip79 added the Expert Review [deprecated] Apply this label to indicate that your PR is ready for expert review. label Jan 30, 2026
@Phlip79

Phlip79 commented Apr 3, 2026

Copy link
Copy Markdown
Member

Can you please add tests for the new features?

@chtruong814 chtruong814 removed the needs-follow-up Issue needs follow-up label Apr 3, 2026
1. Quantize activations to FP8 before deepep token dispatch.
2. Feed FP8 activations directly into expert up-projection.
3. Fusion act func and quantize.
4. Add fine-grained recompute `moe_expert`.

Signed-off-by: xiaoxi-wangfj <690912414@qq.com>
Co-authored-by: dantesuu@gmail.com
Co-authored-by: xzhu@zhejianglab.org
Co-authored-by: 123sssmmm@gmail.com
1. Quantize activations to FP8 before deepep token dispatch.
2. Feed FP8 activations directly into expert up-projection.
3. Fusion act func and quantize.
4. Add fine-grained recompute `moe_expert`.

Signed-off-by: xiaoxi-wangfj <690912414@qq.com>
Co-authored-by: dantesuu@gmail.com
Co-authored-by: xzhu@zhejianglab.org
Co-authored-by: 123sssmmm@gmail.com
Signed-off-by: xiaoxi.wangfj <690912414@qq.com>
Signed-off-by: xiaoxi.wangfj <690912414@qq.com>
@chtruong814 chtruong814 added the needs-follow-up Issue needs follow-up label Apr 9, 2026

@Phlip79 Phlip79 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests

@ericharper ericharper assigned Phlip79 and unassigned ilml Apr 10, 2026
@ericharper ericharper removed the needs-follow-up Issue needs follow-up label Apr 10, 2026
@chtruong814 chtruong814 added the needs-follow-up Issue needs follow-up label Apr 10, 2026
@chtruong814 chtruong814 added waiting-on-customer Waiting on the original author to respond and removed needs-follow-up Issue needs follow-up labels Apr 18, 2026
Signed-off-by: xiaoxi.wangfj <690912414@qq.com>
@xiaoxi-wangfj xiaoxi-wangfj requested a review from a team as a code owner April 19, 2026 07:38
Signed-off-by: xiaoxi.wangfj <690912414@qq.com>
@xiaoxi-wangfj

Copy link
Copy Markdown
Contributor Author

@Phlip79 tests are added.

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-customer Waiting on the original author to respond label Apr 29, 2026
@Phlip79

Phlip79 commented Apr 29, 2026

Copy link
Copy Markdown
Member

/claude review

@Phlip79 Phlip79 removed the Expert Review [deprecated] Apply this label to indicate that your PR is ready for expert review. label Apr 29, 2026
Comment thread megatron/core/transformer/moe/fused_a2a.py
Comment thread megatron/core/transformer/transformer_config.py

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small issues flagged inline:

  1. Bug in FusedCombine.forward (fused_a2a.py:201-202): ctx.fp8_recipe = config.fp8_recipe will crash when config is None — the preceding line correctly guards against this but this one doesn't.

  2. Typo in error message (transformer_config.py:1436): "moe_expert recompute_modules is supported fp8 blockwise recipe" is missing "only" and "with".

@Phlip79

Phlip79 commented Apr 29, 2026

Copy link
Copy Markdown
Member

/ok to test 2dfcf5c

@Phlip79 Phlip79 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix Claude's comments

@svcnvidia-nemo-ci svcnvidia-nemo-ci added waiting-on-customer Waiting on the original author to respond waiting-on-maintainers Waiting on maintainers to respond and removed waiting-on-customer Waiting on the original author to respond labels Apr 30, 2026
Signed-off-by: xiaoxi.wangfj <690912414@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants