Skip to content

Commit

Permalink
ci: support windows oneapi
Browse files Browse the repository at this point in the history
Signed-off-by: thxCode <[email protected]>
  • Loading branch information
thxCode committed Jun 28, 2024
1 parent a278260 commit 76c1708
Showing 1 changed file with 101 additions and 10 deletions.
111 changes: 101 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:

# cache-able building with ccache.
darwin-metal:
if: ${{ false }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -100,6 +101,7 @@ jobs:

# cache-able building with ccache.
linux-hip:
if: ${{ false }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -198,6 +200,7 @@ jobs:

# cache-able building with ccache.
linux-cuda:
if: ${{ false }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -290,6 +293,7 @@ jobs:

# cache-able building with ccache.
linux-oneapi:
if: ${{ false }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -402,26 +406,30 @@ jobs:
key: cache-windows-hip-${{ matrix.arch }}-${{ matrix.version }}
path: |
${{ github.workspace }}\.cache
- name: Deps
run: |
$ErrorActionPreference = "Stop"
$ProgressPreference = 'SilentlyContinue'
choco install ccache -y
- name: Setup HIP
id: sdk
run: |
$ErrorActionPreference = "Stop"
$ProgressPreference = 'SilentlyContinue'
Write-Host "I install AMD ROCm HIP SDK"
Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ matrix.version == '5.7' && '23.Q4' || '23.Q3' }}-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"
Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
Invoke-WebRequest -OutFile "${{ runner.temp }}\installer.exe" `
-Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ matrix.version == '5.7' && '23.Q4' || '23.Q3' }}-WinSvr2022-For-HIP.exe"
Start-Process "${{ runner.temp }}\installer.exe" -NoNewWindow -Wait `
-ArgumentList '-install'
Write-Host "I verify AMD ROCm HIP SDK"
& 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
"HIP_PATH=$(Resolve-Path -Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | Split-Path | Split-Path)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
$hipPath = "$(Resolve-Path -Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | Split-Path | Split-Path)"
"HIP_PATH=${hipPath}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
"HIP_PATH=${hipPath}" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Deps
run: |
$ErrorActionPreference = "Stop"
$ProgressPreference = 'SilentlyContinue'
choco install ccache -y
- name: Build
# disable OpenMP,
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691,
Expand All @@ -437,7 +445,7 @@ jobs:
AMDGPU_TARGETS: "${{ matrix.version == '5.7' && 'gfx803;gfx900;gfx906;gfx908;gfx90a;gfx940;gfx941;gfx942;gfx1010;gfx1030;gfx1100;gfx1101;gfx1102' || 'gfx803;gfx900;gfx906;gfx908;gfx90a;gfx940;gfx1010;gfx1030;gfx1100;gfx1101;gfx1102' }}"
run: |
Write-Host "===== BUILD ====="
Write-Host "HIP_PATH=${{ steps.sdk.outputs.HIP_PATH }}"
Write-Host "HIP_PATH=${env:HIP_PATH}"
New-Item -Force -ItemType Directory -Path "${{ github.workspace }}\.cache" -ErrorAction Ignore | Out-Null
$env:HIP_PATH = "${{ steps.sdk.outputs.HIP_PATH }}"
$env:CMAKE_PREFIX_PATH = "${env:HIP_PATH}"
Expand Down Expand Up @@ -467,6 +475,7 @@ jobs:
# uncache-able building,
# see https://stackoverflow.com/questions/72829476/how-to-use-ccache-4-6-1-on-windows-msvc-with-cmake.
windows-cuda:
if: ${{ false }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -530,6 +539,87 @@ jobs:
path: ${{ github.workspace }}\\out\\*.zip
name: llama-box-windows-${{ matrix.arch }}-cuda-${{ matrix.version }}

# uncache-able building, inspired by
# https://github.com/oneapi-src/oneapi-ci/blob/master/.github/workflows/build_all.yml.
windows-oneapi:
strategy:
fail-fast: false
matrix:
arch: [ amd64 ]
# see https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html?operatingsystem=windows&windows-install-type=offline.
# 2024.2 ==> 2024.2.0
# 2024.1 ==> 2024.1.1
version: [ '2024.2' ]
runs-on: windows-2022
steps:
- name: Clone
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
- name: Setup Cache
timeout-minutes: 5
uses: actions/cache@v3
with:
key: oneapi_installer-windows-2022-${{ matrix.version == '2024.2' && '2024.2.0' || '2024.1.1' }}
path: |
${{ runner.temp }}
- name: Setup oneAPI
id: sdk
run: |
$ErrorActionPreference = "Stop"
$ProgressPreference = 'SilentlyContinue'
Write-Host "I install Intel oneAPI SDK"
Invoke-WebRequest -OutFile "${{ runner.temp }}\installer.exe" `
-Uri "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/${{ matrix.version == '2024.2' && 'e83a8e64-04fc-45df-85c6-c2208d03bdb5/w_BaseKit_p_2024.2.0.635' || '7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595' }}.exe"
Start-Process "${{ runner.temp }}\installer.exe" -NoNewWindow -Wait `
-ArgumentList '-s','--action=install','--components=intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel','--eula=accept','-p=NEED_VS2017_INTEGRATION=0','-p=NEED_VS2019_INTEGRATION=0','-p=NEED_VS2022_INTEGRATION=0'
$oneapiRoot = "C:\Program Files (x86)\Intel\oneAPI"
"ONEAPI_ROOT=${oneapiRoot}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
"ONEAPI_ROOT=${oneapiRoot}" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Deps
run: |
$ErrorActionPreference = "Stop"
$ProgressPreference = 'SilentlyContinue'
choco install ccache -y
- name: Build
# disable OpenMP,
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691,
# https://github.com/ggerganov/llama.cpp/issues/7719#issuecomment-2147631216.
env:
CCACHE_DIR: "${{ github.workspace }}\\.cache\\ccache"
run: |
Write-Host "===== BUILD ====="
Write-Host "ONEAPI_ROOT=${{ steps.sdk.outputs.ONEAPI_ROOT }}"
New-Item -Force -ItemType Directory -Path "${{ github.workspace }}\.cache" -ErrorAction Ignore | Out-Null
$env:ONEAPI_ROOT = "${{ steps.sdk.outputs.ONEAPI_ROOT }}"
& "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 --force
cmake -G "MinGW Makefiles" -S ${{ github.workspace }} -B ${{ github.workspace }}\build -DCMAKE_BUILD_TYPE=Release `
-DCMAKE_C_COMPILER="icx" -DCMAKE_CXX_COMPILER="icx" `
-DLLAMA_SYCL=on -DLLAMA_SYCL_F16=on `
${{ matrix.arch == 'amd64' && '-DLLAMA_NATIVE=off' || '-DLLAMA_NATIVE=on' }} `
-DLLAMA_OPENMP=off
cmake --build ${{ github.workspace }}\build --target llama-box --config Release -- -j ${env:NUMBER_OF_PROCESSORS}
Write-Host "===== RESULT ====="
if (Test-Path -Path "${{ github.workspace }}\build\bin\llama-box.exe") {
llvm-objdump.exe -p "${{ github.workspace }}\build\bin\llama-box.exe"
} else {
exit 1
}
Write-Host "===== PACKAGE ====="
New-Item -Force -ItemType Directory -Path "${{ github.workspace }}\out" -ErrorAction Ignore | Out-Null
Compress-Archive -Path "${{ github.workspace }}\build\bin\*" -DestinationPath "${{ github.workspace }}\out\llama-box-windows-${{ matrix.arch }}-oneapi-${{ matrix.version }}.zip"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: ${{ github.workspace }}\\out\\*.zip
name: llama-box-windows-${{ matrix.arch }}-oneapi-${{ matrix.version }}

release:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
permissions:
Expand All @@ -544,6 +634,7 @@ jobs:
- linux-oneapi
- windows-hip
- windows-cuda
- windows-oneapi
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
Expand Down

0 comments on commit 76c1708

Please sign in to comment.