Skip to content

Commit 4550d62

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 636d3cb commit 4550d62

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
@@ -387,11 +387,97 @@ jobs:
387387
path: |
388388
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
389389
390+
windows-latest-rocm:
391+
runs-on: windows-2022
392+
393+
env:
394+
ROCM_VERSION: "7.11.0"
395+
GPU_TARGETS: "gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201"
396+
397+
steps:
398+
- uses: actions/checkout@v3
399+
with:
400+
submodules: recursive
401+
402+
- name: Cache ROCm Installation
403+
id: cache-rocm
404+
uses: actions/cache@v4
405+
with:
406+
path: C:\TheRock\build
407+
key: rocm-${{ env.ROCM_VERSION }}-gfx1151-${{ runner.os }}
408+
409+
- name: ccache
410+
uses: ggml-org/ccache-action@v1.2.16
411+
with:
412+
key: windows-latest-rocm-${{ env.ROCM_VERSION }}-x64
413+
evict-old-files: 1d
414+
415+
- name: Install ROCm
416+
if: steps.cache-rocm.outputs.cache-hit != 'true'
417+
run: |
418+
$ErrorActionPreference = "Stop"
419+
write-host "Downloading AMD ROCm ${{ env.ROCM_VERSION }} tarball"
420+
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"
421+
write-host "Extracting ROCm tarball"
422+
mkdir C:\TheRock\build -Force
423+
tar -xzf "${env:RUNNER_TEMP}\rocm.tar.gz" -C C:\TheRock\build --strip-components=1
424+
write-host "Completed ROCm extraction"
425+
426+
- name: Setup ROCm Environment
427+
run: |
428+
$rocmPath = "C:\TheRock\build"
429+
echo "HIP_PATH=$rocmPath" >> $env:GITHUB_ENV
430+
echo "HIP_DEVICE_LIB_PATH=$rocmPath\lib\llvm\amdgcn\bitcode" >> $env:GITHUB_ENV
431+
echo "HIP_PLATFORM=amd" >> $env:GITHUB_ENV
432+
echo "LLVM_PATH=$rocmPath\lib\llvm" >> $env:GITHUB_ENV
433+
echo "$rocmPath\bin" >> $env:GITHUB_PATH
434+
echo "$rocmPath\lib\llvm\bin" >> $env:GITHUB_PATH
435+
436+
- name: Build
437+
run: |
438+
mkdir build
439+
cd build
440+
cmake .. `
441+
-G "Unix Makefiles" `
442+
-DCMAKE_PREFIX_PATH="${env:HIP_PATH}" `
443+
-DSD_HIPBLAS=ON `
444+
-DSD_BUILD_SHARED_LIBS=ON `
445+
-DGGML_NATIVE=OFF `
446+
-DCMAKE_C_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
447+
-DCMAKE_CXX_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang++.exe" `
448+
-DCMAKE_HIP_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
449+
-DHIP_PATH="${env:HIP_PATH}" `
450+
-DCMAKE_BUILD_TYPE=Release `
451+
-DGPU_TARGETS="${{ env.GPU_TARGETS }}"
452+
cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS}
453+
454+
- name: Get commit hash
455+
id: commit
456+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
457+
uses: pr-mpt/actions-commit-hash@v2
458+
459+
- name: Pack artifacts
460+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
461+
run: |
462+
cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
463+
cp "${env:HIP_PATH}\bin\libhipblaslt.dll" "build\bin\"
464+
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
465+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
466+
467+
- name: Upload artifacts
468+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
469+
uses: actions/upload-artifact@v4
470+
with:
471+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
472+
path: |
473+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
474+
390475
windows-latest-cmake-hip:
391476
runs-on: windows-2022
392477

393478
env:
394479
HIPSDK_INSTALLER_VERSION: "25.Q3"
480+
ROCM_VERSION: "6.4.2"
395481
GPU_TARGETS: "gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"
396482

397483
steps:
@@ -475,15 +561,15 @@ jobs:
475561
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
476562
cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
477563
cp "${env:HIP_PATH}\bin\hipblaslt\library\*" "build\bin\hipblaslt\library\"
478-
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip .\build\bin\*
564+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
479565
480566
- name: Upload artifacts
481567
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
482568
uses: actions/upload-artifact@v4
483569
with:
484-
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
570+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
485571
path: |
486-
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
572+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
487573
488574
ubuntu-latest-rocm:
489575
runs-on: ubuntu-latest
@@ -638,6 +724,7 @@ jobs:
638724
- macOS-latest-cmake
639725
- windows-latest-cmake
640726
- windows-latest-cmake-hip
727+
- windows-latest-rocm
641728

642729
steps:
643730
- name: Clone

0 commit comments

Comments
 (0)