docker: pin ordering-edge HIP/HSA in native and nightly release images - #2300
Conversation
🏷️ CI GuideRuns automatically on every eligible PR before approval:
Heavy model tests:
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical release-path and runtime-build blockers remain, plus a status-reporting issue.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Adds a ROCm 7.2.4 ordering-edge HIP/HSA runtime with switching, rollback, Docker integration, documentation, and tests.
Changes:
- Builds the pinned runtime pair conditionally.
- Adds checksum-backed stock/patched switching and rollback.
- Documents usage and validates switching behavior.
| File | Reviewed changes |
|---|---|
tests/test_rocm_runtime_switch.py |
Tests runtime switching, rollback, aliases, and failure cases. |
docker/rocm-runtime/switch_runtime.py |
Implements paired runtime selection and backups; status handling lacks a marker for disabled stock images. |
docker/rocm-runtime/README.md |
Documents builds, switching, rollback, and validation. |
docker/rocm-runtime/build.sh |
Builds the backport; lacks required OpenGL development packages for rocclr. |
docker/Dockerfile |
Adds runtime stages and reselection; release Docker paths remain unintegrated. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Apply the runtime changes to the release Dockerfile or update the workflow to use this file.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
Resolved since last review (1)
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A real BuildKit build of each runtime stage and default final target is still required.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (3)
Resolved since last review (1)
Review — pin ordering-edge HIP/HSA in native and nightly release imagesReviewed at What concerns me is the shape around it, and it has one clean statement:
Provenance: [verified] means I read the deciding code or ran the command myself. [reported] means the shape matches the code but I did not trace it end to end. 1. The safety net was in the first commit and was deleted before submission [verified]
Only the silent It also means the submitted version has no test at all, where the first draft had 101 lines of one. 2. Nothing verifies the swap, and the marker that could is never read [verified]Both guards fail open: if ! grep -Eq '^7\.2\.4([+-]|$)' /opt/rocm/.info/version; then exit 0; fi(The regex itself is correct — it matches An empty The stage already writes the thing that would catch it: git rev-parse HEAD > /staging/.info/atom-rocm-runtime-commit
Smallest fix that closes the whole class — after test -s /opt/rocm/.info/atom-rocm-runtime-commit
nm -D /opt/rocm/lib/libhsa-runtime64.so.1 | grep -q hsa_amd_signal_create_v23. The staging half and the fixup half disagree about the soname major [verified]# staging (:331-332) — major-agnostic
cp -P /rocr-install/lib/libhsa-runtime64.so* /staging/lib/
cp -P /clr-install/lib/libamdhip64.so* /staging/lib/
# fixup (:831-832) — hardcoded
ours_hsa="$(readlink -f libhsa-runtime64.so.1)"
ours_hip="$(readlink -f libamdhip64.so.7)"The comment at Derive the majors from the staged filenames or from the ELF Related, and the reason the 4.
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Both Dockerfiles have unresolved moderate issues affecting build parallelism and versioned library replacement.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
| # Drop this stage once the official base image includes ordering-edge signals. | ||
| FROM base AS build_rocm_runtime | ||
| ARG ROCM_SYSTEMS_REPO="https://github.com/ROCm/rocm-systems.git" | ||
| ARG ROCM_RUNTIME_COMMIT="b539bf7eebfd99ad0a69668caa1f4037034d501f" |
| # Drop this stage once the official base image includes ordering-edge signals. | ||
| FROM base AS build_rocm_runtime | ||
| ARG ROCM_SYSTEMS_REPO="https://github.com/ROCm/rocm-systems.git" | ||
| ARG ROCM_RUNTIME_COMMIT="b539bf7eebfd99ad0a69668caa1f4037034d501f" |
|
Replying to the review above. Thanks — this is a careful read, and the framing is right: this stage exists because a nightly shipped the stock runtime silently, and as submitted it had no way to catch the same class again. I've pushed §4 — settled, BuildKit does traverse the symlink chainYou flagged this as the one you couldn't verify without a build, so I ran it. Your premise is right. On the 7.2.4 image it really is two hops, and the target really does hold the consumers you listed: Minimal reproduction of exactly that shape (docker 29.7.2, buildx v0.36.1): FROM busybox AS src
RUN mkdir -p /staging/lib && echo newlib > /staging/lib/newfile
FROM busybox
RUN mkdir -p /opt/rocm-7.2.4/lib /opt/rocm-7.2.4/bin /opt/rocm-7.2.4/llvm /etc/alternatives \
&& echo tool > /opt/rocm-7.2.4/bin/amdgpu-arch \
&& ln -s /opt/rocm-7.2.4 /etc/alternatives/rocm \
&& ln -s /etc/alternatives/rocm /opt/rocm
COPY --from=src /staging/ /opt/rocm/Result:
§2 — fixed, and the marker now has a readerYou're right that hsa="$(grep -m1 '^libhsa-runtime64\.so\.' /opt/rocm/.info/atom-rocm-runtime-sonames)"
nm -D "/opt/rocm/lib/$hsa" | grep -q hsa_amd_signal_create_v2I used your suggested symbol and confirmed it separates the two cases on real images:
§3 — fixed; dangling-link failure reproducedThe soname major now comes from what the builder actually staged, recorded next to the commit marker: ( cd /staging/lib && ls -1 libhsa-runtime64.so.* libamdhip64.so.* \
| grep -E '\.so\.[0-9]+$' ) > /staging/.info/atom-rocm-runtime-sonamesOn the shipped image the versioned filenames differ: the backport builds Your dangling-link point was the more dangerous half, and it reproduces:
if [ -L "$soname" ]; then [ -e "$soname" ]; fi
ours="$(readlink -f "$soname")"
[ -s "$ours" ]I also took your For the record, the replacement itself does work end to end on the shipped image: Smaller items
Two I'm noting rather than changing: only §1, §5, §6 — acknowledged, not addressed hereAll three are fair and none are fixed by this commit. §1: the knob and the 101-line test were dropped on purpose to cut the surface area, and you're right that what survived has no way to say "this build must carry the backport". I'll put this in the PR body either way so it isn't rediscovered. §5: §6: the downstream package-install steps are a real place where the replacement could be overwritten, and the RCCL backup/restore documents an actual dependency-driven reinstall for RCCL. However, dpkg ownership or an md5 mismatch alone does not establish that On altitude: publishing the runtime once as its own artifact keyed on |
Signed-off-by: Lirong Zhang <219599949+ZhangLirong-amd@users.noreply.github.com>
Signed-off-by: Lirong Zhang <219599949+ZhangLirong-amd@users.noreply.github.com>
Signed-off-by: Lirong Zhang <219599949+ZhangLirong-amd@users.noreply.github.com>
This stage exists because a nightly shipped the stock runtime and nobody
noticed. As written, every failure path in it still ends at `exit 0` with a
successfully published image, and nothing reads the marker the builder
already writes.
Verification. The builder now also records the sonames it actually produced,
and the install step asserts both marker files and ends by checking the
backported symbol:
nm -D "$hsa" | grep -q hsa_amd_signal_create_v2
Checked against real images: present on rocm/atom-dev:agentic-dsv4-updated-rocm
(marker b539bf7, libamdhip64.so.7.2.70204 -ef libamdhip64.so.7, both links=2),
absent on a stock 7.2.4 image. So the check separates the two cases it needs to.
Soname major. Staging copies libamdhip64.so* while the fixup hardcoded
libamdhip64.so.7. A future ROCM_RUNTIME_COMMIT that bumps a major would land
under the new name while readlink resolved the surviving stock symlink, so the
loop would hard-link stock onto stock and report success -- with a fresh mtime
from the touch making it look patched. The majors now come from the staged
filenames. Not hypothetical: this commit builds
libamdhip64.so.7.2.53211-b539bf7 against a stock 7.2.70204.
Dangling target. `readlink -f` exits 0 and prints the would-be path for a
dangling link, so a COPY that delivered no target made the touch CREATE a
0-byte file, which the loop then hard-linked over the real runtime, invisible
to `set -eux`. Reproduced locally; guarded now.
Also threads MAX_JOBS into the four hardcoded `--parallel 16`, and rewrites the
epilogue comment, which inverted upstream's reason for hard links.
Parser and shell checked: `bash -n` and `dash -n` on the reconstructed block,
and a BuildKit build confirming comments inside the RUN continuation are
stripped and the while-read loop runs.
a628358 to
18f898e
Compare


ROCm 7.2.4 base images ship HIP/HSA without ordering-edge signals. Build the paired runtime from
ROCm/rocm-systemscommitb539bf7eebfd99ad0a69668caa1f4037034d501f, following the backport used by vllm-project/vllm#55099, and replace the libraries in native ATOM images.Both
docker/Dockerfileanddocker/atom_release.dockerfileinclude the same inline builder and final replacement. The latter is the path used by the nightly Docker Release workflow. Build ROCr first, then HIP/CLR against its headers; install the pair after all dependencies. Preserve old versioned library paths with hard links, copying up the source files before linking so Docker layers retain alias identity. Record the source commit in/opt/rocm/.info/atom-rocm-runtime-commit. Non-7.2.4 bases keep their stock runtimes. Future updates change the commit pin; rollback uses the previous image.Validation:
3a6ccd8b51d404e5c41635c1ad9f0a676a1c4e4band builtdocker/atom_release.dockerfile. That image retained stock runtimes because this Dockerfile lacked the replacement steps.atom_imagetarget. Verified both Dockerfiles have identical runtime build/replacement blocks, valid shell syntax, and a cleangit diff --check.hsa_amd_signal_create_v2, paired library loading, and inode plusRTLD_NOLOADidentity through all original versioned filenames.The inline source builder and complete native/OOT/SGLang images were not rebuilt in this validation. No GPU APIs or GPU workloads were run for these checks.