You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Benchmarks - Add ROCm TransferBench mem-bw backend and fix PyTorch DDP store init - #868
Description
Split out of #867 at the reviewer's request. These changes are independent of the ROCm 10 image. The new options are opt-in and their defaults are unchanged. The one change to default behavior is a bug fix to how PyTorch model benchmarks create the DDP store.
Major Revision
mem-bw (ROCm): add a TransferBench backend, selected with SB_ROCM_MEM_BW_BACKEND=transferbench, for ROCm 10 images where the HIP 5.5 hipBusBandwidth sample is unavailable. It keeps the hipBusBandwidth policy: the same size sweep (64 B–512 MiB) and trial counts, one DMA engine on the visible GPU, pinned P0 or pageable H<worker NUMA node>, a per-size arithmetic mean, then the maximum across sizes. A sweep fails on any TransferBench error, missing iteration or unexpected route, with no fallback. The default backend is still hipbusbandwidth.
PyTorch model benchmarks (DDP): fix intermittent ResNet/BERT crashes under torchrun. _init_distributed_setting started a new TCPStore server on MASTER_PORT + 1 and also rewrote MASTER_PORT to that port. If that port was already in use (e.g. as an ephemeral port), torch ignored the bind failure because TORCHELASTIC_USE_AGENT_STORE was set and the port matched MASTER_PORT. Rank 0 then quietly connected to an unrelated socket. Now:
Under torchrun (TORCHELASTIC_USE_AGENT_STORE=True), every rank joins the agent's store on MASTER_PORT as a client, the same way torch.distributed.rendezvous does.
Otherwise, rank 0 hosts the store on MASTER_PORT.
MASTER_PORT is no longer modified, and a per-process sequence in the store prefix keeps the keys of successive benchmarks apart.
Minor Revision
Model benchmarks: add --optimizer_eps (default 1e-8; 1e-4 is needed for native FP16 Adam) and allow bfloat16 for BERT, GPT-2 and LLaMA.
megatron-gpt: without --code_base, default to $SB_MEGATRON_PATH when set; actually append --extra; fail on a nonzero training exit; restore OMPI_COMM_WORLD_LOCAL_RANK.
Tests: add TransferBench parser tests with synthetic v1.69.00 CSV-mode fixtures, Megatron launch and precision/epsilon tests, and a DDP store test covering agent-store and non-agent-store ranks, MASTER_PORT preservation and unique key prefixes.
Docs: document the new options in micro-benchmarks.md and model-benchmarks.md.
Validation
python3 -m pytest tests/benchmarks/model_benchmarks/test_pytorch_base.py tests/benchmarks/model_benchmarks/test_transformer_precisions.py tests/benchmarks/model_benchmarks/test_megatron_launch.py: 21 passed (Linux, CPU PyTorch 2.14.1). The new DDP store test fails against the previous pytorch_base.py.
yapf --diff and flake8 are clean on the changed files.
… fixes
Split out of the ROCm 10 image PR (microsoft#867), ported from arsdragonfly/superbenchmark@rocm10.
- mem-bw: opt-in TransferBench backend (SB_ROCM_MEM_BW_BACKEND=transferbench)
that keeps the hipBusBandwidth size sweep, trial counts and reduction.
- model-benchmarks: --optimizer_eps; bfloat16 for BERT/GPT-2/LLaMA.
- megatron-gpt: SB_MEGATRON_PATH default code base, apply --extra, fail on
nonzero training exit and restore OMPI_COMM_WORLD_LOCAL_RANK.
- Add synthetic TransferBench fixtures and document the new options.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
run_command(flush_output=True), used with --log_flushing, splits the command
without a shell, so the && chain was passed to the first TransferBench as
arguments. Wrap each direction's sweep in sh -c and test both paths.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Benchmark.run() records exceptions but still returns True, so raising on a
nonzero Megatron exit did not fail the run. Log the failure and return no
timings so ModelBenchmark.__train() takes its normal failure path.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This early default only handles the environment override. When SB_MEGATRON_PATH is unset, code_base remains empty while ModelBenchmark._preprocess() is still inside _generate_dataset(), so dataset generation invokes the relative tools/preprocess_data.py path before the legacy fallback at lines 243–245 is applied. Set the legacy Megatron-LM path here as well so the documented fallback works when preprocessing a missing dataset.
type=float accepts invalid optimizer epsilons such as negative or infinite values. A negative value makes torch.optim.Adam/AdamW raise during _create_optimizer() (and the benchmark's exception path can still return success), while infinity silently prevents meaningful updates. Validate that this new public argument is finite and positive during argument preprocessing so invalid input returns INVALID_ARGUMENT.
Binding a TCPStore server on MASTER_PORT + 1 can collide with an ephemeral port. Because MASTER_PORT was also rewritten to that port, torch ignored the bind failure under TORCHELASTIC_USE_AGENT_STORE and rank 0 silently became a client of an unrelated socket, crashing ResNet/BERT DDP runs.
Under torchrun, join the agent's store on MASTER_PORT as a client, matching torch.distributed.rendezvous; otherwise rank 0 hosts it on MASTER_PORT. MASTER_PORT is no longer modified, and a per-process sequence keeps the store keys of successive benchmarks apart.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Nguyen Vuong (normanvuong)
changed the title
Benchmarks - Add ROCm TransferBench mem-bw backend and model benchmark fixes
Benchmarks - Add ROCm TransferBench mem-bw backend and fix PyTorch DDP store init
Nov 2, 2026
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The rendezvous change lacks multi-process coverage for both store paths and repeated initialization, and the new test uses mock-call APIs unavailable in supported Python 3.7.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Split out of #867 at the reviewer's request. These changes are independent of the ROCm 10 image. The new options are opt-in and their defaults are unchanged. The one change to default behavior is a bug fix to how PyTorch model benchmarks create the DDP store.
Major Revision
mem-bw(ROCm): add a TransferBench backend, selected withSB_ROCM_MEM_BW_BACKEND=transferbench, for ROCm 10 images where the HIP 5.5hipBusBandwidthsample is unavailable. It keeps thehipBusBandwidthpolicy: the same size sweep (64 B–512 MiB) and trial counts, one DMA engine on the visible GPU, pinnedP0or pageableH<worker NUMA node>, a per-size arithmetic mean, then the maximum across sizes. A sweep fails on any TransferBench error, missing iteration or unexpected route, with no fallback. The default backend is stillhipbusbandwidth.torchrun._init_distributed_settingstarted a new TCPStore server onMASTER_PORT + 1and also rewroteMASTER_PORTto that port. If that port was already in use (e.g. as an ephemeral port), torch ignored the bind failure becauseTORCHELASTIC_USE_AGENT_STOREwas set and the port matchedMASTER_PORT. Rank 0 then quietly connected to an unrelated socket. Now:torchrun(TORCHELASTIC_USE_AGENT_STORE=True), every rank joins the agent's store onMASTER_PORTas a client, the same waytorch.distributed.rendezvousdoes.MASTER_PORT.MASTER_PORTis no longer modified, and a per-process sequence in the store prefix keeps the keys of successive benchmarks apart.Minor Revision
--optimizer_eps(default1e-8;1e-4is needed for native FP16 Adam) and allowbfloat16for BERT, GPT-2 and LLaMA.megatron-gpt: without--code_base, default to$SB_MEGATRON_PATHwhen set; actually append--extra; fail on a nonzero training exit; restoreOMPI_COMM_WORLD_LOCAL_RANK.MASTER_PORTpreservation and unique key prefixes.micro-benchmarks.mdandmodel-benchmarks.md.Validation
python3 -m pytest tests/benchmarks/model_benchmarks/test_pytorch_base.py tests/benchmarks/model_benchmarks/test_transformer_precisions.py tests/benchmarks/model_benchmarks/test_megatron_launch.py: 21 passed (Linux, CPU PyTorch 2.14.1). The new DDP store test fails against the previouspytorch_base.py.yapf --diffandflake8are clean on the changed files.