update build image version #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build HipBLAS ROCm 7.1 | |
| on: | |
| workflow_dispatch: # allows manual triggering | |
| inputs: | |
| create_release: | |
| description: "Create new release" | |
| required: false | |
| type: boolean | |
| default: false | |
| gpu_targets: | |
| description: "GPU Targets (comma separated)" | |
| required: false | |
| type: string | |
| default: "gfx1201,gfx1200,gfx1100,gfx1101,gfx1151" | |
| push: | |
| branches: | |
| - master | |
| - ci | |
| paths: | |
| [ | |
| ".github/workflows/build-hipblas-rocm71.yml", | |
| "**/CMakeLists.txt", | |
| "**/*.h", | |
| "**/*.hpp", | |
| "**/*.c", | |
| "**/*.cpp", | |
| "**/*.cu", | |
| ] | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| paths: | |
| [ | |
| ".github/workflows/build-hipblas-rocm71.yml", | |
| "**/CMakeLists.txt", | |
| "**/*.h", | |
| "**/*.hpp", | |
| "**/*.c", | |
| "**/*.cpp", | |
| "**/*.cu", | |
| ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| get-default-branch: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| branch: ${{ steps.branch.outputs.branch }} | |
| steps: | |
| - name: Get default branch | |
| id: branch | |
| run: echo "branch=${{ github.event.repository.default_branch || 'master' }}" >> $GITHUB_OUTPUT | |
| rocm71-hipblas-build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| gpu_target: [gfx1201, gfx1200, gfx1100, gfx1101, gfx1151] | |
| runs-on: ubuntu-24.04 | |
| needs: get-default-branch | |
| env: | |
| BRANCH_NAME: ${{ needs.get-default-branch.outputs.branch }} | |
| ROCM_VERSION: "7.1.0" | |
| # Individual GPU target for this build | |
| GPU_TARGET: ${{ matrix.gpu_target }} | |
| SD_DEFINES: -DSD_HIPBLAS=ON -DSD_BUILD_SHARED_LIBS=ON -DGGML_NATIVE=OFF | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup ROCm (Ubuntu) | |
| run: | | |
| # Install ROCm 7.1 | |
| sudo apt update | |
| sudo apt install -y wget gnupg | |
| # Add ROCm repository | |
| wget -qO - https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add - | |
| echo "deb [arch=amd64] https://repo.radeon.com/rocm/apt/7.1/ noble main" | sudo tee /etc/apt/sources.list.d/rocm.list | |
| sudo apt update | |
| sudo apt install -y \ | |
| rocm-dev \ | |
| hip-dev \ | |
| hipblas-dev \ | |
| rocblas-dev \ | |
| hipblaslt-dev \ | |
| cmake \ | |
| build-essential | |
| # Verify installation | |
| /opt/rocm/bin/rocminfo || true | |
| echo "ROCm_DIR=/opt/rocm" >> $GITHUB_ENV | |
| - name: Cache build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.ccache | |
| build | |
| key: ${{ runner.os }}-rocm71-${{ matrix.gpu_target }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cpp', '**/*.h') }} | |
| restore-keys: | | |
| ${{ runner.os }}-rocm71-${{ matrix.gpu_target }}- | |
| - name: Build with CMake | |
| run: | | |
| # Setup ccache | |
| sudo apt install -y ccache | |
| export PATH="/usr/lib/ccache:$PATH" | |
| mkdir -p build | |
| cd build | |
| echo "Building for GPU target: ${{ matrix.gpu_target }}" | |
| # Configure with ROCm 7.1 and specific GPU target | |
| cmake .. \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_C_COMPILER=/opt/rocm/bin/clang \ | |
| -DCMAKE_CXX_COMPILER=/opt/rocm/bin/clang++ \ | |
| -DCMAKE_PREFIX_PATH=/opt/rocm \ | |
| -DGPU_TARGETS="${{ env.GPU_TARGET }}" \ | |
| -DHIP_PLATFORM=amd \ | |
| ${{ env.SD_DEFINES }} | |
| # Build with all available cores | |
| cmake --build . --config Release --parallel $(nproc) | |
| - name: Test HipBLAS build | |
| run: | | |
| cd build | |
| # Test if hipblas libraries are linked correctly | |
| ldd bin/* 2>/dev/null | grep -i hip || echo "No direct HIP dependencies found" | |
| ldd bin/* 2>/dev/null | grep -i rocm || echo "No ROCm dependencies found" | |
| echo "Built binaries for GPU target ${{ matrix.gpu_target }}:" | |
| ls -la bin/ | |
| - name: Get commit hash | |
| id: commit | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' || github.event.inputs.create_release == 'true' }} | |
| run: | | |
| echo "short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
| - name: Package artifacts | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' || github.event.inputs.create_release == 'true' }} | |
| run: | | |
| cd build | |
| # Create package directory | |
| mkdir -p package/lib package/bin package/include | |
| # Copy binaries | |
| cp -r bin/* package/bin/ || echo "No binaries to copy" | |
| # Copy ROCm libraries if needed | |
| if [ -d "/opt/rocm/lib" ]; then | |
| cp /opt/rocm/lib/libhipblas.so* package/lib/ 2>/dev/null || echo "hipblas lib not found" | |
| cp /opt/rocm/lib/librocblas.so* package/lib/ 2>/dev/null || echo "rocblas lib not found" | |
| cp /opt/rocm/lib/libhipblaslt.so* package/lib/ 2>/dev/null || echo "hipblaslt lib not found" | |
| fi | |
| # Create archive with GPU target in filename | |
| tar -czf ../sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-linux-rocm71-${{ matrix.gpu_target }}-x64.tar.gz -C package . | |
| - name: Upload artifacts | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' || github.event.inputs.create_release == 'true' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-linux-rocm71-${{ matrix.gpu_target }}-x64 | |
| path: | | |
| sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-linux-rocm71-${{ matrix.gpu_target }}-x64.tar.gz | |
| retention-days: 7 | |
| - name: Create Release | |
| if: ${{ github.event.inputs.create_release == 'true' && github.ref == 'refs/heads/master' }} | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: rocm71-${{ matrix.gpu_target }}-${{ steps.commit.outputs.short }} | |
| name: ROCm 7.1 HipBLAS Build ${{ matrix.gpu_target }} ${{ steps.commit.outputs.short }} | |
| body: | | |
| ## ROCm 7.1 HipBLAS Build for ${{ matrix.gpu_target }} | |
| **GPU Target:** `${{ matrix.gpu_target }}` | |
| **Commit:** ${{ steps.commit.outputs.short }} | |
| Built with: | |
| - ROCm 7.1.0 | |
| - HipBLAS support | |
| - Optimized for GPU architecture: ${{ matrix.gpu_target }} | |
| ### Downloads | |
| - Linux: `sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-linux-rocm71-${{ matrix.gpu_target }}-x64.tar.gz` | |
| files: | | |
| sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-linux-rocm71-${{ matrix.gpu_target }}-x64.tar.gz | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |