bridge.perf_recipes._common#
Shared helpers for flat performance benchmark recipes.
_benchmark_common applies throughput-measurement defaults.
_perf_precision returns a mixed-precision config for a given dtype.
Module Contents#
Functions#
Apply benchmark-mode defaults that prioritize throughput measurement over convergence. |
|
Switch a flex-dispatcher recipe to the NCCL EP backend (GB300 MoE default). |
|
Return mixed-precision config tuned for perf benchmarks. |
API#
- bridge.perf_recipes._common._benchmark_common(
- cfg: megatron.bridge.training.config.ConfigContainer,
- cross_entropy_impl: str = 'te',
Apply benchmark-mode defaults that prioritize throughput measurement over convergence.
Intended for performance benchmark recipes only. Sets short training runs, disables checkpointing/eval, tunes scheduler, and enables perf-oriented kernels.
This is the fixed-model-shape policy for flat performance recipes. Canonical recipes launched with
scripts/performance --use_recipesretain their own tokenizer vocabulary policy.Individual recipes may override any of these after calling this function (e.g. Kimi K2 sets
grad_reduce_in_fp32 = True).
- bridge.perf_recipes._common._enable_ncclep(
- cfg: megatron.bridge.training.config.ConfigContainer,
Switch a flex-dispatcher recipe to the NCCL EP backend (GB300 MoE default).
Call after
_benchmark_common. Only the dispatch stack changes; parallelism, precision, recompute and the CUDA graph mode stay as the recipe set them. The calling recipe still declares its owncfg.env_varsinline and adds"NCCL_EP_HT_EM_PULL_PUSH": 1there.
- bridge.perf_recipes._common._perf_precision(compute_dtype: str)#
Return mixed-precision config tuned for perf benchmarks.
Identical to
scripts/performance/utils/precision.get_precision_configbut importable from the recipe package. Always setsgrad_reduce_in_fp32=Falseso that callers that replacecfg.mixed_precisionafter_benchmark_common()still get the benchmark-mode default.