[AMD] Fix the hipDeviceGetName issue in ROCm based docker images (#19440)

Co-authored-by: bingxche <Bingxu.Chen@amd.com>
This commit is contained in:
Hubert Lu
2026-03-03 11:42:48 -08:00
committed by GitHub
parent 85f7a0aa30
commit 05f68e1230

View File

@@ -105,6 +105,33 @@ ARG AINIC_VERSION=1.117.5
ARG UBUNTU_CODENAME=jammy
USER root
# Fix hipDeviceGetName returning empty string in ROCm 7.0 docker images.
# The ROCm 7.0 base image is missing libdrm-amdgpu-common which provides the
# amdgpu.ids device-ID-to-marketing-name mapping file.
# ROCm 7.2 base images already ship these packages, so this step is skipped.
# See https://github.com/ROCm/ROCm/issues/5992
RUN set -eux; \
case "${GPU_ARCH}" in \
*rocm720*) \
echo "ROCm 7.2 (GPU_ARCH=${GPU_ARCH}): libdrm-amdgpu packages already present, skipping"; \
;; \
*) \
echo "ROCm 7.0 (GPU_ARCH=${GPU_ARCH}): installing libdrm-amdgpu packages"; \
curl -fsSL https://repo.radeon.com/rocm/rocm.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/amdgpu-graphics.gpg \
&& echo 'deb [arch=amd64,i386 signed-by=/etc/apt/keyrings/amdgpu-graphics.gpg] https://repo.radeon.com/graphics/7.0/ubuntu jammy main' \
> /etc/apt/sources.list.d/amdgpu-graphics.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libdrm-amdgpu-common \
libdrm-amdgpu-amdgpu1 \
libdrm2-amdgpu \
&& rm -rf /var/lib/apt/lists/* \
&& cp /opt/amdgpu/share/libdrm/amdgpu.ids /usr/share/libdrm/amdgpu.ids; \
;; \
esac
# Install some basic utilities
RUN python -m pip install --upgrade pip && pip install setuptools_scm
RUN apt-get purge -y sccache; python -m pip uninstall -y sccache; rm -f "$(which sccache)"