diff --git a/.github/workflows/build-wheels-vulkan-win.yaml b/.github/workflows/build-wheels-vulkan-win.yaml index ac362195..4683f8f8 100644 --- a/.github/workflows/build-wheels-vulkan-win.yaml +++ b/.github/workflows/build-wheels-vulkan-win.yaml @@ -1,11 +1,8 @@ name: Build Wheels (Vulkan) (Windows) - on: workflow_dispatch: - permissions: contents: write - jobs: define_matrix: name: Define Build Matrix @@ -15,7 +12,6 @@ jobs: defaults: run: shell: pwsh - steps: - name: Define Job Output id: set-matrix @@ -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 @@ -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 -vulkan tag_name: ${{ github.ref_name }}-vulkan${{ env.VULKAN_VERSION }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f86110d..e1f28a3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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