Primus v26.4#172
Merged
Merged
Conversation
Add llama3.1 8B mxfp4/mxfp8 examples. Update READMEs with torchtitan and Megatron. Move to Rock based pytorch docker images. Modified logic to detect device type for rock images
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the MAD/Primus benchmark and training tooling to align with Primus v26.4 (new base images), adds Llama 3.1 8B MXFP8/MXFP4 example coverage, and improves AMD device/ROCm CLI detection across Python and shell entrypoints (including ROCm SDK-in-venv layouts).
Changes:
- Bump AMD training Docker base images to
rocm/primus:v26.4and refresh benchmark READMEs with updated component versions + new MXFP examples. - Add robust ROCm CLI discovery (ROCM_PATH/venv
_rocm_sdk_devel/classic/opt/rocm) and use it for device detection and GPU enumeration. - Expand Primus Megatron-LM scripts to include MXFP8/MXFP4 options (with MI35x-specific handling).
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/utils.py | Adds get_rocm_bin_dir() and uses it for AMD GPU vendor detection, GPU count, and arch detection. |
| tools/run_models.py | Adjusts AMD GPU info collection inside containers to be resilient to ROCm tool locations. |
| scripts/pytorch_train/pytorch_benchmark_report.sh | Makes ROCm device detection work with ROCM_PATH/venv tool layouts via resolved ROCM_BIN. |
| scripts/primus/pytorch_train/primus_pytorch_benchmark_report.sh | Same ROCm device detection update for Primus PyTorch benchmark report flow. |
| scripts/primus/megatron-lm/run.sh | Adds ROCm CLI resolution + updates datatype selection (including MXFP8/MXFP4) per model/device. |
| scripts/primus/megatron-lm/primus_megatron-lm_benchmark_setup.sh | Extends setup to patch in log parsing + Zebra-Llama FLOPs robustness changes. |
| scripts/primus/megatron-lm/primus_megatron-lm_benchmark_report.sh | Adds MXFP datatype support + ROCm CLI resolution; adjusts training invocation for MXFP4. |
| scripts/megatron-lm/megatron-lm_benchmark_report.sh | Aligns ROCm device detection with ROCM_PATH/venv tool layouts. |
| scripts/kvcache_transfer_bench/backends/common/utils.py | Allows ROCm version discovery from ROCM_PATH in addition to /opt/rocm. |
| scripts/common/rocm_paths.sh | Introduces a shared ROCm CLI resolution snippet for benchmark scripts. |
| docker/pytorch_train.ubuntu.amd.Dockerfile | Bumps base image from v26.3 to v26.4. |
| docker/primus_pytorch_train.ubuntu.amd.Dockerfile | Bumps base image from v26.3 to v26.4. |
| docker/primus_megatron_train.ubuntu.amd.Dockerfile | Bumps base image from v26.3 to v26.4. |
| docker/megatron_train.ubuntu.amd.Dockerfile | Switches base image to rocm/primus:v26.4. |
| benchmark/pytorch_train/README.md | Updates referenced image tag + component versions for v26.4. |
| benchmark/megatron_lm/README.md | Updates v26.4 versions and adds MXFP8/MXFP4 usage examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+142
to
145
| elif [[ "$model" == "GPT-OSS-20B" || "$model" == "GPT-OSS-120B" || "$model" == "Qwen-3-30B" || "$model" == "Qwen-3-235B" ]]; then | ||
| datatypes=("BF16" "FP8") | ||
| elif [[ "$model" == "GPT-OSS-20B" || "$model" == "GPT-OSS-120B" || "$model" == "Qwen-3-30B" || "$model" == "Qwen-3-235B" ]]; then | ||
| datatypes=("BF16" "FP8") |
| + LOG_INFO "[direct] Using Megatron log parser" | ||
| + | ||
| + num_warmup=$(grep -m1 'lr_warmup_iters' "${TRAIN_LOG}" | sed -En 's/.*lr_warmup_iters[^:]*:[[:space:]]*([0-9,]+).*/\1/p' | tr -d ',' 2>/dev/null) | ||
| + num_warmup=$(grep 'lr_warmup_iters' "${TRAIN_LOG}" | sed -En 's/.*lr_warmup_iters[^:]*:[[:space:]]*([0-9,]+).*/\1/p' | tr -d ',' 2>/dev/null) |
| + LOG_INFO "[direct] Using Torchtitan log parser" | ||
| + | ||
| + num_warmup=$(grep 'lr_scheduler.warmup_steps' "${TRAIN_LOG}" | sed -En 's/.*lr_scheduler.warmup_steps[^:]*:[[:space:]]*([0-9,]+).*/\1/p' | tr -d ',' 2>/dev/null) | ||
| + num_warmup=$(grep 'lr_scheduler.warmup_steps' ${TRAIN_LOG} | sed -En 's/.*lr_scheduler.warmup_steps[^:]*:[[:space:]]*([0-9,]+).*/\1/p' | tr -d ',' 2>/dev/null) |
| + LOG_INFO "[direct] Using Megatron log parser" | ||
| + | ||
| + num_warmup=$(grep -m 1 'lr_warmup_iters' "${TRAIN_LOG}" | sed -En 's/.*lr_warmup_iters[^:]*:[[:space:]]*([0-9,]+).*/\1/p' | tr -d ',' 2>/dev/null) | ||
| + num_warmup=$(grep 'lr_warmup_iters' "${TRAIN_LOG}" | sed -En 's/.*lr_warmup_iters[^:]*:[[:space:]]*([0-9,]+).*/\1/p' | tr -d ',' 2>/dev/null) |
| + LOG_INFO "[direct] Using Torchtitan log parser" | ||
| + | ||
| + num_warmup=$(grep -m 1 'lr_scheduler.warmup_steps' ${TRAIN_LOG} | sed -En 's/.*lr_scheduler.warmup_steps[^:]*:[[:space:]]*([0-9,]+).*/\1/p' | tr -d ',' 2>/dev/null) | ||
| + num_warmup=$(grep 'lr_scheduler.warmup_steps' ${TRAIN_LOG} | sed -En 's/.*lr_scheduler.warmup_steps[^:]*:[[:space:]]*([0-9,]+).*/\1/p' | tr -d ',' 2>/dev/null) |
Comment on lines
+196
to
+198
| if [[ "$DATATYPE" == "MXFP8" || "$DATATYPE" == "MXFP4" ]]; then | ||
| echo "Error: Datatype $DATATYPE is not supported for $MODEL_REPO on $DEVICE. Only supported on MI355X/MI350X." | ||
| else |
Comment on lines
876
to
879
| bash runner/primus-cli direct \ | ||
| --log_file /tmp/primus_$MODEL_REPO.log \ | ||
| -- train pretrain \ | ||
| --config $EXP 2>&1 | tee -a $TRAIN_LOG |
alfuyao-amd
reviewed
Jun 30, 2026
| git clone --recurse-submodules https://github.com/AMD-AGI/Primus.git | ||
| cd Primus/ | ||
| git checkout release/v26.3 | ||
| git checkout 236cfa9 |
Contributor
There was a problem hiding this comment.
Why not release/v26.4 or tag v26.4.0?
Signed-off-by: Gene Der Su <e870252314@gmail.com>
1 task
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add llama3.1 8B mxfp4/mxfp8 examples.
Update READMEs with torchtitan and Megatron.
Move to Rock based pytorch docker images. Modified logic to detect device type for rock images