Skip to content

Commit f86c8cf

Browse files
committed
Add a Windows ROCm job to use tarball distribution of TheRock
This builds from ROCm release tarballs. In order to use it you must have ROCm installed in the operating system first. - Update GPU_TARGETS to match Linux job (7.11.0 targets) - Cache DLL's from extracted tarball directory instead of installer directory - Align Windows and Linux ROCm build configurations Also; rename the legacy ROCm task to clarify which artifacts come from which release.
1 parent 87ecb95 commit f86c8cf

1 file changed

Lines changed: 90 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,97 @@ jobs:
440440
path: |
441441
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
442442
443+
windows-latest-rocm:
444+
runs-on: windows-2022
445+
446+
env:
447+
ROCM_VERSION: "7.12.0"
448+
GPU_TARGETS: "gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201"
449+
450+
steps:
451+
- uses: actions/checkout@v3
452+
with:
453+
submodules: recursive
454+
455+
- name: Cache ROCm Installation
456+
id: cache-rocm
457+
uses: actions/cache@v4
458+
with:
459+
path: C:\TheRock\build
460+
key: rocm-${{ env.ROCM_VERSION }}-gfx1151-${{ runner.os }}
461+
462+
- name: ccache
463+
uses: ggml-org/ccache-action@v1.2.16
464+
with:
465+
key: windows-latest-rocm-${{ env.ROCM_VERSION }}-x64
466+
evict-old-files: 1d
467+
468+
- name: Install ROCm
469+
if: steps.cache-rocm.outputs.cache-hit != 'true'
470+
run: |
471+
$ErrorActionPreference = "Stop"
472+
write-host "Downloading AMD ROCm ${{ env.ROCM_VERSION }} tarball"
473+
Invoke-WebRequest -Uri "https://repo.amd.com/rocm/tarball/therock-dist-windows-gfx1151-${{ env.ROCM_VERSION }}.tar.gz" -OutFile "${env:RUNNER_TEMP}\rocm.tar.gz"
474+
write-host "Extracting ROCm tarball"
475+
mkdir C:\TheRock\build -Force
476+
tar -xzf "${env:RUNNER_TEMP}\rocm.tar.gz" -C C:\TheRock\build --strip-components=1
477+
write-host "Completed ROCm extraction"
478+
479+
- name: Setup ROCm Environment
480+
run: |
481+
$rocmPath = "C:\TheRock\build"
482+
echo "HIP_PATH=$rocmPath" >> $env:GITHUB_ENV
483+
echo "HIP_DEVICE_LIB_PATH=$rocmPath\lib\llvm\amdgcn\bitcode" >> $env:GITHUB_ENV
484+
echo "HIP_PLATFORM=amd" >> $env:GITHUB_ENV
485+
echo "LLVM_PATH=$rocmPath\lib\llvm" >> $env:GITHUB_ENV
486+
echo "$rocmPath\bin" >> $env:GITHUB_PATH
487+
echo "$rocmPath\lib\llvm\bin" >> $env:GITHUB_PATH
488+
489+
- name: Build
490+
run: |
491+
mkdir build
492+
cd build
493+
cmake .. `
494+
-G "Unix Makefiles" `
495+
-DCMAKE_PREFIX_PATH="${env:HIP_PATH}" `
496+
-DSD_HIPBLAS=ON `
497+
-DSD_BUILD_SHARED_LIBS=ON `
498+
-DGGML_NATIVE=OFF `
499+
-DCMAKE_C_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
500+
-DCMAKE_CXX_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang++.exe" `
501+
-DCMAKE_HIP_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
502+
-DHIP_PATH="${env:HIP_PATH}" `
503+
-DCMAKE_BUILD_TYPE=Release `
504+
-DGPU_TARGETS="${{ env.GPU_TARGETS }}"
505+
cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS}
506+
507+
- name: Get commit hash
508+
id: commit
509+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
510+
uses: pr-mpt/actions-commit-hash@v2
511+
512+
- name: Pack artifacts
513+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
514+
run: |
515+
cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
516+
cp "${env:HIP_PATH}\bin\libhipblaslt.dll" "build\bin\"
517+
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
518+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
519+
520+
- name: Upload artifacts
521+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
522+
uses: actions/upload-artifact@v4
523+
with:
524+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
525+
path: |
526+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
527+
443528
windows-latest-cmake-hip:
444529
runs-on: windows-2022
445530

446531
env:
447532
HIPSDK_INSTALLER_VERSION: "25.Q3"
533+
ROCM_VERSION: "6.4.2"
448534
GPU_TARGETS: "gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"
449535

450536
steps:
@@ -538,15 +624,15 @@ jobs:
538624
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
539625
cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
540626
cp "${env:HIP_PATH}\bin\hipblaslt\library\*" "build\bin\hipblaslt\library\"
541-
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip .\build\bin\*
627+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
542628
543629
- name: Upload artifacts
544630
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
545631
uses: actions/upload-artifact@v4
546632
with:
547-
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
633+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
548634
path: |
549-
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
635+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
550636
551637
ubuntu-latest-rocm:
552638
runs-on: ubuntu-latest
@@ -711,6 +797,7 @@ jobs:
711797
- macOS-latest-cmake
712798
- windows-latest-cmake
713799
- windows-latest-cmake-hip
800+
- windows-latest-rocm
714801

715802
steps:
716803
- name: Clone

0 commit comments

Comments
 (0)