Skip to content

Allow fine-grained offloading with MC impl of full-CG. - #4253

Merged
yaox12 merged 5 commits into
NVIDIA:devfrom
rapatel:ripatel/cg_offload_assertion_dev
Apr 17, 2026
Merged

yaox12 merged 5 commits into
NVIDIA:devfrom
rapatel:ripatel/cg_offload_assertion_dev

Conversation

@rapatel

@rapatel rapatel commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

⚠️ 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.

@rapatel
rapatel requested review from a team as code owners April 10, 2026 16:28
@copy-pr-bot

copy-pr-bot Bot commented Apr 10, 2026

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.

@rapatel

rapatel commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

@lhb8125

lhb8125 commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

/ok to test b8a7993

@rapatel
rapatel requested review from a team as code owners April 17, 2026 04:27
@yaox12
yaox12 removed request for a team April 17, 2026 07:21
@yaox12

yaox12 commented Apr 17, 2026

Copy link
Copy Markdown
Member

/ok to test e0ddd84

@yaox12
yaox12 enabled auto-merge April 17, 2026 07:29
@yaox12

yaox12 commented Apr 17, 2026

Copy link
Copy Markdown
Member

/ok to test 4919450

@yaox12
yaox12 added this pull request to the merge queue Apr 17, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

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

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 17, 2026
@yaox12
yaox12 added this pull request to the merge queue Apr 17, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

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

Merged via the queue into NVIDIA:dev with commit 6efb083 Apr 17, 2026
92 of 100 checks passed
nemo-autobot-origin Bot pushed a commit to svcnemo-autobot/Megatron-LM that referenced this pull request Nov 2, 2026
Single repair commit for the main slice 5812485 -> dev merge.

- ssm/kda: restore dev's `False` distribute_saved_activations argument
  in both KDA recompute checkpoints. The kda.py conflict resolution had
  taken main NVIDIA#7054's config read; dev's recompute contract (NVIDIA#8203,
  test_gdn_quantized_recompute) passes False, as dev's GDN does.
- tests/models/test_hybrid_mhc: main NVIDIA#7555 replaced mtp_layer_pattern
  with mtp_layer_config_list; assert the new attributes instead.
- tests/transformer/moe/test_route_metadata_cpu: the dispatcher test
  double accepts packed_seq_params, which main NVIDIA#8458 now passes.
- tests/transformer/test_attention_output_gate: the KDA test double sets
  two_stage_gates=False, read by main NVIDIA#7054's _apply_gated_norm.
- tests/data/test_get_batch: stub dev's prepare_packed_seq_params hook
  in main NVIDIA#8525's config-cache test; all main assertions are kept.
- ssm/kda: keep dev's direct-gate op order in _apply_gated_norm (norm,
  then gate reshape). main NVIDIA#7054 reshaped the gate first, which changed the
  compiled rounding that dev NVIDIA#8006's test_kda_gated_norm_preserves_upstream_
  rounding pins; main's two-stage branch is unchanged.
- tests/data/test_pretrain_gpt_dataset_config: main NVIDIA#8391 replaced
  pretrain_gpt's build_tokenizer(args) with get_tokenizer(); the dev test
  now patches get_tokenizer. Its assertion is unchanged.
- ssm/kda_layer_config: run validate_kda() before TransformerConfig's
  __post_init__ as well as after it. Dev NVIDIA#6556's shared GDN-family
  assertions ran first and preempted the KDA ValueErrors that main
  NVIDIA#7054's test_kda config tests expect. Dev's plain TransformerConfig
  checks are unchanged.
- tests/transformer/test_thd_cuda_graph: the dev HybridModel test double
  sets hybrid_layer_config_list=None, which main NVIDIA#7555 reads in
  HybridModel.forward. Main NVIDIA#7555 made the same change to its own hybrid
  test doubles. The test assertions are unchanged.
- functional goldens: refresh dev_dgx_h100 golden values for the four
  gpt3_mcore_te_tp2_pp2 mHC cases after main NVIDIA#7521 changed their
  numerics (local H100 runs on merge 44a8771).
- tests/unit_tests/ssm/test_kda.py: keep dev NVIDIA#6556 kda_safe_gate/kda_lower_bound on
  TransformerConfig (CLI flags); main NVIDIA#7054 placement check now excludes only those two
  fields and asserts they stay on the stack config.
- tests/unit_tests/ssm/test_kda.py: main NVIDIA#7054's recompute-acceptance test
  builds a non-hybrid experimental_attention_variant="kda" config. Dev NVIDIA#6556
  registers kda as a GDN-family variant, and dev requires
  linear_attention_freq for every standalone GDN-family model, so the kda
  case now passes linear_attention_freq=[1]. Dev's validation and the
  test assertion are unchanged.
- docker: pin the ARM64 MoK build to main NVIDIA#8210's 7a8cfb7f. The merged
  MoK backend passes shared_output_gate_weight to mok.functional.forward,
  and main's test_mok_numerics runs that path on GB200. Dev's a2ad2d0c
  pin does not accept the argument (GB200 CI TypeError in
  test_real_mok_ddp_numerics). 7a8cfb7f is a fast-forward of a2ad2d0c
  (2 commits) that already contains both hunks of dev's
  docker/patches/mok.patch, so the patch, its bind mount and the
  install_mok.sh patch argument are removed as on main, and the MoE
  README names the new snapshot. The AMD64 (H100) image still skips MoK;
  the rest of dev's Dockerfile.ci.dev is unchanged.

- .github/workflows/cicd-main.yml: NVIDIA-NeMo/RL 4aaa48fa (NVIDIA#4253) renamed
  tests/functional/L1_Functional_Tests_Megatron_4.sh to
  L1_Functional_Tests_Megatron_Generation.sh, so the NeMo RL dispatch
  pattern matched no script and the downstream pre-flight failed with
  "No test scripts match the requested selection". Point the pattern
  at the renamed script. Dev and main carry the same stale pattern.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>

This branch was previously deployed

1 inactive deployment
test — 4919450b Deployed Apr 17, 2026 by copy-pr-bot[bot] via cicd-wait-in-queue #11686
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.

4 participants