diff --git a/.github/workflows/build-llama-cpp-windows.yml b/.github/workflows/build-llama-cpp-windows.yml deleted file mode 100644 index cb6e6c19f..000000000 --- a/.github/workflows/build-llama-cpp-windows.yml +++ /dev/null @@ -1,182 +0,0 @@ -name: Build llama.cpp (Windows ARM64) - -# Manual-only full build of upstream llama.cpp on the Snapdragon Windows -# ARM64 runner, with the same GGML backends geniex ships (Hexagon HTP + -# Adreno OpenCL). Builds straight from the official ggml-org/llama.cpp -# repo rather than the geniex submodule, so an arbitrary upstream commit -# can be exercised without touching the submodule pin. - -on: - workflow_dispatch: - inputs: - llama_ref: - description: "llama.cpp git ref to build (branch, tag, or commit SHA). Blank = latest master." - required: false - type: string - default: "" - -permissions: - contents: read - packages: read - -jobs: - build: - name: build-llama-cpp - runs-on: windows-arm64 - timeout-minutes: 120 - - steps: - - name: Configure Windows Git - shell: cmd - run: | - echo C:\Program Files\Git\bin>>%GITHUB_PATH% - git config --global core.longpaths true - git config --global core.protectNTFS false - git config --global core.fscache true - git config --global core.preloadindex true - - # Needed for the composite actions; llama.cpp is cloned separately. - - name: Checkout geniex (for composite actions) - uses: actions/checkout@v7 - with: - fetch-depth: 1 - - - name: Clone llama.cpp - id: llama - shell: powershell - env: - LLAMA_REF: ${{ inputs.llama_ref }} - run: | - $ErrorActionPreference = "Stop" - $dir = "$env:GITHUB_WORKSPACE\llama.cpp" - if (Test-Path $dir) { Remove-Item -Recurse -Force $dir } - git clone https://github.com/ggml-org/llama.cpp.git $dir - if ($LASTEXITCODE -ne 0) { throw "git clone failed: $LASTEXITCODE" } - Push-Location $dir - if ($env:LLAMA_REF) { - git fetch --depth 1 origin $env:LLAMA_REF - if ($LASTEXITCODE -ne 0) { throw "git fetch '$env:LLAMA_REF' failed: $LASTEXITCODE" } - git checkout FETCH_HEAD - if ($LASTEXITCODE -ne 0) { throw "git checkout '$env:LLAMA_REF' failed: $LASTEXITCODE" } - } - $sha = (git rev-parse HEAD).Trim() - Pop-Location - Add-Content -Path $env:GITHUB_OUTPUT -Value "sha=$sha" - Add-Content -Path $env:GITHUB_OUTPUT -Value "dir=$dir" - $refLabel = if ($env:LLAMA_REF) { $env:LLAMA_REF } else { "master" } - Write-Host "llama.cpp ref=$refLabel sha=$sha" - - - name: Install and configure ccache - shell: powershell - run: | - if (-not (Get-Command ccache -ErrorAction SilentlyContinue)) { - choco install ccache --no-progress -y - } - $env:CCACHE_DIR = "${{ github.workspace }}/.ccache" - Add-Content $env:GITHUB_ENV "CCACHE_DIR=$env:CCACHE_DIR" - # Tolerate __DATE__/__TIME__ and mtime jitter in ggml/llama sources. - Add-Content $env:GITHUB_ENV "CCACHE_SLOPPINESS=time_macros,include_file_mtime,include_file_ctime" - ccache --max-size=5G - - - name: Restore ccache - uses: actions/cache@v6 - with: - path: ${{ github.workspace }}/.ccache - key: ccache-llama-windows-arm64-${{ steps.llama.outputs.sha }} - restore-keys: ccache-llama-windows-arm64- - - - name: Setup Snapdragon SDKs - uses: ./.github/actions/setup-snapdragon-sdks - - - name: Configure HTP signing cert - shell: powershell - env: - HEXAGON_HTP_CERT_PFX: ${{ secrets.HEXAGON_HTP_CERT_PFX }} - run: | - $ErrorActionPreference = "Stop" - if (-not $env:HEXAGON_HTP_CERT_PFX) { - throw "HEXAGON_HTP_CERT_PFX secret is empty; set it to the base64 of the HTP .pfx." - } - $dst = "$env:RUNNER_TEMP\ggml-htp-v1.pfx" - [IO.File]::WriteAllBytes($dst, [Convert]::FromBase64String($env:HEXAGON_HTP_CERT_PFX)) - Add-Content -Path $env:GITHUB_ENV -Value "HEXAGON_HTP_CERT=$dst" - Write-Host "HEXAGON_HTP_CERT=$dst" - - - name: Setup VS toolchain - uses: ./.github/actions/setup-vcvars - - - name: Build llama.cpp - shell: powershell - env: - LLAMA_DIR: ${{ steps.llama.outputs.dir }} - run: | - $ErrorActionPreference = "Stop" - $Preset = "arm64-windows-llvm-release" - $BuildDir = "$env:LLAMA_DIR/build-$Preset" - - # Snapshot SDK vars before vcvars replay: the cmd.exe child does not - # inherit $GITHUB_ENV values, so the replay loop would clobber them. - $HexagonSdkRoot = $env:HEXAGON_SDK_ROOT - $HexagonToolsRoot = $env:HEXAGON_TOOLS_ROOT - $HexagonHtpCert = $env:HEXAGON_HTP_CERT - $OpenclSdkRoot = $env:OPENCL_SDK_ROOT - $WindowsSdkBin = $env:WINDOWS_SDK_BIN - - # Source vcvars so cmake children (clang, ninja, inf2cat, signtool) - # inherit the Windows SDK PATH/INCLUDE/LIB. - $envDump = cmd /c "`"$env:VCVARS_BAT`" $env:VCVARS_ARGS && set" - foreach ($line in $envDump) { - if ($line -match "^(.+?)=(.*)$") { - [Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process") - } - } - $env:PATH = "$env:LLVM_BIN;$env:PATH" - - # Restore SDK vars clobbered by the replay. - $env:HEXAGON_SDK_ROOT = $HexagonSdkRoot - $env:HEXAGON_TOOLS_ROOT = $HexagonToolsRoot - $env:HEXAGON_HTP_CERT = $HexagonHtpCert - $env:OPENCL_SDK_ROOT = $OpenclSdkRoot - $env:WINDOWS_SDK_BIN = $WindowsSdkBin - - # CMAKE_INSTALL_LIBDIR=bin puts skels + .cat alongside the DLLs and - # executables in one runnable folder. - cmake -S $env:LLAMA_DIR --preset $Preset -B $BuildDir --log-level=VERBOSE ` - -DGGML_HEXAGON=ON ` - -DGGML_OPENCL=ON ` - -DHEXAGON_SDK_ROOT="$HexagonSdkRoot" ` - -DHEXAGON_TOOLS_ROOT="$HexagonToolsRoot" ` - -DPREBUILT_LIB_DIR="windows_aarch64" ` - -DCMAKE_PREFIX_PATH="$OpenclSdkRoot" ` - -DCMAKE_INSTALL_LIBDIR=bin ` - -DCMAKE_C_COMPILER_LAUNCHER=ccache ` - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - if ($LASTEXITCODE -ne 0) { throw "cmake configure failed: $LASTEXITCODE" } - - cmake --build $BuildDir -j $([Environment]::ProcessorCount) - if ($LASTEXITCODE -ne 0) { throw "cmake --build failed: $LASTEXITCODE" } - - cmake --install $BuildDir --prefix "$env:LLAMA_DIR/dist" - if ($LASTEXITCODE -ne 0) { throw "cmake --install failed: $LASTEXITCODE" } - - # Assemble the WIDO signing bundle: 6 skels + .inf + .cat in one folder. - # .inf has no upstream install() rule so it is copied from the build tree. - $signingDir = "$env:LLAMA_DIR/dist/libggml-htp" - New-Item -ItemType Directory -Force -Path $signingDir | Out-Null - $hexBuildDir = "$BuildDir/ggml/src/ggml-hexagon" - Copy-Item "$hexBuildDir/libggml-htp-v*.so" $signingDir - Copy-Item "$hexBuildDir/libggml-htp.inf" $signingDir - Copy-Item "$hexBuildDir/libggml-htp.cat" $signingDir - - - name: ccache stats - shell: powershell - run: ccache --show-stats --verbose; $true - - - name: Upload llama.cpp build artifact - uses: actions/upload-artifact@v7 - with: - name: llama-cpp-windows-arm64-${{ steps.llama.outputs.sha }} - path: | - ${{ steps.llama.outputs.dir }}/dist/bin/ - ${{ steps.llama.outputs.dir }}/dist/libggml-htp/ - retention-days: 7