From 91449d75f07bf9d0b7f5b1e2f0939a81cee43ed2 Mon Sep 17 00:00:00 2001 From: abetlen Date: Wed, 3 Jun 2026 04:11:32 -0700 Subject: [PATCH 1/3] feat(ci): add Vulkan wheel builds --- .github/workflows/build-wheels-vulkan.yaml | 123 ++++++++++++++++++ .../generate-index-from-release.yaml | 3 +- 2 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-wheels-vulkan.yaml diff --git a/.github/workflows/build-wheels-vulkan.yaml b/.github/workflows/build-wheels-vulkan.yaml new file mode 100644 index 0000000000..760205c839 --- /dev/null +++ b/.github/workflows/build-wheels-vulkan.yaml @@ -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 -vulkan. + tag_name: ${{ github.ref_name }}-vulkan + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/generate-index-from-release.yaml b/.github/workflows/generate-index-from-release.yaml index 255ee67d6f..7fc19e697f 100644 --- a/.github/workflows/generate-index-from-release.yaml +++ b/.github/workflows/generate-index-from-release.yaml @@ -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 @@ -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 From 1ad71e4238a16e54554ebcb1ede32bfb0378823b Mon Sep 17 00:00:00 2001 From: abetlen Date: Wed, 3 Jun 2026 04:12:55 -0700 Subject: [PATCH 2/3] docs: update changelog for Vulkan wheel builds --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6677fc8fe0..1e2a180fd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] From e6ed872b3c3721033eb9b12989a9f3af8e135c85 Mon Sep 17 00:00:00 2001 From: abetlen Date: Wed, 3 Jun 2026 04:22:42 -0700 Subject: [PATCH 3/3] docs: add Vulkan wheel install instructions --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 7db3e27448..57ede08768 100644 --- a/README.md +++ b/README.md @@ -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 +``` +