Build Wheels (Vulkan) (Windows) #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Wheels (Vulkan) (Windows) | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
define_matrix: | |
name: Define Build Matrix | |
runs-on: sdk-windows-8-core | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
defaults: | |
run: | |
shell: pwsh | |
steps: | |
- name: Define Job Output | |
id: set-matrix | |
run: | | |
$matrix = @{ | |
'os' = @('sdk-windows-8-core') | |
'pyver' = @("3.7", "3.8", "3.9", "3.10", "3.11", "3.12") | |
'vulkan_version' = @("1.3.261.1") | |
'releasetag' = @("basic") | |
} | |
$matrixOut = ConvertTo-Json $matrix -Compress | |
Write-Output ('matrix=' + $matrixOut) >> $env:GITHUB_OUTPUT | |
build_wheels: | |
name: Build Wheel ${{ matrix.os }} Python ${{ matrix.pyver }} | |
needs: define_matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: ${{ fromJSON(needs.define_matrix.outputs.matrix) }} | |
defaults: | |
run: | |
shell: pwsh | |
env: | |
VULKAN_VERSION: ${{ matrix.vulkan_version }} | |
RELEASE_TAG: ${{ matrix.releasetag }} | |
steps: | |
- name: Add MSBuild to PATH | |
if: runner.os == 'Windows' | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
vs-version: "[16.11,16.12)" | |
msbuild-architecture: x64 | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Vulkan SDK | |
run: | | |
curl.exe -o $env:RUNNER_TEMP\VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${{ env.VULKAN_VERSION }}/windows/VulkanSDK-${{ env.VULKAN_VERSION }}-Installer.exe" | |
& "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install | |
Add-Content -Path $env:GITHUB_ENV -Value "VULKAN_SDK=C:\VulkanSDK\${{ env.VULKAN_VERSION }}" | |
Add-Content -Path $env:GITHUB_PATH -Value "C:\VulkanSDK\${{ env.VULKAN_VERSION }}\Bin" | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyver }} | |
architecture: 'x64' | |
cache: "pip" | |
- name: Install Ninja Build System | |
run: choco install ninja -y | |
- name: Install Build Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build wheel setuptools cmake ninja | |
python -m pip install scikit-build | |
- name: Build Wheel | |
run: | | |
# Set environment variables for CMake and Vulkan | |
$env:CMAKE_ARGS="-DGGML_VULKAN=ON -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl" | |
$env:VULKAN_SDK="C:\VulkanSDK\${{ env.VULKAN_VERSION }}" | |
$env:PATH="$env:VULKAN_SDK\Bin;$env:PATH" | |
# Set MSVC compiler flags to fix Windows SDK header issues | |
$env:CFLAGS="/D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN /DNOMINMAX /D_WIN32_WINNT=0x0601" | |
$env:CXXFLAGS="/D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN /DNOMINMAX /D_WIN32_WINNT=0x0601" | |
# Build the wheel | |
python -m build --wheel | |
- name: Upload Wheel Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist/*.whl | |
name: llama-vulkan-wheel-python${{ matrix.pyver }}.whl | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: dist/* | |
tag_name: ${{ github.ref_name }}-vulkan${{ env.VULKAN_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |