mirror of
https://github.com/DarthAffe/StableDiffusion.NET.git
synced 2025-12-13 05:48:40 +00:00
Compare commits
No commits in common. "f7b7cd8a485cea4aa0e212d7c94e43871e1c86f0" and "ac5c3185d01cb78e43778c8d4ea509b18290dff9" have entirely different histories.
f7b7cd8a48
...
ac5c3185d0
73
.github/workflows/backends.yml
vendored
73
.github/workflows/backends.yml
vendored
@ -103,51 +103,6 @@ jobs:
|
|||||||
name: windows-${{ matrix.build }}
|
name: windows-${{ matrix.build }}
|
||||||
path: .\build\bin\stable-diffusion.dll
|
path: .\build\bin\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/7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595_offline.exe
|
|
||||||
WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
@ -165,8 +120,6 @@ jobs:
|
|||||||
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
|
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
|
||||||
- build: 'cuda12'
|
- build: 'cuda12'
|
||||||
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
|
defines: '-DSD_CUBLAS=ON -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:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -197,32 +150,8 @@ jobs:
|
|||||||
use-github-cache: false
|
use-github-cache: false
|
||||||
use-local-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
|
- name: Build
|
||||||
id: cmake_build
|
id: cmake_build
|
||||||
if: ${{ matrix.build != 'sycl' }}
|
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
@ -315,7 +244,6 @@ jobs:
|
|||||||
|
|
||||||
needs:
|
needs:
|
||||||
- windows
|
- windows
|
||||||
- windows-sycl
|
|
||||||
- linux
|
- linux
|
||||||
- linux-hip
|
- linux-hip
|
||||||
- osx
|
- osx
|
||||||
@ -348,7 +276,6 @@ jobs:
|
|||||||
nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda12.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.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.Rocm.nuspec -version ${{ github.event.inputs.version }}
|
||||||
nuget pack ./Backends/StableDiffusion.NET.Backend.Sycl.nuspec -version ${{ github.event.inputs.version }}
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
id: upload_artifacts
|
id: upload_artifacts
|
||||||
|
|||||||
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<package>
|
|
||||||
<metadata>
|
|
||||||
<id>StableDiffusion.NET.Backend.Sycl</id>
|
|
||||||
<version>$version$</version>
|
|
||||||
<title>StableDiffusion.NET.Backend.Sycl</title>
|
|
||||||
<authors>Darth Affe & stable-diffusion.cpp Authors</authors>
|
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
|
||||||
<license type="expression">MIT</license>
|
|
||||||
<icon>sd_net_sycl.png</icon>
|
|
||||||
<projectUrl>https://github.com/DarthAffe/StableDiffusion.NET</projectUrl>
|
|
||||||
<description>SYCL-Backend for StableDiffusion.NET.</description>
|
|
||||||
<releaseNotes></releaseNotes>
|
|
||||||
<copyright>Copyright © Darth Affe 2024</copyright>
|
|
||||||
<readme>readme.md</readme>
|
|
||||||
</metadata>
|
|
||||||
|
|
||||||
<files>
|
|
||||||
<file src="StableDiffusion.NET.Backend.props" target="build/net8.0/StableDiffusion.NET.Backend.Sycl.props" />
|
|
||||||
|
|
||||||
<file src="windows-sycl/stable-diffusion.dll" target="runtimes\win-x64\native\sycl\stable-diffusion.dll" />
|
|
||||||
|
|
||||||
<file src="linux-sycl/libstable-diffusion.so" target="runtimes\linux-x64\native\sycl\libstable-diffusion.so" />
|
|
||||||
|
|
||||||
<file src="sd_net_sycl.png" target="sd_net_sycl.png" />
|
|
||||||
<file src="readme.md" target="readme.md" />
|
|
||||||
<file src="ggml.txt" target="ggml.txt" />
|
|
||||||
<file src="stable-diffusion.cpp.txt" target="stable-diffusion.cpp.txt" />
|
|
||||||
</files>
|
|
||||||
</package>
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
:: MIT license
|
|
||||||
:: Copyright (C) 2024 Intel Corporation
|
|
||||||
:: SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
|
|
||||||
set URL=%1
|
|
||||||
set COMPONENTS=%2
|
|
||||||
|
|
||||||
curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5
|
|
||||||
start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log
|
|
||||||
del %TEMP%\webimage.exe
|
|
||||||
if "%COMPONENTS%"=="" (
|
|
||||||
webimage_extracted\bootstrapper.exe -s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=.
|
|
||||||
) else (
|
|
||||||
webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=.
|
|
||||||
)
|
|
||||||
set installer_exit_code=%ERRORLEVEL%
|
|
||||||
rd /s/q "webimage_extracted"
|
|
||||||
exit /b %installer_exit_code%
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 404 KiB |
@ -1,24 +0,0 @@
|
|||||||
:: MIT license
|
|
||||||
:: Copyright (C) 2024 Intel Corporation
|
|
||||||
:: SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
|
|
||||||
IF not exist build (mkdir build)
|
|
||||||
cd build
|
|
||||||
if %errorlevel% neq 0 goto ERROR
|
|
||||||
|
|
||||||
@call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 --force
|
|
||||||
if %errorlevel% neq 0 goto ERROR
|
|
||||||
|
|
||||||
cmake -G "Ninja" .. -DGGML_SYCL=ON -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=icx -DSD_BUILD_SHARED_LIBS=ON
|
|
||||||
if %errorlevel% neq 0 goto ERROR
|
|
||||||
|
|
||||||
cmake --build . -j --config Release
|
|
||||||
if %errorlevel% neq 0 goto ERROR
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
exit /B 0
|
|
||||||
|
|
||||||
:ERROR
|
|
||||||
echo comomand error: %errorlevel%
|
|
||||||
exit /B %errorlevel%
|
|
||||||
@ -175,7 +175,7 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogLine($"Failed to load stable-diffusion.cpp libraries!{Environment.NewLine}{ex.Message}");
|
LogLine($"Failed to load stable-diffussion.cpp libraries!{Environment.NewLine}{ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -14,12 +14,11 @@ public static class Backends
|
|||||||
public static CpuBackend CpuBackend { get; } = new();
|
public static CpuBackend CpuBackend { get; } = new();
|
||||||
public static CudaBackend CudaBackend { get; } = new();
|
public static CudaBackend CudaBackend { get; } = new();
|
||||||
public static RocmBackend RocmBackend { get; } = new();
|
public static RocmBackend RocmBackend { get; } = new();
|
||||||
public static SyclBackend SyclBackend { get; } = new();
|
|
||||||
|
|
||||||
private static readonly List<IBackend> CUSTOM_BACKENDS = [];
|
private static readonly List<IBackend> CUSTOM_BACKENDS = [];
|
||||||
public static IReadOnlyList<IBackend> CustomBackends => CUSTOM_BACKENDS.AsReadOnly();
|
public static IReadOnlyList<IBackend> CustomBackends => CUSTOM_BACKENDS.AsReadOnly();
|
||||||
|
|
||||||
public static IEnumerable<IBackend> RegisteredBackends => [CpuBackend, CudaBackend, RocmBackend, SyclBackend, .. CUSTOM_BACKENDS];
|
public static IEnumerable<IBackend> RegisteredBackends => [CpuBackend, CudaBackend, RocmBackend, .. CUSTOM_BACKENDS];
|
||||||
public static IEnumerable<IBackend> AvailableBackends => RegisteredBackends.Where(x => x.IsAvailable);
|
public static IEnumerable<IBackend> AvailableBackends => RegisteredBackends.Where(x => x.IsAvailable);
|
||||||
public static IEnumerable<IBackend> ActiveBackends => AvailableBackends.Where(x => x.IsEnabled);
|
public static IEnumerable<IBackend> ActiveBackends => AvailableBackends.Where(x => x.IsEnabled);
|
||||||
|
|
||||||
@ -37,7 +36,7 @@ public static class Backends
|
|||||||
|
|
||||||
public static bool RegisterBackend(IBackend backend)
|
public static bool RegisterBackend(IBackend backend)
|
||||||
{
|
{
|
||||||
if (backend is NET.CpuBackend or NET.CudaBackend or NET.RocmBackend or NET.SyclBackend)
|
if (backend is NET.CpuBackend or NET.CudaBackend or NET.RocmBackend)
|
||||||
throw new ArgumentException("Default backends can't be registered again.");
|
throw new ArgumentException("Default backends can't be registered again.");
|
||||||
|
|
||||||
if (CUSTOM_BACKENDS.Contains(backend))
|
if (CUSTOM_BACKENDS.Contains(backend))
|
||||||
|
|||||||
@ -1,30 +0,0 @@
|
|||||||
using System.Runtime.InteropServices;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
|
|
||||||
namespace StableDiffusion.NET;
|
|
||||||
|
|
||||||
[PublicAPI]
|
|
||||||
public class SyclBackend : IBackend
|
|
||||||
{
|
|
||||||
#region Properties & Fields
|
|
||||||
|
|
||||||
//TODO DarthAffe 10.08.2024: tbh I'm not really sure how to detect a sycl-compatible system so for now it's disabled by default
|
|
||||||
public bool IsEnabled { get; set; } = false;
|
|
||||||
|
|
||||||
public int Priority => 5;
|
|
||||||
|
|
||||||
public bool IsAvailable => (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
|
|
||||||
|| RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
||||||
&& (RuntimeInformation.OSArchitecture == Architecture.X64);
|
|
||||||
|
|
||||||
public string PathPart => "sycl";
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
|
|
||||||
internal SyclBackend()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user