@@ -486,93 +486,84 @@ jobs:
486486 sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
487487
488488 ubuntu-latest-rocm :
489- runs-on : ubuntu-latest
490- container : rocm/dev-ubuntu-24.04:7.2
489+ runs-on : ubuntu-24.04
491490
492491 env :
493- ROCM_VERSION : " 7.2"
494492 UBUNTU_VERSION : " 24.04"
495- GPU_TARGETS : " gfx1151;gfx1150;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201"
493+
494+ strategy :
495+ matrix :
496+ include :
497+ - ROCM_VERSION : " 7.2"
498+ gpu_targets : " gfx908;gfx90a;gfx942;gfx1030;gfx1031;gfx1032;gfx1100;gfx1101;gfx1102;gfx1151;gfx1150;gfx1200;gfx1201"
499+ build : ' x64'
500+ - ROCM_VERSION : " 7.11.0"
501+ gpu_targets : " gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201"
502+ build : x64
496503
497504 steps :
498- - run : apt-get update && apt-get install -y git
499505 - name : Clone
500506 id : checkout
501507 uses : actions/checkout@v6
502508 with :
503509 submodules : recursive
504510
505- - name : Free disk space
506- run : |
507- # Remove preinstalled SDKs and caches not needed for this job
508- sudo rm -rf /usr/share/dotnet || true
509- sudo rm -rf /usr/local/lib/android || true
510- sudo rm -rf /opt/ghc || true
511- sudo rm -rf /usr/local/.ghcup || true
512- sudo rm -rf /opt/hostedtoolcache || true
513-
514- # Remove old package lists and caches
515- sudo rm -rf /var/lib/apt/lists/* || true
516- sudo apt clean
511+ - name : ccache
512+ uses : ggml-org/ccache-action@v1.2.16
513+ with :
514+ key : ubuntu-rocm-cmake-${{ matrix.ROCM_VERSION }}-${{ matrix.build }}
515+ evict-old-files : 1d
517516
518517 - name : Dependencies
519518 id : depends
520519 run : |
521- sudo apt-get update
522- sudo apt install -y \
523- cmake \
524- hip-dev \
525- hipblas-dev \
526- ninja-build \
527- rocm-dev \
528- zip
529- # Clean apt caches to recover disk space
530- sudo apt clean
531- sudo rm -rf /var/lib/apt/lists/* || true
532-
533- - name : Setup ROCm Environment
520+ sudo apt install -y build-essential cmake wget zip ninja-build
521+
522+ - name : Setup Legacy ROCm
523+ if : matrix.ROCM_VERSION == '7.2'
524+ id : legacy_env
525+ run : |
526+ sudo mkdir --parents --mode=0755 /etc/apt/keyrings
527+ wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | \
528+ gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
529+
530+ sudo tee /etc/apt/sources.list.d/rocm.list << EOF
531+ deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/${{ matrix.ROCM_VERSION }} noble main
532+ EOF
533+
534+ sudo tee /etc/apt/preferences.d/rocm-pin-600 << EOF
535+ Package: *
536+ Pin: release o=repo.radeon.com
537+ Pin-Priority: 600
538+ EOF
539+
540+ sudo apt update
541+ sudo apt-get install -y libssl-dev rocm-hip-sdk
542+
543+ - name : Setup TheRock
544+ if : matrix.ROCM_VERSION != '7.2'
545+ id : therock_env
534546 run : |
535- # Add ROCm to PATH for current session
536- echo "/opt/rocm/bin" >> $GITHUB_PATH
537-
538- # Build regex pattern from ${{ env.GPU_TARGETS }} (match target as substring)
539- TARGET_REGEX="($(printf '%s' "${{ env.GPU_TARGETS }}" | sed 's/;/|/g'))"
540-
541- # Remove library files for architectures we're not building for to save disk space
542- echo "Cleaning up unneeded architecture files..."
543- cd /opt/rocm/lib/rocblas/library
544- # Keep only our target architectures
545- for file in *; do
546- if printf '%s' "$file" | grep -q 'gfx'; then
547- if ! printf '%s' "$file" | grep -Eq "$TARGET_REGEX"; then
548- echo "Removing $file" &&
549- sudo rm -f "$file";
550- fi
551- fi
552- done
553-
554- cd /opt/rocm/lib/hipblaslt/library
555- for file in *; do
556- if printf '%s' "$file" | grep -q 'gfx'; then
557- if ! printf '%s' "$file" | grep -Eq "$TARGET_REGEX"; then
558- echo "Removing $file" &&
559- sudo rm -f "$file";
560- fi
561- fi
562- done
547+ wget https://repo.amd.com/rocm/tarball/therock-dist-linux-gfx1151-${{ matrix.ROCM_VERSION }}.tar.gz
548+ mkdir install
549+ tar -xf *.tar.gz -C install
550+ export ROCM_PATH=$(pwd)/install
551+ echo ROCM_PATH=$ROCM_PATH >> $GITHUB_ENV
552+ echo PATH=$PATH:$ROCM_PATH/bin >> $GITHUB_ENV
553+ echo LD_LIBRARY_PATH=$ROCM_PATH/lib:$ROCM_PATH/llvm/lib:$ROCM_PATH/lib/rocprofiler-systems >> $GITHUB_ENV
563554
564555 - name : Build
565556 id : cmake_build
566557 run : |
567558 mkdir build
568559 cd build
569560 cmake .. -G Ninja \
570- -DCMAKE_CXX_COMPILER=amdclang++ \
571- -DCMAKE_C_COMPILER=amdclang \
561+ -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
562+ -DCMAKE_HIP_FLAGS="-mllvm --amdgpu-unroll-threshold-local=600" \
572563 -DCMAKE_BUILD_TYPE=Release \
573564 -DSD_HIPBLAS=ON \
574- -DGPU_TARGETS="${{ env.GPU_TARGETS }}" \
575- -DAMDGPU_TARGETS ="${{ env.GPU_TARGETS }}" \
565+ -DHIP_PLATFORM=amd \
566+ -DGPU_TARGETS ="${{ matrix.gpu_targets }}" \
576567 -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
577568 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
578569 -DSD_BUILD_SHARED_LIBS=ON
@@ -591,16 +582,6 @@ jobs:
591582 cp ggml/LICENSE ./build/bin/ggml.txt
592583 cp LICENSE ./build/bin/stable-diffusion.cpp.txt
593584
594- # Move ROCm runtime libraries (to avoid double space consumption)
595- sudo mv /opt/rocm/lib/librocsparse.so* ./build/bin/
596- sudo mv /opt/rocm/lib/libhsa-runtime64.so* ./build/bin/
597- sudo mv /opt/rocm/lib/libamdhip64.so* ./build/bin/
598- sudo mv /opt/rocm/lib/libhipblas.so* ./build/bin/
599- sudo mv /opt/rocm/lib/libhipblaslt.so* ./build/bin/
600- sudo mv /opt/rocm/lib/librocblas.so* ./build/bin/
601- sudo mv /opt/rocm/lib/rocblas/ ./build/bin/
602- sudo mv /opt/rocm/lib/hipblaslt/ ./build/bin/
603-
604585 - name : Fetch system info
605586 id : system-info
606587 run : |
@@ -615,15 +596,15 @@ jobs:
615596 run : |
616597 cp ggml/LICENSE ./build/bin/ggml.txt
617598 cp LICENSE ./build/bin/stable-diffusion.cpp.txt
618- zip -y -r sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-Ubuntu-${{ env.UBUNTU_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-rocm.zip ./build/bin
599+ zip -y -r sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-Ubuntu-${{ env.UBUNTU_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-rocm-${{ matrix.ROCM_VERSION }} .zip ./build/bin
619600
620601 - name : Upload artifacts
621602 if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
622603 uses : actions/upload-artifact@v4
623604 with :
624- name : sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-Ubuntu-${{ env.UBUNTU_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-rocm.zip
605+ name : sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-Ubuntu-${{ env.UBUNTU_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-rocm-${{ matrix.ROCM_VERSION }} .zip
625606 path : |
626- sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-Ubuntu-${{ env.UBUNTU_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-rocm.zip
607+ sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-Ubuntu-${{ env.UBUNTU_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-rocm-${{ matrix.ROCM_VERSION }} .zip
627608
628609 release :
629610 if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
0 commit comments