From 73c80a5b71c0047893d60f2dbeb735bc75a75424 Mon Sep 17 00:00:00 2001 From: Yicheng Qian Date: Tue, 12 Nov 2024 14:49:14 -0800 Subject: [PATCH 1/3] update CMakeLists.txt --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f86110d..66301361 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 @@ -146,6 +148,8 @@ option(LLAMA_BUILD "Build llama.cpp" ON) if(LLAMA_BUILD) set(LLAMA_CUDA ${GGML_CUDA}) set(LLAMA_METAL ${GGML_METAL}) + set(LLAMA_HIPBLAS ${GGML_HIPBLAS}) + set(LLAMA_VULKAN ${GGML_VULKAN}) if(WIN32) # Add Windows-specific definitions and flags for llama.cpp @@ -171,6 +175,8 @@ if(LLAMA_BUILD) -DBUILD_SHARED_LIBS=ON -DLLAMA_CUDA=${LLAMA_CUDA} -DLLAMA_METAL=${LLAMA_METAL} + -DLLAMA_HIPBLAS=${LLAMA_HIPBLAS} + -DLLAMA_VULKAN=${LLAMA_VULKAN} -DCMAKE_C_FLAGS=${OpenMP_C_FLAGS} -DCMAKE_CXX_FLAGS=${OpenMP_CXX_FLAGS} -DCMAKE_EXE_LINKER_FLAGS=${OpenMP_EXE_LINKER_FLAGS} @@ -188,6 +194,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 From c0e829e0d07c94515385d95d7709882b929747d1 Mon Sep 17 00:00:00 2001 From: Zack Zhiyuan Li Date: Tue, 12 Nov 2024 15:22:12 -0800 Subject: [PATCH 2/3] update CMakeLists --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66301361..e1f28a3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,8 +148,6 @@ option(LLAMA_BUILD "Build llama.cpp" ON) if(LLAMA_BUILD) set(LLAMA_CUDA ${GGML_CUDA}) set(LLAMA_METAL ${GGML_METAL}) - set(LLAMA_HIPBLAS ${GGML_HIPBLAS}) - set(LLAMA_VULKAN ${GGML_VULKAN}) if(WIN32) # Add Windows-specific definitions and flags for llama.cpp @@ -175,8 +173,6 @@ if(LLAMA_BUILD) -DBUILD_SHARED_LIBS=ON -DLLAMA_CUDA=${LLAMA_CUDA} -DLLAMA_METAL=${LLAMA_METAL} - -DLLAMA_HIPBLAS=${LLAMA_HIPBLAS} - -DLLAMA_VULKAN=${LLAMA_VULKAN} -DCMAKE_C_FLAGS=${OpenMP_C_FLAGS} -DCMAKE_CXX_FLAGS=${OpenMP_CXX_FLAGS} -DCMAKE_EXE_LINKER_FLAGS=${OpenMP_EXE_LINKER_FLAGS} From 273ed5adda339c5a0e594fed2bb8a09830e28c38 Mon Sep 17 00:00:00 2001 From: Yicheng Qian Date: Tue, 12 Nov 2024 15:57:01 -0800 Subject: [PATCH 3/3] wip --- .../workflows/build-wheels-vulkan-win.yaml | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) 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