Skip to content

Commit f390758

Browse files
authored
[CI] Add Windows Blender test to nightly (#21718)
This PR introduces a real world test into CI. The idea is we build and run Blender using the just-built SYCL compiler (initially, only the nightly) and then run an example workflow on a (multi) GPU system. The first version of this PR only tracks pass/fail, but in the future we could add a performance threshold to cause a fail. First we build OIDN and Embree, both of which use SYCL and DPC++. Then we build Blender with the just-built OIDN, Embree and SYCL compiler. The steps of this workflow (as in, what to do at a high level) were developed with help from internal Blender experts. Run in nightly example: https://github.com/intel/llvm/actions/runs/24317863959/job/70999916822 Entire workflow takes ~10 minutes. --------- Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
1 parent 7b1dac6 commit f390758

File tree

7 files changed

+454
-0
lines changed

7 files changed

+454
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build and Test Blender
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runner:
7+
type: string
8+
required: true
9+
level_zero_dir:
10+
description: 'Root directory of Level Zero SDK installation'
11+
required: false
12+
type: string
13+
default: ''
14+
ccache_dir:
15+
description: 'ccache directory'
16+
required: true
17+
type: string
18+
blender_classroom_dir:
19+
description: 'Blender classroom demo directory'
20+
required: true
21+
type: string
22+
toolchain_artifact:
23+
description: 'Artifact name for toolchain download'
24+
required: true
25+
type: string
26+
toolchain_artifact_filename:
27+
description: 'Toolchain artifact downloaded filename'
28+
required: true
29+
type: string
30+
31+
env:
32+
OIDN_INSTALL_DIR: "${{ github.workspace }}/oidn-install"
33+
EMBREE_INSTALL_DIR: "${{ github.workspace }}/embree-install"
34+
BLENDER_INSTALL_DIR: "${{ github.workspace }}/blender-install"
35+
36+
jobs:
37+
blender:
38+
runs-on: ${{ fromJSON(inputs.runner) }}
39+
name: Build and Test Blender on ${{ contains(inputs.runner, 'Windows') && 'Windows' || 'Linux' }}
40+
steps:
41+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42+
with:
43+
sparse-checkout: |
44+
devops/
45+
persist-credentials: false
46+
- name: Download Toolchain
47+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
48+
with:
49+
name: ${{ inputs.toolchain_artifact }}
50+
51+
- name: Extract Toolchain
52+
shell: bash
53+
env:
54+
TOOLCHAIN_ARTIFACT_FILENAME: ${{ inputs.toolchain_artifact_filename }}
55+
run: |
56+
rm -rf install
57+
mkdir install
58+
tar -xf $TOOLCHAIN_ARTIFACT_FILENAME -C install
59+
rm $TOOLCHAIN_ARTIFACT_FILENAME
60+
61+
- name: Build OIDN
62+
uses: ./devops/actions/blender/oidn
63+
with:
64+
cmake_install_prefix: ${{ env.OIDN_INSTALL_DIR }}
65+
c_compiler: ${{ github.workspace }}/install/bin/clang${{ runner.os == 'Windows' && '.exe' }}
66+
cxx_compiler: ${{ github.workspace }}/install/bin/clang++${{ runner.os == 'Windows' && '.exe' }}
67+
68+
- name: Build Embree
69+
uses: ./devops/actions/blender/embree
70+
with:
71+
cmake_install_prefix: ${{ env.EMBREE_INSTALL_DIR }}
72+
c_compiler: ${{ github.workspace }}/install/bin/clang${{ runner.os == 'Windows' && '.exe' }}
73+
cxx_compiler: ${{ github.workspace }}/install/bin/clang++${{ runner.os == 'Windows' && '.exe' }}
74+
75+
- name: Build Blender
76+
uses: ./devops/actions/blender/blender-build
77+
with:
78+
oidn_dir: ${{ env.OIDN_INSTALL_DIR }}
79+
embree_dir: ${{ env.EMBREE_INSTALL_DIR }}
80+
level_zero_dir: ${{ inputs.level_zero_dir }}
81+
cmake_install_prefix: ${{ env.BLENDER_INSTALL_DIR }}
82+
sycl_dir: ${{ github.workspace }}/install
83+
ccache_dir: ${{ inputs.ccache_dir }}
84+
85+
- name: Run Blender Classroom Demo
86+
uses: ./devops/actions/blender/blender-demo
87+
with:
88+
blender_dir: ${{ github.workspace }}/blender-install
89+
blender_classroom_dir: ${{ inputs.blender_classroom_dir }}
90+
91+
- name: Cleanup
92+
shell: cmd
93+
if: always()
94+
run: |
95+
rmdir /q /s "${{ env.OIDN_INSTALL_DIR }}" "${{ env.EMBREE_INSTALL_DIR }}" "${{ env.BLENDER_INSTALL_DIR }}"
96+

.github/workflows/sycl-nightly.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,21 @@ jobs:
403403
toolchain_artifact_filename: ${{ needs.build-win.outputs.toolchain_artifact_filename }}
404404
binaries_artifact: sycl_cts_bin_win
405405

406+
build_and_test_blender_win:
407+
name: Build and Test Blender on Windows
408+
needs: build-win
409+
if: |
410+
!cancelled()
411+
&& needs.build-win.outputs.build_conclusion == 'success'
412+
uses: ./.github/workflows/sycl-blender-build-and-test.yml
413+
with:
414+
runner: '["Windows","blender"]'
415+
level_zero_dir: "D:\\github\\level-zero_win-sdk"
416+
ccache_dir: "D:\\github\\_work\\cache\\blender"
417+
blender_classroom_dir: "D:\\github\\classroom-demo"
418+
toolchain_artifact: sycl_windows_default
419+
toolchain_artifact_filename: ${{ needs.build-win.outputs.toolchain_artifact_filename }}
420+
406421
# Verification example:
407422
# cosign-windows-amd64.exe verify-blob sycl_linux.tar.gz \
408423
# --bundle sycl_linux.tar.gz.sigstore.json \
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: 'Build Blender'
2+
description: 'Clone and build Blender with Intel GPU/SYCL support'
3+
4+
inputs:
5+
oidn_dir:
6+
description: 'OIDN installation directory'
7+
required: true
8+
embree_dir:
9+
description: 'Embree installation directory'
10+
required: true
11+
level_zero_dir:
12+
description: 'Level Zero installation directory'
13+
required: true
14+
sycl_dir:
15+
description: 'SYCL compiler installation directory'
16+
required: true
17+
ccache_dir:
18+
description: 'ccache directory'
19+
required: true
20+
cmake_install_prefix:
21+
description: 'CMAKE_INSTALL_PREFIX for Blender build'
22+
required: false
23+
default: '${{ github.workspace }}/blender-install'
24+
25+
runs:
26+
using: "composite"
27+
steps:
28+
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
29+
with:
30+
arch: amd64
31+
32+
- name: Setup environment
33+
shell: powershell
34+
if: runner.os == 'Windows'
35+
env:
36+
CCACHE_DIR_INPUT: ${{ inputs.ccache_dir }}
37+
SYCL_DIR_INPUT: ${{ inputs.sycl_dir }}
38+
run: |
39+
echo "SCCACHE_DIR=$env:CCACHE_DIR_INPUT" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
40+
echo "SCCACHE_MAXSIZE=10G" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
41+
# Without this we get a linking error about not being able to find sycl-devicelib-host.lib
42+
echo "LIB=$env:LIB;$env:SYCL_DIR_INPUT\lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
43+
echo "CMAKE_EXTRA_ARGS=-DWITH_WINDOWS_SCCACHE=ON" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
44+
45+
- name: Checkout Blender
46+
shell: bash
47+
env:
48+
EMBREE_DIR_INPUT: ${{ inputs.embree_dir }}
49+
OIDN_DIR_INPUT: ${{ inputs.oidn_dir }}
50+
SYCL_DIR_INPUT: ${{ inputs.sycl_dir }}
51+
run: |
52+
unzip -q D:\\github\\blender_5_1_0_source.zip -d .
53+
mv blender blender-src
54+
# Work around CMake issue using preinstalled Embree/OIDN.
55+
cp -RT "$EMBREE_DIR_INPUT" "blender-src/lib/windows_x64/embree"
56+
cp -RT "$OIDN_DIR_INPUT" "blender-src/lib/windows_x64/OpenImageDenoise"
57+
58+
# CMake seems to override PATH leading to this file not being found by llvm-spirv.
59+
cp "$(which SPIRV-Tools-shared.dll)" "$SYCL_DIR_INPUT/bin/"
60+
61+
# Apply source patches.
62+
patch -p1 -d blender-src -i "${{ github.action_path }}/patches/Fix-build.patch"
63+
64+
- name: Configure Blender
65+
shell: bash
66+
env:
67+
INSTALL_PREFIX_INPUT: ${{ inputs.cmake_install_prefix }}
68+
SYCL_DIR_INPUT: ${{ inputs.sycl_dir }}
69+
OIDN_DIR_INPUT: ${{ inputs.oidn_dir }}
70+
EMBREE_DIR_INPUT: ${{ inputs.embree_dir }}
71+
LEVEL_ZERO_DIR_INPUT: ${{ inputs.level_zero_dir }}
72+
run: |
73+
# Unify the path style to avoid CMake issues.
74+
INSTALL_PREFIX=$(cygpath -m "$INSTALL_PREFIX_INPUT")
75+
SYCL_DIR=$(cygpath -m "$SYCL_DIR_INPUT")
76+
OIDN_DIR=$(cygpath -m "$OIDN_DIR_INPUT")
77+
EMBREE_DIR=$(cygpath -m "$EMBREE_DIR_INPUT")
78+
LEVEL_ZERO_DIR=$(cygpath -m "$LEVEL_ZERO_DIR_INPUT")
79+
80+
cmake -GNinja -B blender-build -S blender-src \
81+
$CMAKE_EXTRA_ARGS \
82+
-DCMAKE_BUILD_TYPE=Release \
83+
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
84+
-DSYCL_ROOT_DIR="$SYCL_DIR" \
85+
-DWITH_CYCLES_DEVICE_ONEAPI=ON \
86+
-DOPENIMAGEDENOISE_ROOT_DIR="$OIDN_DIR" \
87+
-DEMBREE_ROOT_DIR="$EMBREE_DIR" \
88+
-DLEVEL_ZERO_ROOT_DIR="$LEVEL_ZERO_DIR" \
89+
-DWITH_CYCLES_EMBREE=ON \
90+
-DEMBREE_SYCL_SUPPORT=ON \
91+
-DWITH_OPENIMAGEDENOISE=ON \
92+
-DWITH_CYCLES_DEVICE_HIP=OFF \
93+
-DWITH_CYCLES_DEVICE_CUDA=OFF \
94+
-DWITH_CYCLES_DEVICE_OPTIX=OFF
95+
96+
- name: Build Blender
97+
shell: bash
98+
run: cmake --build blender-build --config Release
99+
100+
- name: Install Blender
101+
shell: bash
102+
run: cmake --install blender-build --config Release
103+
104+
- name: Cleanup
105+
shell: cmd
106+
if: always()
107+
run: |
108+
rmdir /q /s blender-build blender-src
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
diff --git a/intern/cycles/util/atomic.h b/intern/cycles/util/atomic.h
2+
index 1a41f0d9..3d173703 100644
3+
--- a/intern/cycles/util/atomic.h
4+
+++ b/intern/cycles/util/atomic.h
5+
@@ -178,8 +178,7 @@ ccl_device_inline float atomic_add_and_fetch_float(ccl_global float *p, const fl
6+
{
7+
sycl::atomic_ref<float,
8+
sycl::memory_order::relaxed,
9+
- sycl::memory_scope::device,
10+
- sycl::access::address_space::ext_intel_global_device_space>
11+
+ sycl::memory_scope::device>
12+
atomic(*p);
13+
return atomic.fetch_add(x);
14+
}
15+
@@ -190,8 +189,7 @@ ccl_device_inline float atomic_compare_and_swap_float(ccl_global float *source,
16+
{
17+
sycl::atomic_ref<float,
18+
sycl::memory_order::relaxed,
19+
- sycl::memory_scope::device,
20+
- sycl::access::address_space::ext_intel_global_device_space>
21+
+ sycl::memory_scope::device>
22+
atomic(*source);
23+
atomic.compare_exchange_weak(old_val, new_val);
24+
return old_val;
25+
@@ -202,8 +200,7 @@ ccl_device_inline unsigned int atomic_fetch_and_add_uint32(ccl_global unsigned i
26+
{
27+
sycl::atomic_ref<unsigned int,
28+
sycl::memory_order::relaxed,
29+
- sycl::memory_scope::device,
30+
- sycl::access::address_space::ext_intel_global_device_space>
31+
+ sycl::memory_scope::device>
32+
atomic(*p);
33+
return atomic.fetch_add(x);
34+
}
35+
@@ -212,8 +209,7 @@ ccl_device_inline int atomic_fetch_and_add_uint32(ccl_global int *p, const int x
36+
{
37+
sycl::atomic_ref<int,
38+
sycl::memory_order::relaxed,
39+
- sycl::memory_scope::device,
40+
- sycl::access::address_space::ext_intel_global_device_space>
41+
+ sycl::memory_scope::device>
42+
atomic(*p);
43+
return atomic.fetch_add(x);
44+
}
45+
@@ -233,8 +229,7 @@ ccl_device_inline unsigned int atomic_fetch_and_sub_uint32(ccl_global unsigned i
46+
{
47+
sycl::atomic_ref<unsigned int,
48+
sycl::memory_order::relaxed,
49+
- sycl::memory_scope::device,
50+
- sycl::access::address_space::ext_intel_global_device_space>
51+
+ sycl::memory_scope::device>
52+
atomic(*p);
53+
return atomic.fetch_sub(x);
54+
}
55+
@@ -243,8 +238,7 @@ ccl_device_inline int atomic_fetch_and_sub_uint32(ccl_global int *p, const int x
56+
{
57+
sycl::atomic_ref<int,
58+
sycl::memory_order::relaxed,
59+
- sycl::memory_scope::device,
60+
- sycl::access::address_space::ext_intel_global_device_space>
61+
+ sycl::memory_scope::device>
62+
atomic(*p);
63+
return atomic.fetch_sub(x);
64+
}
65+
@@ -274,8 +268,7 @@ ccl_device_inline unsigned int atomic_fetch_and_or_uint32(ccl_global unsigned in
66+
{
67+
sycl::atomic_ref<unsigned int,
68+
sycl::memory_order::relaxed,
69+
- sycl::memory_scope::device,
70+
- sycl::access::address_space::ext_intel_global_device_space>
71+
+ sycl::memory_scope::device>
72+
atomic(*p);
73+
return atomic.fetch_or(x);
74+
}
75+
@@ -284,8 +277,7 @@ ccl_device_inline int atomic_fetch_and_or_uint32(ccl_global int *p, const int x)
76+
{
77+
sycl::atomic_ref<int,
78+
sycl::memory_order::relaxed,
79+
- sycl::memory_scope::device,
80+
- sycl::access::address_space::ext_intel_global_device_space>
81+
+ sycl::memory_scope::device>
82+
atomic(*p);
83+
return atomic.fetch_or(x);
84+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Run Blender Classroom Demo'
2+
description: 'Download and render the Blender Classroom demo scene with Intel GPU'
3+
4+
inputs:
5+
blender_dir:
6+
description: 'Blender installation directory'
7+
required: true
8+
blender_classroom_dir:
9+
description: 'Blender classroom demo directory'
10+
required: true
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Render Classroom Scene
15+
shell: bash
16+
env:
17+
BLENDER_DIR: ${{ inputs.blender_dir }}
18+
CLASSROOM_DIR: ${{ inputs.blender_classroom_dir }}
19+
run: |
20+
BLENDER_EXE="$BLENDER_DIR/blender$([[ "${{ runner.os }}" == "Windows" ]] && echo ".exe")"
21+
"$BLENDER_EXE" -b -noaudio --debug-cycles --verbose 3 --engine CYCLES "$CLASSROOM_DIR/classroom.blend" -f 1 -- --cycles-device ONEAPI

0 commit comments

Comments
 (0)