backends #69
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: backends | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'version' | |
| required: true | |
| type: string | |
| commit: | |
| description: 'sd.cpp commit' | |
| required: true | |
| type: string | |
| jobs: | |
| windows: | |
| runs-on: windows-latest | |
| env: | |
| VULKAN_VERSION: 1.3.261.1 | |
| strategy: | |
| matrix: | |
| include: | |
| - build: 'noavx' | |
| defines: '-DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'avx' | |
| defines: '-DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'avx2' | |
| defines: '-DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'avx512' | |
| defines: '-DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'cuda12' | |
| defines: '-DSD_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=61;89 -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'vulkan' | |
| defines: "-DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON" | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v4.1.2 | |
| with: | |
| repository: 'leejet/stable-diffusion.cpp' | |
| ref: '${{ github.event.inputs.commit }}' | |
| submodules: recursive | |
| - name: Install cuda-toolkit | |
| id: cuda-toolkit-12 | |
| if: ${{ matrix.build == 'cuda12' }} | |
| uses: Jimver/cuda-toolkit@v0.2.19 | |
| with: | |
| cuda: '12.6.2' | |
| method: network | |
| sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]' | |
| - name: Install Vulkan SDK | |
| id: get_vulkan | |
| if: ${{ matrix.build == 'vulkan' }} | |
| 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 $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}" | |
| Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin" | |
| - name: Build | |
| id: cmake_build | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. ${{ matrix.defines }} | |
| cmake --build . --config Release | |
| - name: Upload artifact | |
| id: upload_artifact | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: windows-${{ matrix.build }} | |
| path: .\build\bin\Release\stable-diffusion.dll | |
| windows-2019: | |
| runs-on: windows-2019 | |
| strategy: | |
| matrix: | |
| include: | |
| - build: 'cuda11' | |
| defines: '-DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON -DCMAKE_CUDA_ARCHITECTURES=61 -DCMAKE_CUDA_FLAGS="-allow-unsupported-compiler"' | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v4.1.2 | |
| with: | |
| repository: 'leejet/stable-diffusion.cpp' | |
| ref: '${{ github.event.inputs.commit }}' | |
| submodules: recursive | |
| - name: Install cuda-toolkit | |
| id: cuda-toolkit-11 | |
| if: ${{ matrix.build == 'cuda11' }} | |
| uses: Jimver/cuda-toolkit@v0.2.16 | |
| with: | |
| cuda: '11.8.0' | |
| method: network | |
| sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]' | |
| use-github-cache: false | |
| use-local-cache: false | |
| - name: Build | |
| id: cmake_build | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. ${{ matrix.defines }} | |
| cmake --build . --config Release | |
| - name: Upload artifact | |
| id: upload_artifact | |
| if: ${{ matrix.build != 'rocm5' }} | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: windows-${{ matrix.build }} | |
| path: .\build\bin\Release\stable-diffusion.dll | |
| windows-sycl: | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/b380d914-366b-4b77-a74a-05e3c38b3514/intel-oneapi-base-toolkit-2025.0.0.882_offline.exe | |
| WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel | |
| ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI" | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v4.1.2 | |
| with: | |
| repository: 'leejet/stable-diffusion.cpp' | |
| ref: '${{ github.event.inputs.commit }}' | |
| submodules: recursive | |
| - name: Checkout Install Script | |
| id: checkoutInstallScript | |
| uses: actions/checkout@v4.1.2 | |
| with: | |
| path: scripts | |
| sparse-checkout: | | |
| Backends/install-oneapi.bat | |
| Backends/win-build-sycl.bat | |
| sparse-checkout-cone-mode: false | |
| - name: Install Sycl tools | |
| id: installSyclCompiler | |
| run: scripts/Backends/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL | |
| - name: Build | |
| id: cmake_build | |
| run: scripts/Backends/win-build-sycl.bat | |
| - name: Upload artifact | |
| id: upload_artifact | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: windows-sycl | |
| path: .\build\bin\stable-diffusion.dll | |
| windows-hip: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Install | |
| id: depends | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| write-host "Downloading AMD HIP SDK Installer" | |
| Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-24.Q4-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe" | |
| write-host "Installing AMD HIP SDK" | |
| Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait | |
| write-host "Completed AMD HIP SDK installation" | |
| - name: Verify ROCm | |
| id: verify | |
| run: | | |
| & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v4.1.2 | |
| with: | |
| repository: 'leejet/stable-diffusion.cpp' | |
| ref: '${{ github.event.inputs.commit }}' | |
| submodules: recursive | |
| - name: Build | |
| id: cmake_build | |
| run: | | |
| $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path) | |
| $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}" | |
| mkdir build | |
| cd build | |
| cmake -G "Unix Makefiles" .. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" -DGGML_HIP=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1101;gfx1030" -DGGML_RPC=ON -DSD_BUILD_SHARED_LIBS=ON | |
| cmake --build . --config Release | |
| - name: Upload artifact | |
| id: upload_artifact | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: windows-rocm6 | |
| path: .\build\bin\stable-diffusion.dll | |
| linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - build: 'noavx' | |
| defines: '-DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'avx' | |
| defines: '-DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'avx2' | |
| defines: '-DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'avx512' | |
| defines: '-DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'cuda11' | |
| defines: '-DSD_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=61 -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'cuda12' | |
| defines: '-DSD_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=61;89 -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'sycl' | |
| defines: '-DSD_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DSD_BUILD_SHARED_LIBS=ON' | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v4.1.2 | |
| with: | |
| repository: 'leejet/stable-diffusion.cpp' | |
| ref: '${{ github.event.inputs.commit }}' | |
| submodules: recursive | |
| - name: Install cuda-toolkit | |
| id: cuda-toolkit-11 | |
| if: ${{ matrix.build == 'cuda11' }} | |
| uses: Jimver/cuda-toolkit@v0.2.14 | |
| with: | |
| cuda: '11.7.1' | |
| method: network | |
| use-github-cache: false | |
| use-local-cache: false | |
| - name: Install cuda-toolkit | |
| id: cuda-toolkit-12 | |
| if: ${{ matrix.build == 'cuda12' }} | |
| uses: Jimver/cuda-toolkit@v0.2.14 | |
| with: | |
| cuda: '12.2.0' | |
| method: network | |
| use-github-cache: false | |
| use-local-cache: false | |
| - name: Install Sycl tools | |
| id: installSyclCompiler | |
| if: ${{ matrix.build == 'sycl' }} | |
| shell: bash | |
| run: | | |
| cd /tmp | |
| wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" | |
| sudo apt update | |
| sudo apt install intel-oneapi-compiler-dpcpp-cpp intel-oneapi-mkl-devel | |
| - name: Build | |
| id: cmake_build_sycl | |
| if: ${{ matrix.build == 'sycl' }} | |
| run: | | |
| source /opt/intel/oneapi/setvars.sh | |
| mkdir build | |
| cd build | |
| cmake .. ${{ matrix.defines }} | |
| cmake --build . --config Release | |
| - name: Build | |
| id: cmake_build | |
| if: ${{ matrix.build != 'sycl' }} | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. ${{ matrix.defines }} | |
| cmake --build . --config Release | |
| - name: Upload artifact | |
| id: upload_artifact | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: linux-${{ matrix.build }} | |
| path: ./build/bin/libstable-diffusion.so | |
| linux-hip: | |
| runs-on: ubuntu-22.04 | |
| container: rocm/dev-ubuntu-22.04:6.0.2 | |
| steps: | |
| - name: Dependencies | |
| id: depends | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev | |
| hipconfig | |
| - name: Clone | |
| id: checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: 'leejet/stable-diffusion.cpp' | |
| ref: '${{ github.event.inputs.commit }}' | |
| submodules: recursive | |
| - name: Build | |
| id: cmake_build | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" -DGGML_HIP=ON -DSD_BUILD_SHARED_LIBS=ON | |
| cmake --build . --config Release | |
| - name: Upload artifact Rocm | |
| id: upload_artifact_rocm | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: linux-rocm6 | |
| path: ./build/bin/libstable-diffusion.so | |
| osx: | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - build: 'noavx' | |
| defines: '-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'avx' | |
| defines: '-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'avx2' | |
| defines: '-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON' | |
| - build: 'avx512' | |
| defines: '-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON' | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v4.1.2 | |
| with: | |
| repository: 'leejet/stable-diffusion.cpp' | |
| ref: '${{ github.event.inputs.commit }}' | |
| submodules: recursive | |
| - name: Build | |
| id: cmake_build | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. ${{ matrix.defines }} | |
| cmake --build . --config Release | |
| - name: Upload artifact | |
| id: upload_artifact | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: osx-${{ matrix.build }} | |
| path: ./build/bin/libstable-diffusion.dylib | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - windows | |
| - windows-hip | |
| - windows-sycl | |
| - linux | |
| - linux-hip | |
| - osx | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v4.1.2 | |
| - name: Download artifacts | |
| id: download_artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: Backends | |
| - name: Display structure of downloaded files | |
| run: ls -R | |
| - name: Setup nuget | |
| id: setup_nuget | |
| uses: NuGet/setup-nuget@v2.0.0 | |
| - name: Pack | |
| id: pack | |
| run: | | |
| nuget pack ./Backends/StableDiffusion.NET.Backend.Cpu.nuspec -version ${{ github.event.inputs.version }} | |
| nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda11.Windows.nuspec -version ${{ github.event.inputs.version }} | |
| nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda12.Windows.nuspec -version ${{ github.event.inputs.version }} | |
| nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda11.Linux.nuspec -version ${{ github.event.inputs.version }} | |
| nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda12.Linux.nuspec -version ${{ github.event.inputs.version }} | |
| nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda.nuspec -version ${{ github.event.inputs.version }} | |
| nuget pack ./Backends/StableDiffusion.NET.Backend.Rocm.nuspec -version ${{ github.event.inputs.version }} | |
| nuget pack ./Backends/StableDiffusion.NET.Backend.Sycl.nuspec -version ${{ github.event.inputs.version }} | |
| nuget pack ./Backends/StableDiffusion.NET.Backend.Vulkan.nuspec -version ${{ github.event.inputs.version }} | |
| - name: Upload artifacts | |
| id: upload_artifacts | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: StableDiffusion.NET.Backend-Nugets | |
| path: ./*.nupkg | |
| # - name: Nuget Push | |
| # id: nuget_push | |
| # run: dotnet nuget push **\*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json |