ci : bundle HIP runtime DLLs with Windows ROCm release (#26973)
Copy amdhip64_7, amd_comgr and rocm_kpack next to the binaries so the correct HIP runtime loads over the driver's copy in System32. Fixes #26929.
This commit is contained in:
@@ -742,6 +742,10 @@ jobs:
|
|||||||
name: llama-ui.zip
|
name: llama-ui.zip
|
||||||
path: tools/ui/dist
|
path: tools/ui/dist
|
||||||
|
|
||||||
|
- name: Install Ninja
|
||||||
|
run: |
|
||||||
|
choco install ninja
|
||||||
|
|
||||||
- name: ccache
|
- name: ccache
|
||||||
uses: ggml-org/ccache-action@v1.2.21
|
uses: ggml-org/ccache-action@v1.2.21
|
||||||
with:
|
with:
|
||||||
@@ -795,12 +799,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
cmake -S . -B build `
|
||||||
cd build
|
-G "Ninja Multi-Config" `
|
||||||
cmake .. `
|
|
||||||
-G "Unix Makefiles" `
|
|
||||||
-DCMAKE_PREFIX_PATH="${env:HIP_PATH}" `
|
-DCMAKE_PREFIX_PATH="${env:HIP_PATH}" `
|
||||||
-DCMAKE_BUILD_TYPE=Release `
|
|
||||||
-DGGML_BACKEND_DL=ON `
|
-DGGML_BACKEND_DL=ON `
|
||||||
-DGGML_NATIVE=OFF `
|
-DGGML_NATIVE=OFF `
|
||||||
-DGGML_CPU=ON `
|
-DGGML_CPU=ON `
|
||||||
@@ -813,15 +814,15 @@ jobs:
|
|||||||
-DHIP_PATH="${env:HIP_PATH}" `
|
-DHIP_PATH="${env:HIP_PATH}" `
|
||||||
-DGGML_HIP_ROCWMMA_FATTN=ON `
|
-DGGML_HIP_ROCWMMA_FATTN=ON `
|
||||||
-DAMDGPU_TARGETS="${{ matrix.gpu_targets }}"
|
-DAMDGPU_TARGETS="${{ matrix.gpu_targets }}"
|
||||||
cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS}
|
cmake --build build --config Release --parallel ${env:NUMBER_OF_PROCESSORS}
|
||||||
|
|
||||||
- name: Verify HIP backend was built
|
- name: Verify HIP backend was built
|
||||||
run: |
|
run: |
|
||||||
$hipDll = Get-ChildItem -Path build\bin -Filter "ggml-hip*.dll" -ErrorAction SilentlyContinue
|
$hipDll = Get-ChildItem -Path build\bin\Release -Filter "ggml-hip*.dll" -ErrorAction SilentlyContinue
|
||||||
if (-not $hipDll) {
|
if (-not $hipDll) {
|
||||||
Write-Host "##[error]ggml-hip*.dll was NOT produced. The HIP backend silently failed to build."
|
Write-Host "##[error]ggml-hip*.dll was NOT produced. The HIP backend silently failed to build."
|
||||||
Write-Host "Contents of build\bin:"
|
Write-Host "Contents of build\bin\Release:"
|
||||||
Get-ChildItem build\bin | Format-Table -AutoSize
|
Get-ChildItem build\bin\Release | Format-Table -AutoSize
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
Write-Host "HIP backend artifact found:"
|
Write-Host "HIP backend artifact found:"
|
||||||
@@ -836,10 +837,37 @@ jobs:
|
|||||||
$rocmVersionShort = ('${{ matrix.ROCM_VERSION }}'.Split('.')[0..1] -join '.')
|
$rocmVersionShort = ('${{ matrix.ROCM_VERSION }}'.Split('.')[0..1] -join '.')
|
||||||
echo "ROCM_VERSION_SHORT=$rocmVersionShort" >> $env:GITHUB_ENV
|
echo "ROCM_VERSION_SHORT=$rocmVersionShort" >> $env:GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Bundle HIP runtime DLLs (amdhip64_7.dll, rocm_kpack.dll, amd_comgr.dll)
|
||||||
|
run: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
# See issue https://github.com/ggml-org/llama.cpp/issues/26929.
|
||||||
|
# ggml-hip.dll loads amdhip64_7.dll at run time. The Adrenalin driver
|
||||||
|
# ships an amdhip64_7.dll in System32, which the loader searches before PATH,
|
||||||
|
# so a matching DLL from PATH cannot win. Copy amdhip64 next to the
|
||||||
|
# binaries (exe directory is searched before System32) so the correct
|
||||||
|
# runtime is used. rocm_kpack.dll is amdhip64_7's direct dependency, so
|
||||||
|
# copy the matching version too. amd_comgr is copied as well to keep it
|
||||||
|
# in sync with the bundled amdhip64, avoiding a version mismatch with a
|
||||||
|
# amd_comgr from System32.
|
||||||
|
# rocblas/hipblaslt kernels resolve fine via PATH and are not copied.
|
||||||
|
$binPath = (rocm-sdk path --bin).Trim()
|
||||||
|
if (-not $binPath) { throw "rocm-sdk path --bin returned empty" }
|
||||||
|
write-host "ROCm bin path: $binPath"
|
||||||
|
|
||||||
|
$patterns = @("amdhip64_7.dll", "rocm_kpack.dll", "amd_comgr.dll")
|
||||||
|
foreach ($pattern in $patterns) {
|
||||||
|
$files = Get-ChildItem -Path $binPath -Filter $pattern -ErrorAction SilentlyContinue
|
||||||
|
if (-not $files) { throw "no match for $pattern in $binPath" }
|
||||||
|
foreach ($f in $files) {
|
||||||
|
Copy-Item $f.FullName -Destination build\bin\Release -Force
|
||||||
|
write-host " copied $($f.Name)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- name: Pack artifacts
|
- name: Pack artifacts
|
||||||
run: |
|
run: |
|
||||||
cp "LICENSE" "build\bin\"
|
cp "LICENSE" "build\bin\Release\"
|
||||||
7z a -snl llama-bin-win-rocm-${{ env.ROCM_VERSION_SHORT }}-${{ matrix.build }}.zip .\build\bin\*
|
7z a -snl llama-bin-win-rocm-${{ env.ROCM_VERSION_SHORT }}-${{ matrix.build }}.zip .\build\bin\Release\*
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v6
|
||||||
|
|||||||
Reference in New Issue
Block a user