Skip to content

Commit 268f912

Browse files
malay-nagdaclaude
andcommitted
perf(recipe): keep Kimi K2, Nemotron 3 Nano and Qwen3 30B 32-GPU GB200 on HybridEP
Revert the NCCL EP switch for the GB200 Kimi K2 MXFP8, Nemotron 3 Nano BF16/MXFP8 and Qwen3 30B-A3B 32-GPU BF16 perf recipes; they keep their HybridEP configuration and environment from main. Nemotron 3.5 Lightning BF16 still derives from the Nano BF16 recipe, so it now applies the NCCL EP overlay itself. The Qwen3 30B-A3B 8-GPU and 32-GPU BF16 recipes share a new HybridEP builder so only the 8-GPU recipe switches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Malay Nagda <malayn@nvidia.com>
1 parent 823b90a commit 268f912

5 files changed

Lines changed: 56 additions & 41 deletions

File tree

‎src/megatron/bridge/perf_recipes/kimi/gb200/kimi_k2.py‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414
"""GB200 performance recipes for Kimi K2."""
1515

16-
from megatron.bridge.perf_recipes._common import _enable_ncclep
1716
from megatron.bridge.perf_recipes.environment import COMMON_PERF_ENV_VARS
1817
from megatron.bridge.perf_recipes.kimi.common import (
1918
ConfigContainer,
@@ -139,7 +138,7 @@ def kimi_k2_pretrain_256gpu_gb200_fp8cs_config() -> ConfigContainer:
139138

140139

141140
def kimi_k2_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
142-
"""Kimi K2 pretrain: 256× GB200, MXFP8, NCCL EP."""
141+
"""Kimi K2 pretrain: 256× GB200, MXFP8."""
143142
cfg = kimi_k2_pretrain_config()
144143
cfg.mixed_precision = _perf_precision("fp8_mx")
145144
cfg.mixed_precision.reuse_grad_buf_for_mxfp8_param_ag = False
@@ -174,10 +173,6 @@ def kimi_k2_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
174173
cfg.comm_overlap.overlap_grad_reduce = True
175174

176175
_benchmark_common(cfg)
177-
_enable_ncclep(cfg)
178-
# Device-side expert token counts: the legacy grouped MLP path syncs tokens_per_expert to the
179-
# host every layer, which serializes the CPU behind the GPU when dispatch is fast.
180-
cfg.model.moe_use_grouped_tensor = True
181176
# Keep process settings next to the recipe so users can see the exact benchmark environment.
182177
cfg.env_vars = {
183178
**COMMON_PERF_ENV_VARS,
@@ -189,8 +184,11 @@ def kimi_k2_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
189184
"TORCH_NCCL_AVOID_RECORD_STREAMS": 1,
190185
# NCCL user-buffer and launch settings.
191186
"NCCL_NVLS_ENABLE": 0,
192-
# NCCL EP dispatcher mode.
193-
"NCCL_EP_HT_EM_PULL_PUSH": 1,
187+
# HybridEP topology for the target system.
188+
"NUM_OF_HYBRID_EP_RANKS_PER_NVLINK_DOMAIN": 64,
189+
"NUM_OF_TOKENS_PER_CHUNK_COMBINE_API": 128,
190+
"NVLINK_DOMAIN_SIZE": 72,
191+
"USE_MNNVL": 1,
194192
# Transformer Engine overlap settings for this model.
195193
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,
196194
"NVTE_FWD_LAYERNORM_SM_MARGIN": 20,

‎src/megatron/bridge/perf_recipes/nemotronh/gb200/nemotronh.py‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def nemotron_3_ultra_pretrain_256gpu_gb200_nvfp4_config() -> ConfigContainer:
401401

402402

403403
def nemotron_3_nano_pretrain_8gpu_gb200_bf16_config() -> ConfigContainer:
404-
"""Nemotron 3 Nano pretrain: 8× GB200, BF16, NCCL EP."""
404+
"""Nemotron 3 Nano pretrain: 8× GB200, BF16."""
405405
cfg = nemotron_3_nano_pretrain_config()
406406
_apply_nemotron_3_nano_perf_defaults(cfg)
407407
cfg.mixed_precision = _perf_precision("bf16")
@@ -425,10 +425,6 @@ def nemotron_3_nano_pretrain_8gpu_gb200_bf16_config() -> ConfigContainer:
425425

426426
_benchmark_common(cfg)
427427
cfg.model.moe_hybridep_num_sms = 16
428-
_enable_ncclep(cfg)
429-
# Device-side expert token counts: the legacy grouped MLP path syncs tokens_per_expert to the
430-
# host every layer, which serializes the CPU behind the GPU when dispatch is fast.
431-
cfg.model.moe_use_grouped_tensor = True
432428
# Keep process settings next to the recipe so users can see the exact benchmark environment.
433429
cfg.env_vars = {
434430
**COMMON_PERF_ENV_VARS,
@@ -440,8 +436,11 @@ def nemotron_3_nano_pretrain_8gpu_gb200_bf16_config() -> ConfigContainer:
440436
"TORCH_NCCL_AVOID_RECORD_STREAMS": 1,
441437
# NCCL user-buffer and launch settings.
442438
"NCCL_NVLS_ENABLE": 0,
443-
# NCCL EP dispatcher mode.
444-
"NCCL_EP_HT_EM_PULL_PUSH": 1,
439+
# HybridEP topology for the target system.
440+
"NUM_OF_HYBRID_EP_RANKS_PER_NVLINK_DOMAIN": 8,
441+
"NUM_OF_TOKENS_PER_CHUNK_COMBINE_API": 128,
442+
"NVLINK_DOMAIN_SIZE": 72,
443+
"USE_MNNVL": 1,
445444
# Transformer Engine overlap settings for this model.
446445
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,
447446
"NVTE_FWD_LAYERNORM_SM_MARGIN": 20,
@@ -480,15 +479,11 @@ def _build_nemotron_3_nano_gb200_mxfp8() -> ConfigContainer:
480479

481480

482481
def nemotron_3_nano_pretrain_8gpu_gb200_fp8mx_config() -> ConfigContainer:
483-
"""Nemotron 3 Nano pretrain: 8× GB200, MXFP8, NCCL EP."""
482+
"""Nemotron 3 Nano pretrain: 8× GB200, MXFP8."""
484483
cfg = _build_nemotron_3_nano_gb200_mxfp8()
485484
cfg.model.use_transformer_engine_op_fuser = True
486485
cfg.model.moe_mlp_glu_interleave_size = 32
487486
cfg.mixed_precision.fp8_dot_product_attention = True
488-
_enable_ncclep(cfg)
489-
# Device-side expert token counts: the legacy grouped MLP path syncs tokens_per_expert to the
490-
# host every layer, which serializes the CPU behind the GPU when dispatch is fast.
491-
cfg.model.moe_use_grouped_tensor = True
492487
# Keep process settings next to the recipe so users can see the exact benchmark environment.
493488
cfg.env_vars = {
494489
**COMMON_PERF_ENV_VARS,
@@ -500,8 +495,11 @@ def nemotron_3_nano_pretrain_8gpu_gb200_fp8mx_config() -> ConfigContainer:
500495
"TORCH_NCCL_AVOID_RECORD_STREAMS": 1,
501496
# NCCL user-buffer and launch settings.
502497
"NCCL_NVLS_ENABLE": 0,
503-
# NCCL EP dispatcher mode.
504-
"NCCL_EP_HT_EM_PULL_PUSH": 1,
498+
# HybridEP topology for the target system.
499+
"NUM_OF_HYBRID_EP_RANKS_PER_NVLINK_DOMAIN": 8,
500+
"NUM_OF_TOKENS_PER_CHUNK_COMBINE_API": 128,
501+
"NVLINK_DOMAIN_SIZE": 72,
502+
"USE_MNNVL": 1,
505503
# Transformer Engine overlap settings for this model.
506504
"CUDNNFE_CLUSTER_OVERLAP_MARGIN": 8,
507505
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,
@@ -568,7 +566,7 @@ def nemotron_3_nano_pretrain_8gpu_gb200_nvfp4_config() -> ConfigContainer:
568566

569567

570568
def nemotron_3_5_lightning_pretrain_8gpu_gb200_bf16_config() -> ConfigContainer:
571-
"""Nemotron 3.5 Lightning pretrain: 8× GB200, BF16, NCCL EP (inherited from Nemotron 3 Nano)."""
569+
"""Nemotron 3.5 Lightning pretrain: 8× GB200, BF16, NCCL EP."""
572570
cfg = nemotron_3_nano_pretrain_8gpu_gb200_bf16_config()
573571
cfg.model.recompute_modules = []
574572
cfg.model.mtp_num_layers = 2
@@ -580,14 +578,18 @@ def nemotron_3_5_lightning_pretrain_8gpu_gb200_bf16_config() -> ConfigContainer:
580578
cfg.model.hf_model_revision = _NEMOTRON_3_5_LIGHTNING_MODEL_REVISION
581579
cfg.tokenizer.tokenizer_model = _NEMOTRON_3_5_LIGHTNING_MODEL_ID
582580
cfg.tokenizer.hf_tokenizer_kwargs = {"revision": _NEMOTRON_3_5_LIGHTNING_MODEL_REVISION}
581+
_enable_ncclep(cfg)
582+
# Device-side expert token counts: the legacy grouped MLP path syncs tokens_per_expert to the
583+
# host every layer, which serializes the CPU behind the GPU when dispatch is fast.
584+
cfg.model.moe_use_grouped_tensor = True
583585
cfg.env_vars = {
584586
**COMMON_PERF_ENV_VARS,
585587
"CUDA_DEVICE_MAX_CONNECTIONS": 32,
586588
"NCCL_GRAPH_REGISTER": 0,
587589
"PYTORCH_CUDA_ALLOC_CONF": "expandable_segments:True",
588590
"TORCH_NCCL_AVOID_RECORD_STREAMS": 1,
589591
"NCCL_NVLS_ENABLE": 0,
590-
# NCCL EP dispatcher mode (inherited from the Nemotron 3 Nano BF16 recipe).
592+
# NCCL EP dispatcher mode.
591593
"NCCL_EP_HT_EM_PULL_PUSH": 1,
592594
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,
593595
"NVTE_FWD_LAYERNORM_SM_MARGIN": 20,

‎src/megatron/bridge/perf_recipes/qwen/gb200/qwen3_moe.py‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ def qwen3_235b_a22b_pretrain_64gpu_gb200_fp8mx_config() -> ConfigContainer:
196196
return cfg
197197

198198

199-
def qwen3_30b_a3b_pretrain_8gpu_gb200_bf16_config() -> ConfigContainer:
200-
"""Qwen3 30B-A3B pretrain: 8× GB200, BF16, EP=8, NCCL EP."""
199+
def _build_qwen3_30b_a3b_gb200_bf16() -> ConfigContainer:
200+
"""Shared HybridEP BF16 base for the Qwen3 30B-A3B 8-GPU and 32-GPU GB200 recipes."""
201201
cfg = qwen3_30b_a3b_pretrain_config()
202202
cfg.mixed_precision = _perf_precision("bf16")
203203
cfg.model.bias_activation_fusion = True
@@ -228,6 +228,12 @@ def qwen3_30b_a3b_pretrain_8gpu_gb200_bf16_config() -> ConfigContainer:
228228
cfg.comm_overlap = CommOverlapConfig(tp_comm_overlap=False)
229229

230230
_benchmark_common(cfg)
231+
return cfg
232+
233+
234+
def qwen3_30b_a3b_pretrain_8gpu_gb200_bf16_config() -> ConfigContainer:
235+
"""Qwen3 30B-A3B pretrain: 8× GB200, BF16, EP=8, NCCL EP."""
236+
cfg = _build_qwen3_30b_a3b_gb200_bf16()
231237
_enable_ncclep(cfg)
232238
# Device-side expert token counts: the legacy grouped MLP path syncs tokens_per_expert to the
233239
# host every layer, which serializes the CPU behind the GPU when dispatch is fast.
@@ -655,8 +661,8 @@ def qwen3_30b_a3b_pretrain_8gpu_gb200_nvfp4_config() -> ConfigContainer:
655661

656662

657663
def qwen3_30b_a3b_pretrain_32gpu_gb200_bf16_config() -> ConfigContainer:
658-
"""Qwen3 30B-A3B pretrain: 32× GB200, BF16, legacy-scaled GBS, NCCL EP."""
659-
cfg = _with_global_batch_size(qwen3_30b_a3b_pretrain_8gpu_gb200_bf16_config(), 2048)
664+
"""Qwen3 30B-A3B pretrain: 32× GB200, BF16, legacy-scaled GBS."""
665+
cfg = _with_global_batch_size(_build_qwen3_30b_a3b_gb200_bf16(), 2048)
660666
# Keep process settings next to the recipe so users can see the exact benchmark environment.
661667
cfg.env_vars = {
662668
**COMMON_PERF_ENV_VARS,
@@ -668,8 +674,11 @@ def qwen3_30b_a3b_pretrain_32gpu_gb200_bf16_config() -> ConfigContainer:
668674
"TORCH_NCCL_AVOID_RECORD_STREAMS": 1,
669675
# NCCL user-buffer and launch settings.
670676
"NCCL_NVLS_ENABLE": 0,
671-
# NCCL EP dispatcher mode (inherited from the 8-GPU BF16 recipe).
672-
"NCCL_EP_HT_EM_PULL_PUSH": 1,
677+
# HybridEP topology for the target system.
678+
"NUM_OF_HYBRID_EP_RANKS_PER_NVLINK_DOMAIN": 8,
679+
"NUM_OF_TOKENS_PER_CHUNK_COMBINE_API": 128,
680+
"NVLINK_DOMAIN_SIZE": 72,
681+
"USE_MNNVL": 1,
673682
# Transformer Engine overlap settings for this model.
674683
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,
675684
"NVTE_FWD_LAYERNORM_SM_MARGIN": 20,

‎tests/unit_tests/recipes/test_gb200_ncclep_perf_recipes.py‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,44 +26,43 @@
2626

2727
_NCCL_EP_ENV = {"NCCL_EP_HT_EM_PULL_PUSH": 1}
2828

29-
# (module under megatron.bridge.perf_recipes, recipe factory) for the GB200 recipes defaulted to NCCL EP: the
30-
# nemo-ci GB200 benchmarks whose GB300 counterparts already run NCCL EP.
29+
# (module under megatron.bridge.perf_recipes, recipe factory) for the GB200 recipes defaulted to NCCL EP.
3130
_GB200_NCCLEP_RECIPES = (
3231
("deepseek.gb200.deepseek_v3", "deepseek_v3_pretrain_256gpu_gb200_bf16_config"),
3332
("deepseek.gb200.deepseek_v3", "deepseek_v3_pretrain_256gpu_gb200_fp8mx_config"),
3433
("deepseek.gb200.deepseek_v3", "deepseek_v3_pretrain_256gpu_gb200_nvfp4_config"),
3534
("deepseek.gb200.deepseek_v3", "deepseek_v3_pretrain_256gpu_gb200_fp8mx_large_scale_config"),
3635
("gpt_oss.gb200.gpt_oss", "gpt_oss_120b_pretrain_64gpu_gb200_fp8mx_config"),
37-
("kimi.gb200.kimi_k2", "kimi_k2_pretrain_256gpu_gb200_fp8mx_config"),
3836
("nemotronh.gb200.nemotronh", "nemotron_3_super_pretrain_64gpu_gb200_bf16_config"),
3937
("nemotronh.gb200.nemotronh", "nemotron_3_super_pretrain_64gpu_gb200_fp8mx_config"),
4038
("nemotronh.gb200.nemotronh", "nemotron_3_super_pretrain_64gpu_gb200_nvfp4_config"),
4139
("nemotronh.gb200.nemotronh", "nemotron_3_ultra_pretrain_256gpu_gb200_fp8mx_config"),
42-
("nemotronh.gb200.nemotronh", "nemotron_3_nano_pretrain_8gpu_gb200_bf16_config"),
43-
("nemotronh.gb200.nemotronh", "nemotron_3_nano_pretrain_8gpu_gb200_fp8mx_config"),
4440
("nemotronh.gb200.nemotronh", "nemotron_3_5_lightning_pretrain_8gpu_gb200_bf16_config"),
4541
("nemotronh.gb200.nemotronh", "nemotron_3_5_lightning_pretrain_8gpu_gb200_fp8mx_config"),
4642
("qwen.gb200.qwen3_moe", "qwen3_30b_a3b_pretrain_8gpu_gb200_bf16_config"),
4743
("qwen.gb200.qwen3_moe", "qwen3_30b_a3b_pretrain_8gpu_gb200_fp8mx_config"),
48-
("qwen.gb200.qwen3_moe", "qwen3_30b_a3b_pretrain_32gpu_gb200_bf16_config"),
4944
("qwen.gb200.qwen3_moe", "qwen3_235b_a22b_pretrain_256gpu_gb200_bf16_config"),
5045
("qwen.gb200.qwen3_moe", "qwen3_235b_a22b_pretrain_256gpu_gb200_fp8mx_config"),
5146
("qwen.gb200.qwen3_moe", "qwen3_235b_a22b_pretrain_256gpu_gb200_fp8mx_large_scale_config"),
5247
("qwen.gb200.qwen3_moe", "qwen3_235b_a22b_pretrain_256gpu_gb200_nvfp4_config"),
5348
)
5449

5550
# GB200 recipes that stay on HybridEP. Most build on the same base or parent recipe as a recipe above (the
56-
# shared DeepSeek BF16 builder, the Nano/Lightning MXFP8 base, the FP8-CS parents of the NVFP4 recipes), so
57-
# the NCCL EP overlay must not leak into them.
51+
# shared DeepSeek and Qwen3 30B BF16 builders, the Nemotron 3 Nano parents of the Lightning recipes, the FP8-CS
52+
# parents of the NVFP4 recipes), so the NCCL EP overlay must not leak into them.
5853
_GB200_HYBRIDEP_RECIPES = (
5954
("deepseek.gb200.deepseek_v3", "deepseek_v3_pretrain_256gpu_gb200_fp8cs_config"),
6055
("deepseek.gb200.deepseek_v3", "deepseek_v3_pretrain_256gpu_gb200_fp8mx_partial_cg_dev_config"),
56+
("kimi.gb200.kimi_k2", "kimi_k2_pretrain_256gpu_gb200_fp8mx_config"),
57+
("nemotronh.gb200.nemotronh", "nemotron_3_nano_pretrain_8gpu_gb200_bf16_config"),
58+
("nemotronh.gb200.nemotronh", "nemotron_3_nano_pretrain_8gpu_gb200_fp8mx_config"),
6159
("nemotronh.gb200.nemotronh", "nemotron_3_ultra_pretrain_256gpu_gb200_nvfp4_config"),
6260
("nemotronh.gb200.nemotronh", "nemotron_3_nano_pretrain_8gpu_gb200_nvfp4_config"),
6361
("nemotronh.gb200.nemotronh", "nemotron_3_5_lightning_pretrain_8gpu_gb200_fp8mx_fsdp_config"),
6462
("nemotronh.gb200.nemotronh", "nemotron_3_5_lightning_pretrain_8gpu_gb200_nvfp4_config"),
6563
("qwen.gb200.qwen3_moe", "qwen3_30b_a3b_pretrain_8gpu_gb200_fp8cs_config"),
6664
("qwen.gb200.qwen3_moe", "qwen3_30b_a3b_pretrain_8gpu_gb200_nvfp4_config"),
65+
("qwen.gb200.qwen3_moe", "qwen3_30b_a3b_pretrain_32gpu_gb200_bf16_config"),
6766
("qwen.gb200.qwen3_moe", "qwen3_30b_a3b_pretrain_32gpu_gb200_fp8cs_config"),
6867
("qwen.gb200.qwen3_moe", "qwen3_235b_a22b_pretrain_256gpu_gb200_fp8cs_config"),
6968
("qwen.gb200.qwen3_moe", "qwen3_235b_a22b_pretrain_64gpu_gb200_nvfp4_full_iteration_config"),

‎tests/unit_tests/recipes/test_nemotron_3_5_lightning_perf_recipes.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import torch
2323

2424
from megatron.bridge.perf_recipes._common import _enable_ncclep
25+
from megatron.bridge.perf_recipes.environment import HYBRID_EP_ENV_NAMES
2526
from megatron.bridge.perf_recipes.nemotronh import (
2627
nemotron_3_5_lightning_pretrain_8gpu_b200_bf16_config,
2728
nemotron_3_5_lightning_pretrain_8gpu_b200_fp8mx_config,
@@ -350,16 +351,22 @@ def test_nemotron_3_5_perf_recipes_inherit_nemotron_3_policy(
350351
cfg = recipe_factory()
351352
base_cfg = base_recipe_factory()
352353

354+
base_env = base_cfg.env_vars
355+
if recipe_factory in _NCCLEP_RECIPES and base_cfg.model.moe_flex_dispatcher_backend == "hybridep":
356+
# The GB200 Lightning benchmarks dispatch through NCCL EP while their Nemotron 3 Nano bases keep HybridEP.
357+
base_env = {name: value for name, value in base_env.items() if name not in HYBRID_EP_ENV_NAMES}
358+
base_env["NCCL_EP_HT_EM_PULL_PUSH"] = 1
359+
353360
if recipe_factory in _B_MXFP8_RECIPES:
354-
assert cfg.env_vars == {**base_cfg.env_vars, "NVTE_CUTEDSL_FUSED_GROUPED_MLP": 1}
361+
assert cfg.env_vars == {**base_env, "NVTE_CUTEDSL_FUSED_GROUPED_MLP": 1}
355362
elif recipe_factory in _FULL_ITERATION_MXFP8_RECIPES:
356363
assert cfg.env_vars == {
357-
**base_cfg.env_vars,
364+
**base_env,
358365
"PYTORCH_CUDA_ALLOC_CONF": "expandable_segments:True,graph_capture_record_stream_reuse:True",
359366
"TORCH_NCCL_AVOID_RECORD_STREAMS": 0,
360367
}
361368
elif recipe_factory is not nemotron_3_5_lightning_pretrain_16gpu_h100_bf16_config:
362-
assert cfg.env_vars == base_cfg.env_vars
369+
assert cfg.env_vars == base_env
363370
assert cfg.model.calculate_per_token_loss == base_cfg.model.calculate_per_token_loss
364371
assert cfg.model.use_te_rng_tracker == base_cfg.model.use_te_rng_tracker
365372
assert cfg.tokenizer.tokenizer_model != base_cfg.tokenizer.tokenizer_model

0 commit comments

Comments
 (0)