@@ -635,16 +635,22 @@ jobs:
635635 sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
636636
637637 ubuntu-latest-rocm :
638- runs-on : ubuntu-latest
639- container : rocm/dev-ubuntu-24.04:7.2
638+ runs-on : ubuntu-24.04
640639
641640 env :
642- ROCM_VERSION : " 7.2"
643641 UBUNTU_VERSION : " 24.04"
644- GPU_TARGETS : " gfx1151;gfx1150;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201"
642+
643+ strategy :
644+ matrix :
645+ include :
646+ - ROCM_VERSION : " 7.2.1"
647+ gpu_targets : " gfx908;gfx90a;gfx942;gfx1030;gfx1031;gfx1032;gfx1100;gfx1101;gfx1102;gfx1151;gfx1150;gfx1200;gfx1201"
648+ build : ' x64'
649+ - ROCM_VERSION : " 7.12.0"
650+ gpu_targets : " gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201"
651+ build : x64
645652
646653 steps :
647- - run : apt-get update && apt-get install -y git
648654 - name : Clone
649655 id : checkout
650656 uses : actions/checkout@v6
@@ -661,6 +667,38 @@ jobs:
661667 with :
662668 version : 10.15.1
663669
670+ - name : ccache
671+ uses : ggml-org/ccache-action@v1.2.16
672+ with :
673+ key : ubuntu-rocm-cmake-${{ matrix.ROCM_VERSION }}-${{ matrix.build }}
674+ evict-old-files : 1d
675+
676+ - name : Dependencies
677+ id : depends
678+ run : |
679+ sudo apt install -y build-essential cmake wget zip ninja-build
680+
681+ - name : Setup Legacy ROCm
682+ if : matrix.ROCM_VERSION == '7.2.1'
683+ id : legacy_env
684+ run : |
685+ sudo mkdir --parents --mode=0755 /etc/apt/keyrings
686+ wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | \
687+ gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
688+
689+ sudo tee /etc/apt/sources.list.d/rocm.list << EOF
690+ deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/${{ matrix.ROCM_VERSION }} noble main
691+ EOF
692+
693+ sudo tee /etc/apt/preferences.d/rocm-pin-600 << EOF
694+ Package: *
695+ Pin: release o=repo.radeon.com
696+ Pin-Priority: 600
697+ EOF
698+
699+ sudo apt update
700+ sudo apt-get install -y libssl-dev rocm-hip-sdk
701+
664702 - name : Free disk space
665703 run : |
666704 # Remove preinstalled SDKs and caches not needed for this job
@@ -674,64 +712,30 @@ jobs:
674712 sudo rm -rf /var/lib/apt/lists/* || true
675713 sudo apt clean
676714
677- - name : Dependencies
678- id : depends
679- run : |
680- sudo apt-get update
681- sudo apt install -y \
682- cmake \
683- hip-dev \
684- hipblas-dev \
685- ninja-build \
686- rocm-dev \
687- zip
688- # Clean apt caches to recover disk space
689- sudo apt clean
690- sudo rm -rf /var/lib/apt/lists/* || true
691-
692- - name : Setup ROCm Environment
715+ - name : Setup TheRock
716+ if : matrix.ROCM_VERSION != '7.2.1'
717+ id : therock_env
693718 run : |
694- # Add ROCm to PATH for current session
695- echo "/opt/rocm/bin" >> $GITHUB_PATH
696-
697- # Build regex pattern from ${{ env.GPU_TARGETS }} (match target as substring)
698- TARGET_REGEX="($(printf '%s' "${{ env.GPU_TARGETS }}" | sed 's/;/|/g'))"
699-
700- # Remove library files for architectures we're not building for to save disk space
701- echo "Cleaning up unneeded architecture files..."
702- cd /opt/rocm/lib/rocblas/library
703- # Keep only our target architectures
704- for file in *; do
705- if printf '%s' "$file" | grep -q 'gfx'; then
706- if ! printf '%s' "$file" | grep -Eq "$TARGET_REGEX"; then
707- echo "Removing $file" &&
708- sudo rm -f "$file";
709- fi
710- fi
711- done
712-
713- cd /opt/rocm/lib/hipblaslt/library
714- for file in *; do
715- if printf '%s' "$file" | grep -q 'gfx'; then
716- if ! printf '%s' "$file" | grep -Eq "$TARGET_REGEX"; then
717- echo "Removing $file" &&
718- sudo rm -f "$file";
719- fi
720- fi
721- done
719+ wget https://repo.amd.com/rocm/tarball/therock-dist-linux-gfx1151-${{ matrix.ROCM_VERSION }}.tar.gz
720+ mkdir install
721+ tar -xf *.tar.gz -C install
722+ export ROCM_PATH=$(pwd)/install
723+ echo ROCM_PATH=$ROCM_PATH >> $GITHUB_ENV
724+ echo PATH=$PATH:$ROCM_PATH/bin >> $GITHUB_ENV
725+ echo LD_LIBRARY_PATH=$ROCM_PATH/lib:$ROCM_PATH/llvm/lib:$ROCM_PATH/lib/rocprofiler-systems >> $GITHUB_ENV
722726
723727 - name : Build
724728 id : cmake_build
725729 run : |
726730 mkdir build
727731 cd build
728732 cmake .. -G Ninja \
729- -DCMAKE_CXX_COMPILER=amdclang++ \
730- -DCMAKE_C_COMPILER=amdclang \
733+ -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
734+ -DCMAKE_HIP_FLAGS="-mllvm --amdgpu-unroll-threshold-local=600" \
731735 -DCMAKE_BUILD_TYPE=Release \
732736 -DSD_HIPBLAS=ON \
733- -DGPU_TARGETS="${{ env.GPU_TARGETS }}" \
734- -DAMDGPU_TARGETS ="${{ env.GPU_TARGETS }}" \
737+ -DHIP_PLATFORM=amd \
738+ -DGPU_TARGETS ="${{ matrix.gpu_targets }}" \
735739 -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
736740 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
737741 -DSD_BUILD_SHARED_LIBS=ON
@@ -750,16 +754,6 @@ jobs:
750754 cp ggml/LICENSE ./build/bin/ggml.txt
751755 cp LICENSE ./build/bin/stable-diffusion.cpp.txt
752756
753- # Move ROCm runtime libraries (to avoid double space consumption)
754- sudo mv /opt/rocm/lib/librocsparse.so* ./build/bin/
755- sudo mv /opt/rocm/lib/libhsa-runtime64.so* ./build/bin/
756- sudo mv /opt/rocm/lib/libamdhip64.so* ./build/bin/
757- sudo mv /opt/rocm/lib/libhipblas.so* ./build/bin/
758- sudo mv /opt/rocm/lib/libhipblaslt.so* ./build/bin/
759- sudo mv /opt/rocm/lib/librocblas.so* ./build/bin/
760- sudo mv /opt/rocm/lib/rocblas/ ./build/bin/
761- sudo mv /opt/rocm/lib/hipblaslt/ ./build/bin/
762-
763757 - name : Fetch system info
764758 id : system-info
765759 run : |
@@ -774,15 +768,15 @@ jobs:
774768 run : |
775769 cp ggml/LICENSE ./build/bin/ggml.txt
776770 cp LICENSE ./build/bin/stable-diffusion.cpp.txt
777- 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
771+ 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
778772
779773 - name : Upload artifacts
780774 if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
781775 uses : actions/upload-artifact@v4
782776 with :
783- 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
777+ 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
784778 path : |
785- 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
779+ 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
786780
787781 release :
788782 if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
0 commit comments