Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/performance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ Mounting cached files is not enough by itself. If `HF_HUB_OFFLINE` remains `0`,

##### Performance arguments

- `-g/--gpu`: Target GPU type (`h100`, `b200`, `gb200`, `gb300`, `b300`).
- `-g/--gpu`: Target GPU type (`h100`, `b200`, `gb200`, `gb300`, `b300`, `vrnvl72`). `vr200` is a deprecated alias for `vrnvl72`.
- `-c/--compute_dtype`: Compute precision (`bf16`, `fp8_cs`, `fp8_mx`, `fp8_sc`, `nvfp4`). Default `bf16`.
- `-vb/--enable_vboost`: Enable VBoost (tensor core power steering). Pass `true` or `false`. Disabled by default.
- `-lgc/--lock_gpu_freq`: Lock GPU graphics clock to a fixed frequency in MHz (e.g. `1200`). Used for silicon simulation correlation studies. Disabled by default.
- `-lmc/--peak_mem_clk`: Lock GPU memory clock to a fixed peak frequency in MHz (e.g. `2600`). Used for silicon simulation correlation studies. Defaults to `4752` MHz for VR200 and is disabled by default for other GPUs. Pass `-lmc -1` or `--peak_mem_clk -1` to disable the VR200 default.
- `-lmc/--peak_mem_clk`: Lock GPU memory clock to a fixed peak frequency in MHz (e.g. `2600`). Used for silicon simulation correlation studies. Defaults to `4752` MHz for VRNVL72 and is disabled by default for other GPUs. Pass `-lmc -1` or `--peak_mem_clk -1` to disable the VRNVL72 default.
- `-en/--enable_nsys`: Enable Nsight Systems profiling. Disabled by default.
- `-pyp/--pytorch_profiler`: Enable PyTorch profiler. Pass `true` or `false`. Disabled by default.
- `--profiling_start_step`: Defines start step for profiling. Default `10`.
Expand Down
24 changes: 19 additions & 5 deletions scripts/performance/argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@
"b300": 8,
"gb200": 4,
"gb300": 4,
"vr200": 4,
"vrnvl72": 4,
"r100": 1,
}

# Deprecated --gpu names and their replacements. When the deprecation window ends, drop an entry together with
# its counterpart in LEGACY_HARDWARE_ALIASES (scripts/training/recipe_metadata.py).
LEGACY_GPU_ALIASES = {"vr200": "vrnvl72"}


def list_of_strings(arg):
"""Split a comma-separated string into a list of substrings."""
Expand Down Expand Up @@ -80,6 +84,16 @@ def lower_str(arg):
return arg.lower()


def canonical_gpu(arg: str) -> str:
"""Map a deprecated GPU name to its replacement before argparse checks the choices."""
if arg in LEGACY_GPU_ALIASES:
# Every rank re-parses the forwarded argv, so only the launcher and global rank 0 warn.
if os.environ.get("RANK", os.environ.get("SLURM_PROCID", "0")) == "0":
logger.warning("--gpu %s is deprecated; use --gpu %s.", arg, LEGACY_GPU_ALIASES[arg])
return LEGACY_GPU_ALIASES[arg]
return arg


def bool_arg(arg):
"""Convert a string CLI value to a boolean."""
if arg.lower() in ["true", "1", "t", "yes", "y"]:
Expand Down Expand Up @@ -787,9 +801,9 @@ def parse_cli_args():
performance_args.add_argument(
"-g",
"--gpu",
type=str,
type=canonical_gpu,
choices=NUM_GPUS_PER_NODE_MAP.keys(),
help="Target gpu type.",
help="Target gpu type. vr200 is a deprecated alias for vrnvl72.",
required=True,
)
performance_args.add_argument(
Expand Down Expand Up @@ -831,8 +845,8 @@ def parse_cli_args():
"--peak_mem_clk",
help="Lock GPU memory clock to the specified peak frequency in MHz via "
"`sudo nvidia-smi -lmc <freq>,<freq>`. Runs once per node before training. "
"Defaults to 4752 MHz for VR200 and is disabled by default for other GPUs. "
"Pass `-lmc -1` or `--peak_mem_clk -1` to disable the VR200 default.",
"Defaults to 4752 MHz for VRNVL72 and is disabled by default for other GPUs. "
"Pass `-lmc -1` or `--peak_mem_clk -1` to disable the VRNVL72 default.",
type=int,
required=False,
default=None,
Expand Down
82 changes: 41 additions & 41 deletions scripts/performance/dump_perf_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
("llama", "llama3_8b", "pretrain", 8, "gb200", "nvfp4"),
("llama", "llama3_8b", "pretrain", 32, "gb200", "bf16"),
("llama", "llama3_8b", "pretrain", 32, "gb200", "fp8_cs"),
("llama", "llama3_8b", "pretrain", 8, "vr200", "bf16"),
("llama", "llama3_8b", "pretrain", 8, "vr200", "fp8_cs"),
("llama", "llama3_8b", "pretrain", 8, "vr200", "fp8_mx"),
("llama", "llama3_8b", "pretrain", 8, "vr200", "nvfp4"),
("llama", "llama3_8b", "pretrain", 8, "vrnvl72", "bf16"),
("llama", "llama3_8b", "pretrain", 8, "vrnvl72", "fp8_cs"),
("llama", "llama3_8b", "pretrain", 8, "vrnvl72", "fp8_mx"),
("llama", "llama3_8b", "pretrain", 8, "vrnvl72", "nvfp4"),
("llama", "llama3_8b", "pretrain", 8, "b300", "bf16"),
("llama", "llama3_8b", "pretrain", 8, "b300", "fp8_cs"),
("llama", "llama3_8b", "pretrain", 8, "b300", "fp8_mx"),
Expand Down Expand Up @@ -172,10 +172,10 @@
("deepseek", "deepseek_v3", "pretrain", 256, "gb200", "fp8_cs"),
("deepseek", "deepseek_v3", "pretrain", 256, "gb200", "fp8_mx"),
("deepseek", "deepseek_v3", "pretrain", 256, "gb200", "nvfp4"),
("deepseek", "deepseek_v3", "pretrain", 256, "vr200", "bf16"),
("deepseek", "deepseek_v3", "pretrain", 256, "vr200", "fp8_cs"),
("deepseek", "deepseek_v3", "pretrain", 256, "vr200", "fp8_mx"),
("deepseek", "deepseek_v3", "pretrain", 256, "vr200", "nvfp4"),
("deepseek", "deepseek_v3", "pretrain", 256, "vrnvl72", "bf16"),
("deepseek", "deepseek_v3", "pretrain", 256, "vrnvl72", "fp8_cs"),
("deepseek", "deepseek_v3", "pretrain", 256, "vrnvl72", "fp8_mx"),
("deepseek", "deepseek_v3", "pretrain", 256, "vrnvl72", "nvfp4"),
("deepseek", "deepseek_v3", "pretrain", 256, "b300", "bf16"),
("deepseek", "deepseek_v3", "pretrain", 256, "b300", "fp8_cs"),
("deepseek", "deepseek_v3", "pretrain", 256, "b300", "fp8_mx"),
Expand Down Expand Up @@ -255,8 +255,8 @@
("kimi", "kimi_k2", "pretrain", 256, "gb200", "bf16"),
("kimi", "kimi_k2", "pretrain", 256, "gb200", "fp8_cs"),
("kimi", "kimi_k2", "pretrain", 256, "gb200", "fp8_mx"),
("kimi", "kimi_k2", "pretrain", 256, "vr200", "bf16"),
("kimi", "kimi_k2", "pretrain", 256, "vr200", "fp8_mx"),
("kimi", "kimi_k2", "pretrain", 256, "vrnvl72", "bf16"),
("kimi", "kimi_k2", "pretrain", 256, "vrnvl72", "fp8_mx"),
("kimi", "kimi_k2", "pretrain", 256, "b300", "bf16"),
("kimi", "kimi_k2", "pretrain", 256, "b300", "fp8_cs"),
("kimi", "kimi_k2", "pretrain", 256, "b300", "fp8_mx"),
Expand Down Expand Up @@ -321,9 +321,9 @@
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "gb300", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 72, "gb300", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 512, "gb300", "fp8_mx"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "vr200", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "vr200", "fp8_mx"),
("gpt_oss", "gpt_oss_20b", "pretrain", 64, "vr200", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "vrnvl72", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "vrnvl72", "fp8_mx"),
("gpt_oss", "gpt_oss_20b", "pretrain", 64, "vrnvl72", "nvfp4"),
# GPT-OSS 120B
("gpt_oss", "gpt_oss_120b", "pretrain", 64, "gb300", "bf16"),
("gpt_oss", "gpt_oss_120b", "pretrain", 64, "gb300", "fp8_mx"),
Expand Down Expand Up @@ -408,10 +408,10 @@
("qwen_vl", "qwen35_vl_397b_a17b", "pretrain", 256, "h100", "bf16"),
("qwen_vl", "qwen35_vl_397b_a17b", "pretrain", 256, "h100", "fp8_cs"),
# Additional flattened coverage
("deepseek", "deepseek_v3", "pretrain", 128, "vr200", "bf16"),
("deepseek", "deepseek_v3", "pretrain", 128, "vr200", "fp8_cs"),
("deepseek", "deepseek_v3", "pretrain", 128, "vr200", "fp8_mx"),
("deepseek", "deepseek_v3", "pretrain", 128, "vr200", "nvfp4"),
("deepseek", "deepseek_v3", "pretrain", 128, "vrnvl72", "bf16"),
("deepseek", "deepseek_v3", "pretrain", 128, "vrnvl72", "fp8_cs"),
("deepseek", "deepseek_v3", "pretrain", 128, "vrnvl72", "fp8_mx"),
("deepseek", "deepseek_v3", "pretrain", 128, "vrnvl72", "nvfp4"),
("deepseek", "deepseek_v3", "pretrain", 256, "gb300", "fp8_mx", "large_scale"),
("deepseek", "deepseek_v3", "pretrain", 256, "gb200", "fp8_mx", "large_scale"),
("deepseek", "deepseek_v3", "pretrain", 256, "b300", "fp8_mx", "large_scale"),
Expand All @@ -421,18 +421,18 @@
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "gb200", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "b300", "fp8_mx"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "b300", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "vr200", "fp8_mx"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "vr200", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "vrnvl72", "fp8_mx"),
("gpt_oss", "gpt_oss_20b", "pretrain", 8, "vrnvl72", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 64, "b300", "fp8_mx"),
("gpt_oss", "gpt_oss_20b", "pretrain", 64, "b300", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 64, "vr200", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 64, "vrnvl72", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 72, "gb300", "nvfp4"),
("gpt_oss", "gpt_oss_20b", "pretrain", 72, "gb200", "nvfp4"),
("gpt_oss", "gpt_oss_120b", "pretrain", 64, "vr200", "bf16"),
("gpt_oss", "gpt_oss_120b", "pretrain", 64, "vr200", "fp8_mx"),
("llama", "llama3_70b", "pretrain", 64, "vr200", "bf16"),
("llama", "llama3_70b", "pretrain", 64, "vr200", "fp8_mx"),
("llama", "llama3_70b", "pretrain", 64, "vr200", "nvfp4"),
("gpt_oss", "gpt_oss_120b", "pretrain", 64, "vrnvl72", "bf16"),
("gpt_oss", "gpt_oss_120b", "pretrain", 64, "vrnvl72", "fp8_mx"),
("llama", "llama3_70b", "pretrain", 64, "vrnvl72", "bf16"),
("llama", "llama3_70b", "pretrain", 64, "vrnvl72", "fp8_mx"),
("llama", "llama3_70b", "pretrain", 64, "vrnvl72", "nvfp4"),
("llama", "llama31_405b", "pretrain", 128, "gb300", "bf16"),
("llama", "llama31_405b", "pretrain", 128, "gb300", "fp8_cs"),
("llama", "llama31_405b", "pretrain", 128, "gb300", "fp8_mx"),
Expand All @@ -447,19 +447,19 @@
("llama", "llama31_405b", "pretrain", 256, "b300", "nvfp4"),
("llama", "llama31_405b", "pretrain", 256, "b200", "fp8_mx"),
("llama", "llama31_405b", "pretrain", 256, "b200", "nvfp4"),
("llama", "llama31_405b", "pretrain", 256, "vr200", "bf16"),
("llama", "llama31_405b", "pretrain", 256, "vr200", "fp8_mx"),
("llama", "llama31_405b", "pretrain", 256, "vr200", "nvfp4"),
("nemotronh", "nemotron_3_nano", "pretrain", 8, "vr200", "bf16"),
("nemotronh", "nemotron_3_nano", "pretrain", 8, "vr200", "fp8_mx"),
("nemotronh", "nemotron_3_nano", "pretrain", 8, "vr200", "nvfp4"),
("nemotronh", "nemotron_3_super", "pretrain", 64, "vr200", "bf16"),
("nemotronh", "nemotron_3_super", "pretrain", 64, "vr200", "fp8_mx"),
("nemotronh", "nemotron_3_super", "pretrain", 64, "vr200", "nvfp4"),
("nemotronh", "nemotron_3_ultra", "pretrain", 256, "vr200", "fp8_mx"),
("nemotronh", "nemotron_3_ultra", "pretrain", 256, "vr200", "nvfp4"),
("qwen", "qwen3_30b_a3b", "pretrain", 8, "vr200", "bf16"),
("qwen", "qwen3_30b_a3b", "pretrain", 8, "vr200", "fp8_mx"),
("llama", "llama31_405b", "pretrain", 256, "vrnvl72", "bf16"),
("llama", "llama31_405b", "pretrain", 256, "vrnvl72", "fp8_mx"),
("llama", "llama31_405b", "pretrain", 256, "vrnvl72", "nvfp4"),
("nemotronh", "nemotron_3_nano", "pretrain", 8, "vrnvl72", "bf16"),
("nemotronh", "nemotron_3_nano", "pretrain", 8, "vrnvl72", "fp8_mx"),
("nemotronh", "nemotron_3_nano", "pretrain", 8, "vrnvl72", "nvfp4"),
("nemotronh", "nemotron_3_super", "pretrain", 64, "vrnvl72", "bf16"),
("nemotronh", "nemotron_3_super", "pretrain", 64, "vrnvl72", "fp8_mx"),
("nemotronh", "nemotron_3_super", "pretrain", 64, "vrnvl72", "nvfp4"),
("nemotronh", "nemotron_3_ultra", "pretrain", 256, "vrnvl72", "fp8_mx"),
("nemotronh", "nemotron_3_ultra", "pretrain", 256, "vrnvl72", "nvfp4"),
("qwen", "qwen3_30b_a3b", "pretrain", 8, "vrnvl72", "bf16"),
("qwen", "qwen3_30b_a3b", "pretrain", 8, "vrnvl72", "fp8_mx"),
("qwen", "qwen3_235b_a22b", "pretrain", 64, "gb300", "bf16"),
("qwen", "qwen3_235b_a22b", "pretrain", 64, "gb300", "fp8_cs"),
("qwen", "qwen3_235b_a22b", "pretrain", 64, "gb300", "fp8_mx"),
Expand All @@ -476,9 +476,9 @@
("qwen", "qwen3_235b_a22b", "pretrain", 64, "b200", "fp8_cs"),
("qwen", "qwen3_235b_a22b", "pretrain", 64, "b200", "fp8_mx"),
("qwen", "qwen3_235b_a22b", "pretrain", 64, "b200", "nvfp4"),
("qwen", "qwen3_235b_a22b", "pretrain", 256, "vr200", "bf16"),
("qwen", "qwen3_235b_a22b", "pretrain", 256, "vr200", "fp8_mx"),
("qwen", "qwen3_235b_a22b", "pretrain", 256, "vr200", "nvfp4"),
("qwen", "qwen3_235b_a22b", "pretrain", 256, "vrnvl72", "bf16"),
("qwen", "qwen3_235b_a22b", "pretrain", 256, "vrnvl72", "fp8_mx"),
("qwen", "qwen3_235b_a22b", "pretrain", 256, "vrnvl72", "nvfp4"),
("qwen", "qwen3_235b_a22b", "pretrain", 256, "gb300", "fp8_mx", "large_scale"),
("qwen", "qwen3_235b_a22b", "pretrain", 256, "gb200", "fp8_mx", "large_scale"),
("qwen", "qwen3_235b_a22b", "pretrain", 256, "b300", "fp8_mx", "large_scale"),
Expand Down
2 changes: 1 addition & 1 deletion scripts/performance/setup_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def main(
]
)

if peak_mem_clk is None and gpu == "vr200":
if peak_mem_clk is None and gpu == "vrnvl72":
peak_mem_clk = 4752
if peak_mem_clk == -1:
peak_mem_clk = None
Expand Down
2 changes: 1 addition & 1 deletion scripts/performance/utils/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def slurm_executor(
log_repo_status_cmd = "bash /opt/Megatron-Bridge/docker/common/print_sha.sh /nemo_run/configs/repo_status.json"
custom_bash_cmds.append(log_repo_status_cmd)

numa_divisor = 2 if gpu.lower() in ["gb200", "gb300", "vr200"] else 4
numa_divisor = 2 if gpu.lower() in ["gb200", "gb300", "vrnvl72"] else 4
numa_cmd = f"numactl --cpunodebind=$((SLURM_LOCALID/{numa_divisor})) --membind=$((SLURM_LOCALID/{numa_divisor}))"
if gpu.lower() in ["b300"] and enable_pct_binding:
numa_cmd += " -C $((SLURM_LOCALID * 16)),$((SLURM_LOCALID * 16 + 1))"
Expand Down
4 changes: 2 additions & 2 deletions scripts/performance/utils/overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def _apply_flat_cli_environment_compatibility(
if connection_override:
moe_a2a_overlap = args.moe_a2a_overlap if args.moe_a2a_overlap is not None else base_moe_a2a_overlap
max_connections = 32 if effective_dispatcher_backend in {"deepep", "hybridep", "ncclep"} else 8
if gpu in {"b200", "b300", "gb200", "gb300", "vr200"}:
if gpu in {"b200", "b300", "gb200", "gb300", "vrnvl72"}:
max_connections = 32
elif (tp_size > 1 or cp_size > 1) and not moe_a2a_overlap:
max_connections = 1
Expand All @@ -292,7 +292,7 @@ def _apply_flat_cli_environment_compatibility(
if gpu in {"h100", "b200", "b300"}:
domain_size = 8
ranks_per_domain = min(ep_size, domain_size)
elif gpu in {"gb200", "gb300", "vr200", "r100"}:
elif gpu in {"gb200", "gb300", "vrnvl72", "r100"}:
domain_size = 72
if ep_size > domain_size:
raise ValueError("HybridEP expert parallel size must not exceed the 72-rank NVLink domain.")
Expand Down
2 changes: 1 addition & 1 deletion scripts/performance/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def apply_target_topology_environment(
"NVLINK_DOMAIN_SIZE": 8,
"USE_MNNVL": 0,
}
elif normalized_gpu in {"gb200", "gb300", "vr200", "r100"}:
elif normalized_gpu in {"gb200", "gb300", "vrnvl72", "r100"}:
if expert_model_parallel_size > 72:
raise ValueError("HybridEP expert parallel size must not exceed the 72-rank NVLink domain.")
topology = {
Expand Down
7 changes: 5 additions & 2 deletions scripts/training/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ through configurable library recipes. Explicit benchmark dataset replacement rem
Five legacy duplicate names resolve to the benchmark definition; their library workloads remain available through
the corresponding generic recipe aliases. New recipe names should be unique across both packages.

Benchmark recipe names that use the deprecated `vr200` hardware name resolve to the renamed `vrnvl72` recipe with a
warning.

Text recipes default to `llm_step`; all recipes infer their modality-specific forward step from the same registry.
Pass `--step-func NAME` to override that selection. Common training,
sequence-length, parallelism, optimization, and checkpoint fields also have convenience flags such as
Expand Down Expand Up @@ -340,8 +343,8 @@ populate the executor's `additional_parameters` and are not forwarded to the
training command or its srun step.

Use `-lmc FREQ`, `--peak-mem-clk FREQ`, or `--peak_mem_clk FREQ` to lock the GPU memory clock to a fixed frequency in
MHz once per node before training. VR200 benchmark recipes default to `4752`; other recipes leave the memory clock
unlocked. Pass `-lmc -1` to disable the VR200 default explicitly.
MHz once per node before training. VRNVL72 benchmark recipes default to `4752`; other recipes leave the memory clock
unlocked. Pass `-lmc -1` to disable the VRNVL72 default explicitly.

The compact launcher does not add rank-command prefixes or infer target-specific
allocation and NUMA policies. Configure those explicitly for the target.
Expand Down
33 changes: 32 additions & 1 deletion scripts/training/recipe_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
import argparse
import ast
import functools
import logging
import os
import re
from dataclasses import dataclass
from pathlib import Path


logger = logging.getLogger(__name__)

BENCHMARK_RECIPE_FAMILY_PREFIXES = (
("qwen3_vl_", "qwen_vl"),
("qwen35_vl_", "qwen_vl"),
Expand All @@ -45,6 +49,10 @@
r"(?:_[a-z0-9_]+)?_config$"
)

# Deprecated recipe hardware names and their replacements. When the deprecation window ends, drop an entry together
# with its counterpart in LEGACY_GPU_ALIASES (scripts/performance/argument_parser.py).
LEGACY_HARDWARE_ALIASES = {"vr200": "vrnvl72"}

BENCHMARK_RECIPE_ROOT = Path(__file__).resolve().parents[2] / "src" / "megatron" / "bridge" / "perf_recipes"

# These names are exported by both recipe packages today. Bare recipe lookup
Expand Down Expand Up @@ -181,8 +189,31 @@ def available_benchmark_recipe_metadata(recipe_name: str) -> BenchmarkRecipeMeta
return metadata


@functools.lru_cache(maxsize=None)
def _canonical_recipe_name(recipe_name: str) -> str:
"""Replace a deprecated hardware name in a benchmark recipe name when the renamed recipe is exported.

Cached so each process logs the deprecation once per requested name.
"""
match = BENCHMARK_RECIPE_PATTERN.search(recipe_name)
if match is None or match.group("hardware") not in LEGACY_HARDWARE_ALIASES:
return recipe_name
start, end = match.span("hardware")
canonical_name = f"{recipe_name[:start]}{LEGACY_HARDWARE_ALIASES[match.group('hardware')]}{recipe_name[end:]}"
if available_benchmark_recipe_metadata(canonical_name) is None:
return recipe_name
# Every rank re-runs this lookup, so only the launcher and global rank 0 warn.
if os.environ.get("RANK", os.environ.get("SLURM_PROCID", "0")) == "0":
logger.warning("Recipe '%s' uses a deprecated hardware name; use '%s'.", recipe_name, canonical_name)
return canonical_name


def resolved_benchmark_recipe_metadata(recipe_name: str) -> BenchmarkRecipeMetadata | None:
"""Return benchmark metadata after applying unified lookup precedence."""
"""Return benchmark metadata after applying legacy hardware aliases and unified lookup precedence.

A deprecated hardware name resolves to the renamed recipe, so callers load ``metadata.recipe_name``.
"""
recipe_name = _canonical_recipe_name(recipe_name)
if recipe_name in LIBRARY_RECIPE_PRECEDENCE_COLLISIONS:
return None
return available_benchmark_recipe_metadata(recipe_name)
Expand Down
5 changes: 4 additions & 1 deletion scripts/training/recipe_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ def load_recipe(
seq_length: int | None = None,
) -> ConfigContainer:
"""Load an exact benchmark recipe when exported, otherwise a library recipe."""
if resolved_benchmark_recipe_metadata(recipe_name) is not None:
benchmark_metadata = resolved_benchmark_recipe_metadata(recipe_name)
if benchmark_metadata is not None:
# The resolved name replaces a deprecated hardware name in the requested one.
recipe_name = benchmark_metadata.recipe_name
config_builder = find_benchmark_recipe(recipe_name)
package_name = "megatron.bridge.perf_recipes"
recipe_kind = "benchmark"
Expand Down
Loading
Loading