Skip to content

Fix ROCm EP build for gfx1152, add Docker build recipe - #1

Open
zetyquickly wants to merge 1 commit into
v1.22.2-basefrom
rocm-gfx1152-fix
Open

Fix ROCm EP build for gfx1152, add Docker build recipe#1
zetyquickly wants to merge 1 commit into
v1.22.2-basefrom
rocm-gfx1152-fix

Conversation

@zetyquickly

Copy link
Copy Markdown
Owner

Summary

  • Fixes GPU_WARP_SIZE in onnxruntime/core/providers/rocm/cu_inc/common.cuh: constexpr int GPU_WARP_SIZE = warpSize; doesn't compile on this ROCm's bundled clang (23.0.0git) on either the host or device pass of this dual-compiled header — warpSize's host-visible form has a non-constexpr operator int(). Device pass now derives the value from __AMDGCN_CUMODE__ (0 = WGP/wave32 for RDNA chips like gfx1152, 1 = CU/wave64 for CDNA/GCN); host pass uses a fixed literal, since that value is never used for actual kernel execution there — genuinely dynamic runtime code already uses GPU_WARP_SIZE_HOST a few lines below.
  • Adds a missing #include <cstdint> to optimizer_api.h (this GCC's libstdc++ dropped an implicit transitive include the file relied on).
  • Adds docker/gfx1152/: a Dockerfile (ROCm 7.14 + full build toolchain on ubuntu:26.04) and a README with the full build recipe, why this is based on the v1.22.2 tag rather than main (ROCm EP was deleted from main in microsoft#25181 — no active development, Microsoft's stated direction is the MIGraphX EP instead), the two build flags needed to route around unrelated dead ends (onnxruntime_USE_COMPOSABLE_KERNEL=OFF, --disable_contrib_ops), and every environment gotcha hit along the way.

This branch has no realistic merge target upstream (main no longer has this code at all), so this base branch (v1.22.2-base, pointing at the v1.22.2 tag) exists purely so this PR's diff shows only the actual changes instead of the full divergence between v1.22.2 and main.

Test plan

  • Built the wheel end-to-end inside the Docker recipe in docker/gfx1152/
  • Installed the resulting wheel and ran Docling's ONNX-backed layout model (RT-DETR) through ROCMExecutionProvider on a real AMD Ryzen AI 7 PRO 350 (Radeon 860M, gfx1152) GPU — correct output, no crash

🤖 Generated with Claude Code

GPU_WARP_SIZE (onnxruntime/core/providers/rocm/cu_inc/common.cuh):
`constexpr int GPU_WARP_SIZE = warpSize;` fails to compile on this ROCm's
bundled clang (23.0.0git) on both the host and device compilation passes
of this dual-compiled header -- warpSize's host-visible form has a
non-constexpr operator int(). Device pass now derives the value from
__AMDGCN_CUMODE__ (0 = WGP/wave32 for RDNA chips like gfx1152, 1 = CU/
wave64 for CDNA/GCN); host pass uses a fixed literal, since that value is
never used for actual kernel execution there -- genuinely dynamic runtime
code already uses GPU_WARP_SIZE_HOST a few lines below.

optimizer_api.h: adds a missing `#include <cstdint>` -- this GCC's
libstdc++ dropped an implicit transitive include the file relied on.

docker/gfx1152/: a Dockerfile (ROCm 7.14 + full build toolchain on
ubuntu:26.04, matching this chip's actual ROCm install) plus a README
documenting the full build recipe, why this branch targets the v1.22.2
tag rather than main (ROCm EP was deleted from main in PR microsoft#25181, no
active development, Microsoft's stated direction is the MIGraphX EP
instead), the two build flags needed to route around unrelated dead ends
(onnxruntime_USE_COMPOSABLE_KERNEL=OFF, --disable_contrib_ops), and every
environment gotcha hit along the way (cert ordering, missing -dev
packages, a dangling Python symlink across a bind mount, wheel Python-tag
mismatches, missing setuptools in the build venv).

Verified end-to-end: installed the resulting wheel and ran Docling's
ONNX-backed layout model (RT-DETR) through ROCMExecutionProvider on a
real AMD Ryzen AI 7 PRO 350 (Radeon 860M, gfx1152) GPU -- correct output,
no crash.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant