Skip to content

[perf] feat: add Qwen3 and DeepSeek-V3 MoE recipes - #4850

Merged
yaoyu-33 merged 25 commits into
mainfrom
dpykhtar/add_moe_perf_recipes
Jul 22, 2026
Merged

[perf] feat: add Qwen3 and DeepSeek-V3 MoE recipes#4850
yaoyu-33 merged 25 commits into
mainfrom
dpykhtar/add_moe_perf_recipes

Conversation

@dimapihtar

Copy link
Copy Markdown
Contributor

What does this PR do ?

Add a one line overview of what this PR aims to accomplish.

Changelog

  • Add specific line by line info of high level changes in this PR.

GitHub Actions CI

See the CI section in the Contributing doc for how to trigger the CI. A Nvidia developer will need to approve and trigger the CI for external contributors.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

If you haven't finished some of the above items you can still open "Draft" PR.

Additional Information

  • Related to # (issue)

dimapihtar and others added 14 commits July 5, 2026 20:30
Signed-off-by: dimapihtar <dpykhtar@nvidia.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Signed-off-by: dimapihtar <dpykhtar@nvidia.com>
Signed-off-by: dimapihtar <dpykhtar@nvidia.com>
Signed-off-by: dimapihtar <dpykhtar@nvidia.com>
Signed-off-by: dimapihtar <dpykhtar@nvidia.com>
Signed-off-by: Dmytro Pykhtar <37850217+dimapihtar@users.noreply.github.com>
Signed-off-by: dimapihtar <dpykhtar@nvidia.com>
Signed-off-by: Dmytro Pykhtar <dpykhtar@nvidia.com>
Signed-off-by: Dmytro Pykhtar <dpykhtar@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 13, 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.

@dimapihtar
dimapihtar requested a review from yaoyu-33 July 13, 2026 17:52
@dimapihtar

Copy link
Copy Markdown
Contributor Author

/ok to test b09f54b

Comment thread src/megatron/bridge/perf_recipes/deepseek/gb200/deepseek_v3.py
cfg.model.moe_router_force_load_balancing = True


def _enable_deepseek_precision_aware_optimizer(cfg: ConfigContainer) -> None:

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.

this seems to be not only limit to deepseek?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

what do you mean?

Signed-off-by: Dmytro Pykhtar <dpykhtar@nvidia.com>
This reverts commit d07f348.
Signed-off-by: Dmytro Pykhtar <dpykhtar@nvidia.com>
@dimapihtar

Copy link
Copy Markdown
Contributor Author

/ok to test 75b120a

@claude

claude Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review: add qwen3 and deepseek-v3 MoE perf recipes

Mostly straightforward additions of tuned flat perf recipes plus two shared helpers. One real concern:

[High] New recipes are not discoverable via the perf CLI (naming order).
Every function added in this PR uses the order model / Ngpu / gpu / precision / optional-variant / then pretrain_config at the end (e.g. qwen3_30b_a3b_16gpu_gb200_bf16_pretrain_config, deepseek_v3_256gpu_gb200_fp8mx_partial_cg_pretrain_config).

All existing recipes and the discovery machinery use model / pretrain / Ngpu / gpu / precision / optional-variant / then config. _recipe_function_name() in scripts/performance/utils/utils.py builds the name as model_task_Ngpu_gpu_precision+variant+_config, so get_perf_recipe_by_name() / find_perf_recipe() cannot resolve any of these. A CLI request for qwen3_30b_a3b / 16gpu / gb200 / bf16 raises 'No perf recipe ... found'. They are only reachable by direct import from the package init.

Either rename to the standard order (folding partial_cg / paged_stash / deepep / hybridep into the config_variant suffix so they map to list_available_config_variants), or confirm these are intentionally direct-import-only.

[Low] Test coverage. No unit/functional test instantiates any of the new recipes. test_perf_config_integration.py only covers a few default-variant lookups. A parametrized instantiation test (like test_glm5_perf_recipes.py) over the new functions would catch phantom-attribute / precision-setup regressions.

Minor: the added members in the package init import blocks are not isort-sorted; ruff check --fix will resolve it before CI.

Suggested test cases
No scripts/performance/configs/ entries are touched, so no config-derived perf tests are impacted. Suggested instantiation coverage for the newly added recipes:

  • qwen3_30b_a3b_16gpu_gb200_bf16_pretrain_config
  • qwen3_30b_a3b_16gpu_gb200_fp8mx_partial_cg_pretrain_config
  • qwen3_30b_a3b_16gpu_gb200_fp8mx_paged_stash_pretrain_config
  • qwen3_30b_a3b_32gpu_h100_bf16_pretrain_config
  • qwen3_30b_a3b_32gpu_h100_fp8sc_pretrain_config
  • qwen3_235b_a22b_128gpu_b200_fp8mx_deepep_pretrain_config
  • qwen3_235b_a22b_128gpu_b300_fp8mx_hybridep_pretrain_config
  • qwen3_235b_a22b_128gpu_gb200_fp8mx_paged_stash_pretrain_config
  • qwen3_235b_a22b_128gpu_gb200_fp8mx_partial_cg_pretrain_config
  • qwen3_235b_a22b_128gpu_gb300_fp8mx_paged_stash_pretrain_config
  • qwen3_235b_a22b_256gpu_h100_bf16_hybridep_pretrain_config
  • deepseek_v3_256gpu_gb200_fp8mx_partial_cg_pretrain_config
  • deepseek_v3_256gpu_gb300_fp8mx_partial_cg_pretrain_config

Comment thread src/megatron/bridge/perf_recipes/qwen/gb200/qwen3_moe.py
Signed-off-by: Dmytro Pykhtar <dpykhtar@nvidia.com>
Signed-off-by: Dmytro Pykhtar <dpykhtar@nvidia.com>
@yaoyu-33 yaoyu-33 added area:perf Performance optimizations and benchmarking feature New capabilities, enhancements, or enablement work needs-more-tests Requires additional L0 and L1 test coverage before merge needs-review PR is ready for code review and waiting on a reviewer labels Jul 13, 2026
dimapihtar and others added 2 commits July 17, 2026 10:32
Signed-off-by: Dmytro Pykhtar <dpykhtar@nvidia.com>
@dimapihtar
dimapihtar requested a review from yaoyu-33 July 17, 2026 17:32
@dimapihtar

Copy link
Copy Markdown
Contributor Author

/ok to test 5f99db9

Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

/ok to test e1c203bb6d56400c0e35f2767761134164f73c2c

@yaoyu-33, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@yaoyu-33 yaoyu-33 changed the title add qwen3 & deepseek-v3 moe perf recipes [perf] feat: add Qwen3 and DeepSeek-V3 MoE recipes Jul 17, 2026
@yaoyu-33

Copy link
Copy Markdown
Contributor

/ok to test e1c203b

yaoyu-33 added 2 commits July 22, 2026 14:06
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@yaoyu-33
yaoyu-33 merged commit 1e3ced2 into main Jul 22, 2026
3 of 4 checks passed
@yaoyu-33
yaoyu-33 deleted the dpykhtar/add_moe_perf_recipes branch July 22, 2026 21:36
nvegesna-netizen added a commit to nvegesna-netizen/Megatron-Bridge that referenced this pull request Jul 23, 2026
Resolve conflicts in qwen perf_recipes after NVIDIA-NeMo#4850 restructured the same
files. Re-applied the PR's changes onto main's current layout:
- 5 new qwen3_30b_a3b_pretrain_8gpu_{gb200,gb300,b200,b300,vr200}_nvfp4_config
- cfg.comm_overlap.tp_comm_overlap = False on the 8 existing 235B A22B NVFP4
  configs (main added an env_vars block to them but not this fix)
- __init__ re-exports + vr200 gb300 alias
- tests/unit_tests/recipes/test_qwen_perf_recipes.py unchanged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:perf Performance optimizations and benchmarking feature New capabilities, enhancements, or enablement work needs-more-tests Requires additional L0 and L1 test coverage before merge needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants