diff --git a/docker/rocm.Dockerfile b/docker/rocm.Dockerfile index 11df166a9..21f8352a4 100644 --- a/docker/rocm.Dockerfile +++ b/docker/rocm.Dockerfile @@ -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)"