Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vulkan build bug fix for external build #239

Merged
merged 5 commits into from
Nov 13, 2024
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
28 changes: 8 additions & 20 deletions .github/workflows/build-wheels-vulkan-win.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: Build Wheels (Vulkan) (Windows)

on:
workflow_dispatch:

permissions:
contents: write

jobs:
define_matrix:
name: Define Build Matrix
Expand All @@ -15,7 +12,6 @@ jobs:
defaults:
run:
shell: pwsh

steps:
- name: Define Job Output
id: set-matrix
Expand All @@ -26,10 +22,8 @@ jobs:
'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
Expand All @@ -42,64 +36,58 @@ jobs:
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
# Install additional dependencies if needed
python -m pip install scikit-build

- name: Build Wheel
run: |
# Set environment variables for CMake and Vulkan
$env:CMAKE_ARGS="-DGGML_VULKAN=ON"
$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/*
# Set tag name to <tag>-vulkan<vulkan_version>
tag_name: ${{ github.ref_name }}-vulkan${{ env.VULKAN_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ if(STABLE_DIFFUSION_BUILD)
-DBUILD_SHARED_LIBS=ON
-DSD_METAL=${GGML_METAL}
-DSD_CUBLAS=${GGML_CUDA}
-DSD_HIPBLAS=${GGML_HIPBLAS}
-DSD_VULKAN=${GGML_VULKAN}
BUILD_ALWAYS 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${MSBUILD_ARGS}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config Release --target install
Expand Down Expand Up @@ -188,6 +190,10 @@ endif()
# bark_cpp project
option(BARK_BUILD "Build bark.cpp" ON)
if(BARK_BUILD)
# Filter out HIPBLAS and Vulkan options for bark.cpp since it doesn't support them
set(BARK_CMAKE_OPTIONS ${USER_DEFINED_OPTIONS})
list(FILTER BARK_CMAKE_OPTIONS EXCLUDE REGEX "GGML_HIPBLAS|GGML_VULKAN")

ExternalProject_Add(bark_project
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependency/bark.cpp
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bark_build
Expand Down
Loading