Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions .github/workflows/build-wheels-vulkan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Build Wheels (Vulkan)

on: workflow_dispatch

permissions:
contents: write

env:
VULKAN_SDK_VERSION: "1.4.341.0"
VULKAN_SDK_LINUX_SHA256: "ed66477d587a5587dc3601b1c2cdcc1fab5529c505f53a00171876cecd9b4fbe"

jobs:
build_wheels:
name: Build Vulkan wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
pyver: "3.9"
artifact: wheels-vulkan-ubuntu-22.04
- os: windows-2022
pyver: "3.9"
artifact: wheels-vulkan-windows-2022

steps:
- name: Set up MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- uses: actions/checkout@v4
with:
submodules: "recursive"

- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.pyver }}
cache: "pip"

- name: Install Vulkan SDK
if: runner.os == 'Linux'
run: |
curl -fL \
"https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/linux/vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz" \
-o vulkan-sdk.tar.xz
echo "${VULKAN_SDK_LINUX_SHA256} vulkan-sdk.tar.xz" | sha256sum -c -
mkdir -p "$RUNNER_TEMP/vulkan-sdk"
tar -xf vulkan-sdk.tar.xz -C "$RUNNER_TEMP/vulkan-sdk"
source "$RUNNER_TEMP/vulkan-sdk/${VULKAN_SDK_VERSION}/setup-env.sh"
{
echo "VULKAN_SDK=$VULKAN_SDK"
echo "LD_LIBRARY_PATH=$VULKAN_SDK/lib:${LD_LIBRARY_PATH:-}"
} >> "$GITHUB_ENV"
echo "$VULKAN_SDK/bin" >> "$GITHUB_PATH"
"$VULKAN_SDK/bin/glslc" --version

- name: Install Vulkan SDK
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install vulkan-sdk --version="$env:VULKAN_SDK_VERSION" --no-progress -y
$vulkanSdk = Join-Path 'C:\VulkanSDK' $env:VULKAN_SDK_VERSION
if (-not (Test-Path $vulkanSdk)) {
throw "Failed to find Vulkan SDK at $vulkanSdk"
}
"VULKAN_SDK=$vulkanSdk" >> $env:GITHUB_ENV
"$vulkanSdk\Bin" >> $env:GITHUB_PATH
& "$vulkanSdk\Bin\glslc.exe" --version

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build wheel

- name: Install Windows build dependencies
if: runner.os == 'Windows'
run: python -m pip install ninja

- name: Build Vulkan wheel
if: runner.os == 'Linux'
run: |
export CMAKE_ARGS="-DGGML_NATIVE=off -DGGML_METAL=OFF -DGGML_VULKAN=on"
python -m build --wheel
mkdir -p wheelhouse
cp dist/*.whl wheelhouse/

- name: Build Vulkan wheel
if: runner.os == 'Windows'
shell: pwsh
run: |
$env:CMAKE_GENERATOR = 'Ninja'
$env:CMAKE_ARGS = '-DGGML_NATIVE=off -DGGML_VULKAN=on'
python -m build --wheel
New-Item -ItemType Directory -Force wheelhouse | Out-Null
Copy-Item dist/*.whl wheelhouse/

- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: ./wheelhouse/*.whl

release:
name: Release
needs: [build_wheels]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist

- uses: softprops/action-gh-release@v2
with:
files: dist/*
# Set release name to <tag>-vulkan.
tag_name: ${{ github.ref_name }}-vulkan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/generate-index-from-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Wheels Index
on:
# Trigger on new release
workflow_run:
workflows: ["Release", "Build Wheels (CUDA)", "Build Wheels (Metal)"]
workflows: ["Release", "Build Wheels (CUDA)", "Build Wheels (Metal)", "Build Wheels (Vulkan)"]
types:
- completed

Expand Down Expand Up @@ -46,6 +46,7 @@ jobs:
./scripts/releases-to-pep-503.sh index/whl/cu124 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu124$'
# ./scripts/releases-to-pep-503.sh index/whl/cu125 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu124$'
# ./scripts/releases-to-pep-503.sh index/whl/cu126 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu124$'
./scripts/releases-to-pep-503.sh index/whl/vulkan '^[v]?[0-9]+\.[0-9]+\.[0-9]+-vulkan$'
./scripts/releases-to-pep-503.sh index/whl/metal '^[v]?[0-9]+\.[0-9]+\.[0-9]+-metal$'
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- feat(ci): add Vulkan wheel builds by @abetlen in #2251
- fix: handle additional `from_pretrained` files in subfolders by @TNing in #2085

## [0.3.25]
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ To install with Vulkan support, set the `GGML_VULKAN=on` environment variable be
CMAKE_ARGS="-DGGML_VULKAN=on" pip install llama-cpp-python
```

**Pre-built Wheel (New)**

It is also possible to install a pre-built wheel with Vulkan support for Linux or Windows:

```bash
pip install llama-cpp-python \
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/vulkan
```

</details>

<details>
Expand Down
Loading