Skip to content

feat(docker): add ROCm image for MI350X and MI300X - #533

Merged
SigureMo merged 5 commits into
redai-studio:mainfrom
Vivicai1005:feat/rocm-image
Nov 4, 2026
Merged

SigureMo merged 5 commits into
redai-studio:mainfrom
Vivicai1005:feat/rocm-image

Conversation

@Vivicai1005

Copy link
Copy Markdown
Contributor

What

The ROCm image (gfx950/gfx942), the en/zh ROCm guide plus the docker/README.md section, and the cuda_ipc fix for a ROCm regression on main since #495.

How

Testing

  • End-to-end colocated GRPO on 8× MI350X (gfx950 image):

    Task Rollouts Result mismatch_kl
    Qwen3-4B DAPO-Math (run-qwen3-4B-8xgpu.sh) 3 Succeeded; weight update 3.9 s, step ≈ 159 s 6.2e-4 – 1.0e-3
    Qwen3-VL-4B Open-R1 (run-qwen3-vl-4B-8xgpu.sh) 3 Succeeded; reward 0.36 → 0.52, weight update 4.3 s 6.7e-4 – 7.2e-4
    Qwen3-Omni-30B-A3B AVQA (16-GPU recipe on one node, EP 4) 450 Held-out AVQA accuracy 0.750 → 0.884; reward 0.81 → 0.95 (first/last 50 rollouts) 3.0e-3 – 6.2e-3
  • pre-commit run --all-files passes

  • Tests pass (pytest tests/)

  • New tests added (if applicable)

  • Documentation updated (if applicable)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • CI/CD or build changes

Screenshots / Logs

Single-node engines now default mm_feature_transport to cuda_ipc (redai-studio#495), but
SGLang rejects that transport on ROCm ("--mm-feature-transport=cuda_ipc requires
NVIDIA CUDA"), so every SGLang engine failed to start on AMD GPUs.

## 🐛 Bug Fix

- Skip the cuda_ipc default for policy and GenRM engines when running on ROCm,
  leaving SGLang's automatic transport selection; CUDA behavior is unchanged

## ✅ Tests

- Pin is_rocm=False for the existing CUDA transport cases so they do not depend
  on the host GPU
- Add a ROCm case for policy and GenRM engines expecting the auto policy
Add docker/Dockerfile.rocm so Relax can train on AMD Instinct GPUs. GPU_ARCH
selects gfx950 (MI350X/MI355X, default) or gfx942 (MI300X/MI325X).

- Build on SGLang's official v0.5.21 ROCm 10 image, pinned by digest per arch
- Apply the same SGLang patch, Rust tree core, DP-aware router and Megatron
  patch sequence as Dockerfile.cu13
- Disable the aiter fused qk-norm + M-RoPE decode path, which corrupts the KV
  cache and breaks Qwen3-VL on ROCm (fixed upstream in sgl-project/sglang#44266)
- Install Transformer Engine, apex and flash-attn from prebuilt ROCm wheels,
  verified against their release SHA-256 digests
- Install requirements.txt without the pins that would downgrade the base
  NumPy 2 stack, plus the ROCm additions in rocm-runtime-requirements.txt
- Add the ROCm guide (en/zh): supported GPUs, image build, container flags,
  training and ROCm runtime settings
- Link it from the installation guides and the Getting Started sidebar
- Add the ROCm build commands to docker/README.md
@Vivicai1005
Vivicai1005 requested a review from a team November 2, 2026 06:58
@rai-studio-bot

rai-studio-bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for contributing to Relax, @Vivicai1005! 感谢你为 Relax 做出贡献!

📚 Contribution guide / 贡献指南

Describe the problem, your changes, and how you validated them. Keep each PR focused and run pre-commit run --all-files before submitting.

请说明问题、改动和验证方式,保持 PR 聚焦,并在提交前运行 pre-commit run --all-files。

English contribution guide · 中文贡献指南

🛠️ CI commands / CI 指令
Command / 指令 Usage / 用途
/rerun Retry failed CI / 重跑失败的 CI
/rerun <target> Rerun a workflow or check / 重跑指定 workflow 或检查
/cancel <workflow> Cancel an entire workflow / 取消整个 workflow
/help Show commands and targets / 查看指令和 target
/review Request a code review / 请求代码 review

Put one command on the first line of a new PR comment. Rerun/cancel require PR authorship or repository write access.

在新 PR 评论的首行写一条指令。PR 作者或有仓库写权限的贡献者可以重跑、取消 CI。

CI usage and targets · CI 用法与 target

🔎 Merge requirements / 合入条件

GitHub:⏳ 合入条件未满足

Requirement / 条件 Status / 状态
审批人数 ⏳ 0/1 · 至少 1 位有仓库 write 或更高权限的人 Approve
团队审批(relax-block-reviewers) ⏳ 0/1 · 可联系:Aurelius84, Yangruipis, yuanlehome, SigureMo, NINGBENZHE
CI ✅ 已通过

@SigureMo SigureMo self-assigned this Nov 2, 2026

SigureMo commented Nov 3, 2026

Copy link
Copy Markdown
Member

Two documentation points:

  1. [P2] Fix the repository bind mount in both ROCm guides. The build instructions already run cd Relax, so the subsequent -v $(pwd)/Relax:/root/Relax mounts a nested Relax/Relax directory instead of the repository. Use -v "$(pwd):/root/Relax" when running from the repository root.

  2. Nest AMD ROCm under Installation in the sidebar. Keep rocm.md as a separate page, but add it to an items array on the existing Installation entry instead of placing it between Installation and Quick Start. Please apply this to both the English and Chinese sidebars; the page content does not need to be merged into installation.md.

This comment is replied by codex (gpt-6)

Bring in the CPU/GPU unit-test split from main (redai-studio#539). Preserve the ROCm
transport regression tests in tests/cpu/backends/sglang with the migrated
fixture import path.

Co-authored-by: Codex <[email protected]>
@rai-studio-bot

Copy link
Copy Markdown
Contributor

Nyanpasu 审查看板

审查状态: 🔎 审查中

审查版本: 226183b

目标分支: main

审查已启动,固定 head 的 11 个变更路径已完成 scope admission;正在核对 ROCm 镜像构建、运行时 transport 和双语文档命令。

审查阶段进度范围与结果
常规审查 🔎 进行中 已完成固定 head、变更清单和 scope admission;正在检查构建链、运行时调用方及文档入口。
深度审查 ⏳ 待开始 待一般检查完成后,对已识别的高风险边界做定向验证。

尚无已确认的问题记录;这不代表审查通过。

提交范围 · 接收 11 · 建议移出 0 · 待确认 0

接收 11 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。

文件结论仓库维护必要性依据替代去向或方案
docker/Dockerfile.rocm
docker/patch/rocm/sglang-v0.5.21-rocm.patch
docker/rocm-runtime-requirements.txt
docker/README.md
接收 These files define the new ROCm image, its SGLang compatibility patch, runtime dependencies, and the documented build entrypoint; they are the direct implementation of the PR goal. PR description: add a ROCm image for gfx950/gfx942 and document how to build it. Keep the image, patch, and requirements together; only relocate documentation if it proves inconsistent with the supported build flow.
relax/backends/sglang/sglang_engine.py
接收 This conditional transport change is the runtime compatibility fix claimed by the PR for ROCm. PR description: skip the cuda_ipc default on ROCm regression since #495. Retain the existing default path and gate only the ROCm-specific transport behavior if source contracts require narrower scope.
tests/cpu/backends/sglang/test_sglang_engine.py
接收 The test update is the direct regression coverage for the changed transport default and is already placed in the CPU suite. Changed production behavior in relax/backends/sglang/sglang_engine.py and repository CPU-test placement rules. Extend the existing focused test with the ROCm and non-ROCm branches rather than adding a separate suite.
docs/.vitepress/config.mts
docs/en/guide/installation.md
docs/en/guide/rocm.md
docs/zh/guide/installation.md
docs/zh/guide/rocm.md
接收 The bilingual guides and sidebar links are directly required to make the new image discoverable and runnable; their correctness depends on the image build and run commands. PR description: add an English/Chinese ROCm guide and update installation navigation. Keep one bilingual page pair and link it from Installation; remove only duplicated or contradictory steps if found.
Powered by Nyanpasu with Codex, please check the suggestions carefully.

@Vivicai1005

Copy link
Copy Markdown
Contributor Author

Two documentation points:

  1. [P2] Fix the repository bind mount in both ROCm guides. The build instructions already run cd Relax, so the subsequent -v $(pwd)/Relax:/root/Relax mounts a nested Relax/Relax directory instead of the repository. Use -v "$(pwd):/root/Relax" when running from the repository root.
  2. Nest AMD ROCm under Installation in the sidebar. Keep rocm.md as a separate page, but add it to an items array on the existing Installation entry instead of placing it between Installation and Quick Start. Please apply this to both the English and Chinese sidebars; the page content does not need to be merged into installation.md.

This comment is replied by codex (gpt-6)

Thanks — both fixed in ff36904: the ROCm guides now mount "$(pwd):/root/Relax" from the repository root, and AMD ROCm is nested under Installation in the English and Chinese sidebars.

@SigureMo SigureMo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

@SigureMo
SigureMo merged commit ba59b8c into redai-studio:main Nov 4, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants