Skip to content

make FP4 param gather work with the mixed precisions in NVFP4 recipe#4358

Merged
Phlip79 merged 21 commits into
NVIDIA:mainfrom
xrennvidia:xren/fp4_param
May 22, 2026
Merged

make FP4 param gather work with the mixed precisions in NVFP4 recipe#4358
Phlip79 merged 21 commits into
NVIDIA:mainfrom
xrennvidia:xren/fp4_param

Conversation

@xrennvidia
Copy link
Copy Markdown
Contributor

@xrennvidia xrennvidia commented Apr 17, 2026

What does this PR do ?

Make --fp4-param-gather work with the mixed precisions in NVFP4 recipe.

Fixes #2284.

Contribution process

Pre-checks

  • 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

Feel free to message or comment the @mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!

All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.

Step 1: Mark PR as "Ready for Review"

  1. When your PR is ready, click Ready for Review.
  2. An oncall reviewer is auto-assigned and expert reviewers are notified based on your changes.
    • Some PRs may jump straight to step 2. This is determined by .github/CODEOWNERS.

⚠️ Only mark as ready once merge-conflicts are resolved and the CI is passing.
Final Review might get declined if these requirements are not fulfilled.

Step 2: Final Review

For PRs that change megatron/core, once all expert reviewers have approved, the Final Review label is applied automatically and final reviewers are assigned.

For PRs outside megatron/core, this step is skipped.

Step 3: Approved

Once all required reviewers have approved, the Approved label is applied automatically.

Merge

Any member of mcore-engineers will be able to merge your PR.

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.

@xrennvidia xrennvidia requested review from a team as code owners April 17, 2026 06:24
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Apr 17, 2026

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.

@github-actions
Copy link
Copy Markdown
Contributor

This PR has been automatically converted to draft because all PRs must start as drafts.

When you are ready for review, click Ready for Review to begin the review process. This will:

  1. Add the oncall reviewer (optional reviewer)
  2. Add required review teams based on your changes

See the contribution guide for more details.

@svcnvidia-nemo-ci svcnvidia-nemo-ci marked this pull request as draft April 17, 2026 06:24
@xrennvidia xrennvidia changed the title Xren/fp4 param make FP4 param gather work with the mixed precisions in NVFP4 recipe Apr 17, 2026
@xrennvidia xrennvidia marked this pull request as ready for review April 17, 2026 06:25
@svcnvidia-nemo-ci svcnvidia-nemo-ci requested a review from a team April 17, 2026 06:25
@dingqingy-nv dingqingy-nv added 26.04.01 core_r0.17.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge. labels Apr 17, 2026
@Phlip79
Copy link
Copy Markdown
Member

Phlip79 commented Apr 17, 2026

/claude review

Comment thread megatron/core/transformer/transformer_layer.py Outdated
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Review: Critical bug — TypeError when name is None

The name parameter defaults to None in all modified constructors, but is unconditionally used in string concatenation (e.g., name + ".self_attention"). The primary model construction path through TransformerBlock.build_layer in transformer_block.py does not pass name, so any model using the standard transformer block will crash with:

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

This affects all 10+ files where name + "..." concatenation was added.

Suggested fix: Update transformer_block.py:build_layer to pass a name argument (e.g., name=f"decoder.layers.{layer_number}"), and add a defensive guard or make name required to prevent future callers from hitting the same issue.

@Phlip79
Copy link
Copy Markdown
Member

Phlip79 commented Apr 17, 2026

/ok to test c6b5f06

Signed-off-by: Xiaowei Ren <xren@nvidia.com>
Signed-off-by: Xiaowei Ren <xren@nvidia.com>
Signed-off-by: Xiaowei Ren <xren@nvidia.com>
@xrennvidia xrennvidia requested a review from a team as a code owner April 20, 2026 05:20
@Phlip79 Phlip79 requested a review from a team as a code owner May 21, 2026 19:49
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the Approved All necessary approvals have been made label May 21, 2026
@Phlip79
Copy link
Copy Markdown
Member

Phlip79 commented May 21, 2026

/ok to test f326ce3

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the Approved All necessary approvals have been made label May 21, 2026
@Phlip79 Phlip79 enabled auto-merge May 21, 2026 21:03
@Phlip79 Phlip79 disabled auto-merge May 21, 2026 21:04
@Phlip79 Phlip79 added this pull request to the merge queue May 22, 2026
@svcnvidia-nemo-ci
Copy link
Copy Markdown

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/26264704092

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 22, 2026
@Phlip79
Copy link
Copy Markdown
Member

Phlip79 commented May 22, 2026

/ok to test a394695

@svcnvidia-nemo-ci
Copy link
Copy Markdown

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/26270483070

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

26.04.01 26.06 Approved All necessary approvals have been made complexity: medium core_r0.17.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--fp4-param-gather is not working correctly