Skip to content

Commit 823b90a

Browse files
malay-nagdaclaude
andcommitted
perf(recipe): default GB200 MoE perf recipes to NCCL EP and grouped tensors
Switch the GB200 MoE perf recipes that nemo-ci benchmarks on HybridEP to the NCCL EP flex dispatcher backend with moe_use_grouped_tensor=True, matching the GB300 recipes moved in #6171 and GPT-OSS 120B GB200 in #6261. The NCCL EP environment sets NCCL_EP_HT_EM_PULL_PUSH=1 and drops the HybridEP topology names. Switched: DeepSeek V3 256-GPU BF16/MXFP8/NVFP4/MXFP8 large-scale, Kimi K2 MXFP8, Nemotron 3 Super BF16/MXFP8/NVFP4, Nemotron 3 Ultra MXFP8, Nemotron 3 Nano BF16/MXFP8, Nemotron 3.5 Lightning BF16/MXFP8, Qwen3 30B-A3B 8-GPU BF16/MXFP8 and 32-GPU BF16, Qwen3 235B-A22B 256-GPU BF16/MXFP8/NVFP4/MXFP8 large-scale. Recipes whose GB300 counterpart stays on HybridEP (DeepSeek V4 Flash, Nemotron 3 Ultra NVFP4) and GB200 recipes without a nemo-ci benchmark keep HybridEP. DeepSeek V3 NVFP4 now builds on a shared HybridEP BF16 base so the NCCL EP overlay is applied explicitly per recipe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Malay Nagda <malayn@nvidia.com>
1 parent bb46fee commit 823b90a

15 files changed

Lines changed: 314 additions & 146 deletions

‎src/megatron/bridge/perf_recipes/_common.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _benchmark_common(
9696

9797

9898
def _enable_ncclep(cfg: ConfigContainer) -> None:
99-
"""Switch a flex-dispatcher recipe to the NCCL EP backend (GB300 MoE default).
99+
"""Switch a flex-dispatcher recipe to the NCCL EP backend (GB200 and GB300 MoE default).
100100
101101
Call after ``_benchmark_common``. Only the dispatch stack changes; parallelism, precision,
102102
recompute and the CUDA graph mode stay as the recipe set them. The calling recipe still declares

‎src/megatron/bridge/perf_recipes/deepseek/gb200/deepseek_v3.py‎

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

16+
from megatron.bridge.perf_recipes._common import _enable_ncclep
1617
from megatron.bridge.perf_recipes.deepseek.common import (
1718
ConfigContainer,
1819
_benchmark_common,
@@ -26,8 +27,8 @@
2627
from megatron.bridge.perf_recipes.environment import COMMON_PERF_ENV_VARS
2728

2829

29-
def deepseek_v3_pretrain_256gpu_gb200_bf16_config() -> ConfigContainer:
30-
"""DeepSeek V3 pretrain: 256× GB200, BF16."""
30+
def _build_deepseek_v3_gb200_bf16() -> ConfigContainer:
31+
"""Shared HybridEP BF16 base for the DeepSeek V3 256-GPU GB200 BF16 and NVFP4 recipes."""
3132
cfg = deepseek_v3_pretrain_config()
3233
cfg.mixed_precision = _perf_precision("bf16")
3334
_deepseek_v3_common(cfg)
@@ -52,6 +53,16 @@ def deepseek_v3_pretrain_256gpu_gb200_bf16_config() -> ConfigContainer:
5253
set_deepseek_v3_pipeline_model_parallel_layout(cfg.model)
5354

5455
_benchmark_common(cfg)
56+
return cfg
57+
58+
59+
def deepseek_v3_pretrain_256gpu_gb200_bf16_config() -> ConfigContainer:
60+
"""DeepSeek V3 pretrain: 256× GB200, BF16, NCCL EP."""
61+
cfg = _build_deepseek_v3_gb200_bf16()
62+
_enable_ncclep(cfg)
63+
# Device-side expert token counts: the legacy grouped MLP path syncs tokens_per_expert to the
64+
# host every layer, which serializes the CPU behind the GPU when dispatch is fast.
65+
cfg.model.moe_use_grouped_tensor = True
5566
# Keep process settings next to the recipe so users can see the exact benchmark environment.
5667
cfg.env_vars = {
5768
**COMMON_PERF_ENV_VARS,
@@ -67,11 +78,8 @@ def deepseek_v3_pretrain_256gpu_gb200_bf16_config() -> ConfigContainer:
6778
"TORCH_CPP_LOG_LEVEL": "ERROR",
6879
# NCCL user-buffer and launch settings.
6980
"NCCL_NVLS_ENABLE": 0,
70-
# HybridEP topology for the target system.
71-
"NUM_OF_HYBRID_EP_RANKS_PER_NVLINK_DOMAIN": 64,
72-
"NUM_OF_TOKENS_PER_CHUNK_COMBINE_API": 128,
73-
"NVLINK_DOMAIN_SIZE": 72,
74-
"USE_MNNVL": 1,
81+
# NCCL EP dispatcher mode.
82+
"NCCL_EP_HT_EM_PULL_PUSH": 1,
7583
# Transformer Engine overlap settings for this model.
7684
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,
7785
"NVTE_FWD_LAYERNORM_SM_MARGIN": 20,
@@ -133,7 +141,7 @@ def deepseek_v3_pretrain_256gpu_gb200_fp8cs_config() -> ConfigContainer:
133141

134142

135143
def deepseek_v3_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
136-
"""DeepSeek V3 pretrain: 256× GB200, MXFP8."""
144+
"""DeepSeek V3 pretrain: 256× GB200, MXFP8, NCCL EP."""
137145
cfg = deepseek_v3_pretrain_config()
138146
cfg.mixed_precision = _perf_precision("fp8_mx")
139147
_deepseek_v3_common(cfg)
@@ -161,6 +169,10 @@ def deepseek_v3_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
161169
_enable_deepseek_full_iteration(cfg)
162170
cfg.model.fp8_output_proj = True
163171
cfg.mixed_precision.fp8_dot_product_attention = False
172+
_enable_ncclep(cfg)
173+
# Device-side expert token counts: the legacy grouped MLP path syncs tokens_per_expert to the
174+
# host every layer, which serializes the CPU behind the GPU when dispatch is fast.
175+
cfg.model.moe_use_grouped_tensor = True
164176
# Keep process settings next to the recipe so users can see the exact benchmark environment.
165177
cfg.env_vars = {
166178
**COMMON_PERF_ENV_VARS,
@@ -172,11 +184,8 @@ def deepseek_v3_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
172184
"TORCH_NCCL_AVOID_RECORD_STREAMS": 0,
173185
# NCCL user-buffer and launch settings.
174186
"NCCL_NVLS_ENABLE": 0,
175-
# HybridEP topology for the target system.
176-
"NUM_OF_HYBRID_EP_RANKS_PER_NVLINK_DOMAIN": 64,
177-
"NUM_OF_TOKENS_PER_CHUNK_COMBINE_API": 128,
178-
"NVLINK_DOMAIN_SIZE": 72,
179-
"USE_MNNVL": 1,
187+
# NCCL EP dispatcher mode.
188+
"NCCL_EP_HT_EM_PULL_PUSH": 1,
180189
# Transformer Engine overlap settings for this model.
181190
"CUDNNFE_CLUSTER_OVERLAP_MARGIN": 8,
182191
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,
@@ -192,8 +201,8 @@ def deepseek_v3_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
192201

193202

194203
def deepseek_v3_pretrain_256gpu_gb200_nvfp4_config() -> ConfigContainer:
195-
"""DeepSeek V3 pretrain: 256× GB200, NVFP4 with optimizer CUDA graph."""
196-
cfg = deepseek_v3_pretrain_256gpu_gb200_bf16_config()
204+
"""DeepSeek V3 pretrain: 256× GB200, NVFP4 with optimizer CUDA graph, NCCL EP."""
205+
cfg = _build_deepseek_v3_gb200_bf16()
197206
cfg.mixed_precision = _perf_precision("nvfp4")
198207
_enable_deepseek_full_iteration(cfg)
199208
cfg.model.fp8_output_proj = False
@@ -204,6 +213,10 @@ def deepseek_v3_pretrain_256gpu_gb200_nvfp4_config() -> ConfigContainer:
204213
cfg.model.mla_down_proj_fusion = True
205214
cfg.model.moe_paged_stash_buffer_size_factor_cuda = 1.1
206215
cfg.model.recompute_modules = ["mla_up_proj", "mlp"]
216+
_enable_ncclep(cfg)
217+
# Device-side expert token counts: the legacy grouped MLP path syncs tokens_per_expert to the
218+
# host every layer, which serializes the CPU behind the GPU when dispatch is fast.
219+
cfg.model.moe_use_grouped_tensor = True
207220
# Keep process settings next to the recipe so users can see the exact benchmark environment.
208221
cfg.env_vars = {
209222
**COMMON_PERF_ENV_VARS,
@@ -215,11 +228,8 @@ def deepseek_v3_pretrain_256gpu_gb200_nvfp4_config() -> ConfigContainer:
215228
"TORCH_NCCL_AVOID_RECORD_STREAMS": 1,
216229
# NCCL user-buffer and launch settings.
217230
"NCCL_NVLS_ENABLE": 0,
218-
# HybridEP topology for the target system.
219-
"NUM_OF_HYBRID_EP_RANKS_PER_NVLINK_DOMAIN": 64,
220-
"NUM_OF_TOKENS_PER_CHUNK_COMBINE_API": 128,
221-
"NVLINK_DOMAIN_SIZE": 72,
222-
"USE_MNNVL": 1,
231+
# NCCL EP dispatcher mode.
232+
"NCCL_EP_HT_EM_PULL_PUSH": 1,
223233
# Transformer Engine overlap settings for this model.
224234
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,
225235
"NVTE_FWD_LAYERNORM_SM_MARGIN": 20,
@@ -235,7 +245,7 @@ def deepseek_v3_pretrain_256gpu_gb200_nvfp4_config() -> ConfigContainer:
235245

236246

237247
def deepseek_v3_pretrain_256gpu_gb200_fp8mx_large_scale_config() -> ConfigContainer:
238-
"""DeepSeek V3 pretrain: 256× GB200, MXFP8, large-scale proxy (GBS=256)."""
248+
"""DeepSeek V3 pretrain: 256× GB200, MXFP8, large-scale proxy (GBS=256), NCCL EP."""
239249
cfg = deepseek_v3_pretrain_256gpu_gb200_fp8mx_config()
240250
cfg.train.global_batch_size = 256
241251
# Keep process settings next to the recipe so users can see the exact benchmark environment.
@@ -249,11 +259,8 @@ def deepseek_v3_pretrain_256gpu_gb200_fp8mx_large_scale_config() -> ConfigContai
249259
"TORCH_NCCL_AVOID_RECORD_STREAMS": 0,
250260
# NCCL user-buffer and launch settings.
251261
"NCCL_NVLS_ENABLE": 0,
252-
# HybridEP topology for the target system.
253-
"NUM_OF_HYBRID_EP_RANKS_PER_NVLINK_DOMAIN": 64,
254-
"NUM_OF_TOKENS_PER_CHUNK_COMBINE_API": 128,
255-
"NVLINK_DOMAIN_SIZE": 72,
256-
"USE_MNNVL": 1,
262+
# NCCL EP dispatcher mode (inherited from the 256-GPU MXFP8 recipe).
263+
"NCCL_EP_HT_EM_PULL_PUSH": 1,
257264
# Transformer Engine overlap settings for this model.
258265
"CUDNNFE_CLUSTER_OVERLAP_MARGIN": 8,
259266
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,

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

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

16+
from megatron.bridge.perf_recipes._common import _enable_ncclep
1617
from megatron.bridge.perf_recipes.environment import COMMON_PERF_ENV_VARS
1718
from megatron.bridge.perf_recipes.kimi.common import (
1819
ConfigContainer,
@@ -138,7 +139,7 @@ def kimi_k2_pretrain_256gpu_gb200_fp8cs_config() -> ConfigContainer:
138139

139140

140141
def kimi_k2_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
141-
"""Kimi K2 pretrain: 256× GB200, MXFP8."""
142+
"""Kimi K2 pretrain: 256× GB200, MXFP8, NCCL EP."""
142143
cfg = kimi_k2_pretrain_config()
143144
cfg.mixed_precision = _perf_precision("fp8_mx")
144145
cfg.mixed_precision.reuse_grad_buf_for_mxfp8_param_ag = False
@@ -173,6 +174,10 @@ def kimi_k2_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
173174
cfg.comm_overlap.overlap_grad_reduce = True
174175

175176
_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
176181
# Keep process settings next to the recipe so users can see the exact benchmark environment.
177182
cfg.env_vars = {
178183
**COMMON_PERF_ENV_VARS,
@@ -184,11 +189,8 @@ def kimi_k2_pretrain_256gpu_gb200_fp8mx_config() -> ConfigContainer:
184189
"TORCH_NCCL_AVOID_RECORD_STREAMS": 1,
185190
# NCCL user-buffer and launch settings.
186191
"NCCL_NVLS_ENABLE": 0,
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,
192+
# NCCL EP dispatcher mode.
193+
"NCCL_EP_HT_EM_PULL_PUSH": 1,
192194
# Transformer Engine overlap settings for this model.
193195
"NVTE_BWD_LAYERNORM_SM_MARGIN": 20,
194196
"NVTE_FWD_LAYERNORM_SM_MARGIN": 20,

0 commit comments

Comments
 (0)