From 26343489091158302e6b2fe26006f74d6bcae0ac Mon Sep 17 00:00:00 2001 From: Indrek Mandre Date: Sun, 28 Jan 2024 02:23:02 +0200 Subject: [PATCH] docker/rocm: do not set HSA_OVERRIDE_GFX_VERSION at all for the general version as the empty value broke rocm --- docker/rocm/Dockerfile | 14 ++++++++++---- docker/rocm/rocm.hcl | 6 +++++- docker/rocm/rocm.mk | 12 ++++++------ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docker/rocm/Dockerfile b/docker/rocm/Dockerfile index 68e207b8c..d0d4bd2fa 100644 --- a/docker/rocm/Dockerfile +++ b/docker/rocm/Dockerfile @@ -5,6 +5,7 @@ ARG DEBIAN_FRONTEND=noninteractive ARG ROCM=5.7.3 ARG AMDGPU=gfx900 ARG HSA_OVERRIDE_GFX_VERSION +ARG HSA_OVERRIDE ####################################################################### FROM ubuntu:focal as rocm @@ -50,7 +51,7 @@ COPY docker/rocm/migraphx . RUN mkdir build && cd build && cmake .. && make install ####################################################################### -FROM deps AS rocm-prelim +FROM deps AS deps-prelim # need this to install libnuma1 RUN apt-get update @@ -79,14 +80,12 @@ ADD --chmod=0644 https://github.com/harakas/models/raw/main/ultralytics/yolov8.1 ADD --chmod=0644 https://github.com/harakas/models/raw/main/ultralytics/yolov8.1/yolov8s-oiv7_labels-frigate.txt / ####################################################################### -FROM rocm-prelim AS rocm-deps +FROM deps-prelim AS rocm-prelim-hsa-override0 ARG ROCM ARG AMDGPU -ARG HSA_OVERRIDE_GFX_VERSION ENV HSA_ENABLE_SDMA=0 -ENV HSA_OVERRIDE_GFX_VERSION=$HSA_OVERRIDE_GFX_VERSION RUN mkdir -p /opt/rocm-$ROCM @@ -101,3 +100,10 @@ COPY --from=debian-build /opt/rocm/lib/migraphx.cpython-39-x86_64-linux-gnu.so / RUN ln -s /opt/rocm-$ROCM /opt/rocm +FROM rocm-prelim-hsa-override0 as rocm-prelim-hsa-override1 + +ARG HSA_OVERRIDE_GFX_VERSION +ENV HSA_OVERRIDE_GFX_VERSION=$HSA_OVERRIDE_GFX_VERSION + +FROM rocm-prelim-hsa-override$HSA_OVERRIDE as rocm-deps + diff --git a/docker/rocm/rocm.hcl b/docker/rocm/rocm.hcl index afeca5061..33a2d2323 100644 --- a/docker/rocm/rocm.hcl +++ b/docker/rocm/rocm.hcl @@ -7,6 +7,9 @@ variable "ROCM" { variable "HSA_OVERRIDE_GFX_VERSION" { default = "" } +variable "HSA_OVERRIDE" { + default = "1" +} target deps { dockerfile = "docker/main/Dockerfile" platforms = ["linux/amd64"] @@ -29,6 +32,7 @@ target rocm { args = { AMDGPU = AMDGPU, ROCM = ROCM, - HSA_OVERRIDE_GFX_VERSION = HSA_OVERRIDE_GFX_VERSION + HSA_OVERRIDE_GFX_VERSION = HSA_OVERRIDE_GFX_VERSION, + HSA_OVERRIDE = HSA_OVERRIDE } } diff --git a/docker/rocm/rocm.mk b/docker/rocm/rocm.mk index c657a56f9..9bd9d96c8 100644 --- a/docker/rocm/rocm.mk +++ b/docker/rocm/rocm.mk @@ -4,14 +4,14 @@ BOARDS += rocm ROCM_CHIPSETS:=gfx900:9.0.0 gfx1030:10.3.0 local-rocm: version - $(foreach chipset,$(ROCM_CHIPSETS),AMDGPU=$(word 1,$(subst :, ,$(chipset))) HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) docker buildx bake --load --file=docker/rocm/rocm.hcl --set rocm.tags=frigate:latest-rocm-$(word 1,$(subst :, ,$(chipset))) rocm;) - AMDGPU=gfx docker buildx bake --load --file=docker/rocm/rocm.hcl --set rocm.tags=frigate:latest-rocm rocm + $(foreach chipset,$(ROCM_CHIPSETS),AMDGPU=$(word 1,$(subst :, ,$(chipset))) HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) HSA_OVERRIDE=1 docker buildx bake --load --file=docker/rocm/rocm.hcl --set rocm.tags=frigate:latest-rocm-$(word 1,$(subst :, ,$(chipset))) rocm;) + unset HSA_OVERRIDE_GFX_VERSION && HSA_OVERRIDE=0 AMDGPU=gfx docker buildx bake --load --file=docker/rocm/rocm.hcl --set rocm.tags=frigate:latest-rocm rocm build-rocm: version - $(foreach chipset,$(ROCM_CHIPSETS),AMDGPU=$(chipset) docker buildx bake --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm-$(chipset) rocm;) - AMDGPU=gfx docker buildx bake --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm rocm + $(foreach chipset,$(ROCM_CHIPSETS),AMDGPU=$(word 1,$(subst :, ,$(chipset))) HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) HSA_OVERRIDE=1 docker buildx bake --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm-$(chipset) rocm;) + unset HSA_OVERRIDE_GFX_VERSION && HSA_OVERRIDE=0 AMDGPU=gfx docker buildx bake --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm rocm push-rocm: build-rocm - $(foreach chipset,$(ROCM_CHIPSETS),AMDGPU=$(chipset) docker buildx bake --push --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm-$(chipset) rocm;) - AMDGPU=gfx docker buildx bake --push --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm rocm + $(foreach chipset,$(ROCM_CHIPSETS),AMDGPU=$(word 1,$(subst :, ,$(chipset))) HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) HSA_OVERRIDE=1 docker buildx bake --push --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm-$(chipset) rocm;) + unset HSA_OVERRIDE_GFX_VERSION && HSA_OVERRIDE=0 AMDGPU=gfx docker buildx bake --push --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm rocm