Skip to content

Adding NVRx as a dependency and keeping the current code base optionally#3899

Merged
ko3n1g merged 69 commits intoNVIDIA:mainfrom
sbak5:sbak/ckpt_migrate
Mar 31, 2026
Merged

Adding NVRx as a dependency and keeping the current code base optionally#3899
ko3n1g merged 69 commits intoNVIDIA:mainfrom
sbak5:sbak/ckpt_migrate

Conversation

@dimapihtar
Copy link
Copy Markdown
Contributor

@dimapihtar dimapihtar commented Mar 17, 2026

What does this PR do ?

  1. Adds NVRx async save routines and deprecates mcore's.
  2. Introduces async_strategy param to make it configurable from the user perspective.
  3. NVRx strategy is set as default async strategy. MCore's async strategy will be used if NVRx is not installed.
  4. Still possible to use MCore's async strategy by setting --async-strategy mcore.
  5. Keeps mcore's async strategy for backward compatibility but will be fully removed and subsituted with related nvrx solution in 1-2 releases.

⚠️ For major changes (either in lines of code or in its impact), please make sure to first share a design doc with the team. If you're unsure what's the best way to do so, contact the @mcore-oncall.

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.

sbak5 and others added 4 commits March 12, 2026 17:15
Fix dequantize check to use `"dequantize" in type(ten).__dict__` instead
of `hasattr(ten, "dequantize")`. The latter returns True for all
torch.Tensor objects since dequantize is defined on the base class,
causing RuntimeError on non-quantized tensors. The new check only matches
TE subclasses (e.g. Float8Tensor, MXFP8Tensor) that define their own
dequantize override.
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Mar 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.

Signed-off-by: dimapihtar <dpihtar@gmail.com>
Signed-off-by: dimapihtar <dpihtar@gmail.com>
Signed-off-by: dimapihtar <dpihtar@gmail.com>
@sbak5
Copy link
Copy Markdown
Contributor

sbak5 commented Mar 17, 2026

/claude review

@sbak5 sbak5 changed the title Sbak/ckpt migrate Adding NVRx as a dependency and keeping the current code base optionally Mar 17, 2026
dimapihtar and others added 7 commits March 18, 2026 06:16
Signed-off-by: dimapihtar <dpihtar@gmail.com>
Signed-off-by: dimapihtar <dpihtar@gmail.com>
Signed-off-by: dimapihtar <dpihtar@gmail.com>
Signed-off-by: dimapihtar <dpihtar@gmail.com>
Signed-off-by: dimapihtar <dpihtar@gmail.com>
Signed-off-by: dimapihtar <dpihtar@gmail.com>
@dimapihtar dimapihtar marked this pull request as ready for review March 18, 2026 14:31
@dimapihtar dimapihtar requested review from a team as code owners March 18, 2026 14:31
@svcnvidia-nemo-ci svcnvidia-nemo-ci requested a review from a team March 18, 2026 14:31
@dimapihtar
Copy link
Copy Markdown
Contributor Author

/ok to test cc6fd79

@svcnvidia-nemo-ci svcnvidia-nemo-ci added this to the Core 0.16 milestone Mar 18, 2026
@dimapihtar dimapihtar added the Expert Review [deprecated] Apply this label to indicate that your PR is ready for expert review. label Mar 18, 2026
@dimapihtar dimapihtar requested a review from yaoyu-33 March 30, 2026 19:22
Signed-off-by: dimapihtar <dpihtar@gmail.com>
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the Final Review PR is in the "final review" stage label Mar 30, 2026
Signed-off-by: dimapihtar <dpihtar@gmail.com>
Signed-off-by: dimapihtar <dpihtar@gmail.com>
@dimapihtar
Copy link
Copy Markdown
Contributor Author

/ok to test 7d7feb7

- Add `_get_async_calls_queue()` helper for lazy initialization of the async
  calls queue, defaulting async_strategy to "nvrx" if not set in args
- Guard `maybe_finalize_async_save` and `is_empty_async_queue` against an
  uninitialized (`None`) queue to avoid crashes when no save has been scheduled
- Use `getattr` with default for `async_strategy` and
  `use_persistent_ckpt_worker` to handle missing args gracefully
- Revert removal of `async_save=True` from `test_basic_save_load_scenarios`
  and `test_local_ckpt_sharded_state_dict` parametrized tests, restoring
  async save coverage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sbak5
Copy link
Copy Markdown
Contributor

sbak5 commented Mar 31, 2026

/ok to test 68032da

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the Approved All necessary approvals have been made label Mar 31, 2026
@sbak5 sbak5 added this pull request to the merge queue Mar 31, 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/23782767378

@jaredcasper jaredcasper removed this pull request from the merge queue due to a manual request Mar 31, 2026
@ko3n1g ko3n1g added this pull request to the merge queue Mar 31, 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/23783170460

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 31, 2026
@ko3n1g ko3n1g added this pull request to the merge queue Mar 31, 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/23785072671

Merged via the queue into NVIDIA:main with commit 704c7ee Mar 31, 2026
133 of 135 checks passed
ko3n1g added a commit that referenced this pull request Apr 4, 2026
ko3n1g added a commit that referenced this pull request Apr 4, 2026
ko3n1g added a commit that referenced this pull request Apr 4, 2026
ko3n1g added a commit that referenced this pull request Apr 4, 2026
ko3n1g added a commit that referenced this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved All necessary approvals have been made complexity: medium Expert Review [deprecated] Apply this label to indicate that your PR is ready for expert review. Run functional tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants