Skip to content

Commit 5c31ce7

Browse files
committed
Added sycl to build pipeline
1 parent c38694f commit 5c31ce7

File tree

3 files changed

+117
-1
lines changed

3 files changed

+117
-1
lines changed

.github/workflows/backends.yml

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,51 @@ jobs:
101101
uses: actions/[email protected]
102102
with:
103103
name: windows-${{ matrix.build }}
104+
path: .\build\bin\stable-diffusion.dll
105+
106+
windows-sycl:
107+
runs-on: windows-latest
108+
109+
defaults:
110+
run:
111+
shell: bash
112+
113+
env:
114+
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
115+
WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel
116+
117+
steps:
118+
- name: Checkout
119+
id: checkout
120+
uses: actions/[email protected]
121+
with:
122+
repository: 'leejet/stable-diffusion.cpp'
123+
ref: '${{ github.event.inputs.commit }}'
124+
submodules: recursive
125+
126+
- name: Checkout Install Script
127+
id: checkoutInstallScript
128+
uses: actions/[email protected]
129+
with:
130+
path: scripts
131+
sparse-checkout: |
132+
Backends/install-oneapi.bat
133+
Backends/win-build-sycl.bat
134+
sparse-checkout-cone-mode: false
135+
136+
- name: Install Sycl tools
137+
id: installSyclCompiler
138+
run: scripts/Backends/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
139+
140+
- name: Build
141+
id: cmake_build
142+
run: scripts/Backends/win-build-sycl.bat
143+
144+
- name: Upload artifact
145+
id: upload_artifact
146+
uses: actions/[email protected]
147+
with:
148+
name: windows-sycl
104149
path: .\build\bin\stable-diffusion.dll
105150

106151
linux:
@@ -119,7 +164,9 @@ jobs:
119164
- build: 'cuda11'
120165
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
121166
- build: 'cuda12'
122-
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
167+
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
168+
- build: 'sycl'
169+
defines: '-DSD_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DSD_BUILD_SHARED_LIBS=ON'
123170

124171
steps:
125172
- name: Checkout
@@ -150,8 +197,32 @@ jobs:
150197
use-github-cache: false
151198
use-local-cache: false
152199

200+
- name: Install Sycl tools
201+
id: installSyclCompiler
202+
if: ${{ matrix.build == 'sycl' }}
203+
shell: bash
204+
run: |
205+
cd /tmp
206+
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
207+
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
208+
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
209+
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
210+
sudo apt update
211+
sudo apt install intel-oneapi-compiler-dpcpp-cpp intel-oneapi-mkl-devel
212+
213+
- name: Build
214+
id: cmake_build_sycl
215+
if: ${{ matrix.build == 'sycl' }}
216+
run: |
217+
source /opt/intel/oneapi/setvars.sh
218+
mkdir build
219+
cd build
220+
cmake .. ${{ matrix.defines }}
221+
cmake --build . --config Release
222+
153223
- name: Build
154224
id: cmake_build
225+
if: ${{ matrix.build != 'sycl' }}
155226
run: |
156227
mkdir build
157228
cd build
@@ -244,6 +315,7 @@ jobs:
244315

245316
needs:
246317
- windows
318+
- windows-sycl
247319
- linux
248320
- linux-hip
249321
- osx
@@ -276,6 +348,7 @@ jobs:
276348
nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda12.Linux.nuspec -version ${{ github.event.inputs.version }}
277349
nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda.nuspec -version ${{ github.event.inputs.version }}
278350
nuget pack ./Backends/StableDiffusion.NET.Backend.Rocm.nuspec -version ${{ github.event.inputs.version }}
351+
nuget pack ./Backends/StableDiffusion.NET.Backend.Sycl.nuspec -version ${{ github.event.inputs.version }}
279352
280353
- name: Upload artifacts
281354
id: upload_artifacts

Backends/install-oneapi.bat

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:: MIT license
2+
:: Copyright (C) 2024 Intel Corporation
3+
:: SPDX-License-Identifier: MIT
4+
5+
6+
set URL=%1
7+
set COMPONENTS=%2
8+
9+
curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5
10+
start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log
11+
del %TEMP%\webimage.exe
12+
if "%COMPONENTS%"=="" (
13+
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=.
14+
) else (
15+
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=.
16+
)
17+
set installer_exit_code=%ERRORLEVEL%
18+
rd /s/q "webimage_extracted"
19+
exit /b %installer_exit_code%

Backends/win-build-sycl.bat

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
:: MIT license
2+
:: Copyright (C) 2024 Intel Corporation
3+
:: SPDX-License-Identifier: MIT
4+
5+
6+
IF not exist build (mkdir build)
7+
cd build
8+
if %errorlevel% neq 0 goto ERROR
9+
10+
@call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 --force
11+
if %errorlevel% neq 0 goto ERROR
12+
13+
cmake -G "Ninja" .. -DGGML_SYCL=ON -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=icx -DSD_BUILD_SHARED_LIBS=ON
14+
if %errorlevel% neq 0 goto ERROR
15+
16+
cmake --build . -j --config Release
17+
if %errorlevel% neq 0 goto ERROR
18+
19+
cd ..
20+
exit /B 0
21+
22+
:ERROR
23+
echo comomand error: %errorlevel%
24+
exit /B %errorlevel%

0 commit comments

Comments
 (0)