Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/sycl-blender-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build and Test Blender

on:
workflow_call:
inputs:
runner:
type: string
required: True
level_zero_dir:
description: 'Root directory of Level Zero SDK installation'
required: false
type: string
default: ''
ccache_dir:
description: 'ccache directory'
required: true
type: string
blender_classroom_dir:
description: 'Blender classroom demo directory'
required: true
type: string
toolchain_artifact:
description: 'Artifact name for toolchain download'
required: true
type: string
toolchain_artifact_filename:
description: 'Toolchain artifact downloaded filename'
required: true
type: string

jobs:
blender:
runs-on: ${{ fromJSON(inputs.runner) }}
name: Build and Test Blender on ${{ contains(inputs.runner, 'Windows') && 'Windows' || 'Linux' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: |
devops/
persist-credentials: false
- name: Download Toolchain
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ inputs.toolchain_artifact }}

- name: Extract Toolchain
shell: bash
env:
TOOLCHAIN_ARTIFACT_FILENAME: ${{ inputs.toolchain_artifact_filename }}
run: |
rm -rf install
mkdir install
tar -xf $TOOLCHAIN_ARTIFACT_FILENAME -C install
rm $TOOLCHAIN_ARTIFACT_FILENAME

- name: Build OIDN
uses: ./devops/actions/blender/oidn
with:
cmake_install_prefix: ${{ github.workspace }}/oidn-install
c_compiler: ${{ github.workspace }}/install/bin/clang${{ runner.os == 'Windows' && '.exe' }}
cxx_compiler: ${{ github.workspace }}/install/bin/clang++${{ runner.os == 'Windows' && '.exe' }}

- name: Build Embree
uses: ./devops/actions/blender/embree
with:
cmake_install_prefix: ${{ github.workspace }}/embree-install
c_compiler: ${{ github.workspace }}/install/bin/clang${{ runner.os == 'Windows' && '.exe' }}
cxx_compiler: ${{ github.workspace }}/install/bin/clang++${{ runner.os == 'Windows' && '.exe' }}

- name: Build Blender
uses: ./devops/actions/blender/blender-build
with:
oidn_dir: ${{ github.workspace }}/oidn-install
embree_dir: ${{ github.workspace }}/embree-install
level_zero_dir: ${{ inputs.level_zero_dir }}
cmake_install_prefix: ${{ github.workspace }}/blender-install
sycl_dir: ${{ github.workspace }}/install
ccache_dir: ${{ inputs.ccache_dir }}

- name: Run Blender Classroom Demo
uses: ./devops/actions/blender/blender-demo
with:
blender_dir: ${{ github.workspace }}/blender-install
blender_classroom_dir: ${{ inputs.blender_classroom_dir }}
15 changes: 15 additions & 0 deletions .github/workflows/sycl-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,21 @@ jobs:
toolchain_artifact_filename: ${{ needs.build-win.outputs.toolchain_artifact_filename }}
binaries_artifact: sycl_cts_bin_win

build_and_test_blender_win:
name: Build and Test Blender on Windows
needs: build-win
if: |
!cancelled()
&& needs.build-win.outputs.build_conclusion == 'success'
uses: ./.github/workflows/sycl-blender-build-and-test.yml
with:
runner: '["Windows","blender"]'
level_zero_dir: "D:\\github\\level-zero_win-sdk"
ccache_dir: "D:\\github\\_work\\cache\\blender"
blender_classroom_dir: "D:\\github\\classroom-demo"
toolchain_artifact: sycl_windows_default
toolchain_artifact_filename: ${{ needs.build-win.outputs.toolchain_artifact_filename }}

# Verification example:
# cosign-windows-amd64.exe verify-blob sycl_linux.tar.gz \
# --bundle sycl_linux.tar.gz.sigstore.json \
Expand Down
102 changes: 102 additions & 0 deletions devops/actions/blender/blender-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: 'Build Blender'
description: 'Clone and build Blender with Intel GPU/SYCL support'

inputs:
oidn_dir:
description: 'OIDN installation directory'
required: true
embree_dir:
description: 'Embree installation directory'
required: true
level_zero_dir:
description: 'Level Zero installation directory'
required: true
sycl_dir:
description: 'SYCL compiler installation directory'
required: true
ccache_dir:
description: 'ccache directory'
required: true
cmake_install_prefix:
description: 'CMAKE_INSTALL_PREFIX for Blender build'
required: false
default: '${{ github.workspace }}/blender-install'

runs:
using: "composite"
steps:
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756
with:
arch: amd64

- name: Setup environment
shell: powershell
if: runner.os == 'Windows'
env:
CCACHE_DIR_INPUT: ${{ inputs.ccache_dir }}
SYCL_DIR_INPUT: ${{ inputs.sycl_dir }}
run: |
echo "SCCACHE_DIR=$env:CCACHE_DIR_INPUT" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "SCCACHE_MAXSIZE=10G" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Wthout this we get a linking error about not being able to find sycl-devicelib-host.lib
echo "LIB=$env:LIB;$env:SYCL_DIR_INPUT\lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CMAKE_EXTRA_ARGS=-DWITH_WINDOWS_SCCACHE=ON" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

Check failure

Code scanning / zizmor

dangerous use of environment file Error

dangerous use of environment file

Check failure

Code scanning / zizmor

dangerous use of environment file Error

dangerous use of environment file

Check failure

Code scanning / zizmor

dangerous use of environment file Error

dangerous use of environment file

Check failure

Code scanning / zizmor

dangerous use of environment file Error

dangerous use of environment file
Comment on lines +38 to +43
Copy link
Copy Markdown
Contributor Author

@sarnex sarnex Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KornevNikita Do we need these checks to pass before merging PRs or are we allowed to ignore them?

This warning seems to suggest we aren't allowed to modify any environment variables with non-static strings, and we have to set these vars to get things to work. We already do that heavily in other workflows, it's just the checks were added after those workflows were written. Thanks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is annoying, I suggest we ignore these :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that answer, thanks :P

Comment on lines +38 to +43
Comment on lines +38 to +43
Comment on lines +38 to +43

- name: Checkout Blender
shell: bash
env:
EMBREE_DIR_INPUT: ${{ inputs.embree_dir }}
OIDN_DIR_INPUT: ${{ inputs.oidn_dir }}
SYCL_DIR_INPUT: ${{ inputs.sycl_dir }}
run: |
unzip -q D:\\github\\blender_5_1_0_source.zip -d .
mv blender blender-src
# Work around CMake issue using preinstalled Embree/OIDN.
cp -RT "$EMBREE_DIR_INPUT" "blender-src/lib/windows_x64/embree"
cp -RT "$OIDN_DIR_INPUT" "blender-src/lib/windows_x64/OpenImageDenoise"

# CMake seems to override PATH leading to this file not being found by llvm-spirv.
cp "$(which SPIRV-Tools-shared.dll)" "$SYCL_DIR_INPUT/bin/"

# Apply source patches.
patch -p1 -d blender-src -i "${{ github.action_path }}/patches/Fix-build.patch"

- name: Configure Blender
shell: bash
env:
INSTALL_PREFIX_INPUT: ${{ inputs.cmake_install_prefix }}
SYCL_DIR_INPUT: ${{ inputs.sycl_dir }}
OIDN_DIR_INPUT: ${{ inputs.oidn_dir }}
EMBREE_DIR_INPUT: ${{ inputs.embree_dir }}
LEVEL_ZERO_DIR_INPUT: ${{ inputs.level_zero_dir }}
run: |
# Unify the path style to avoid CMake issues.
INSTALL_PREFIX=$(cygpath -m "$INSTALL_PREFIX_INPUT")
SYCL_DIR=$(cygpath -m "$SYCL_DIR_INPUT")
OIDN_DIR=$(cygpath -m "$OIDN_DIR_INPUT")
EMBREE_DIR=$(cygpath -m "$EMBREE_DIR_INPUT")
LEVEL_ZERO_DIR=$(cygpath -m "$LEVEL_ZERO_DIR_INPUT")

cmake -GNinja -B blender-build -S blender-src \
$CMAKE_EXTRA_ARGS \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DSYCL_ROOT_DIR="$SYCL_DIR" \
-DWITH_CYCLES_DEVICE_ONEAPI=ON \
-DOPENIMAGEDENOISE_ROOT_DIR="$OIDN_DIR" \
-DEMBREE_ROOT_DIR="$EMBREE_DIR" \
-DLEVEL_ZERO_ROOT_DIR="$LEVEL_ZERO_DIR" \
-DWITH_CYCLES_EMBREE=ON \
-DEMBREE_SYCL_SUPPORT=ON \
-DWITH_OPENIMAGEDENOISE=ON \
-DWITH_CYCLES_DEVICE_HIP=OFF \
-DWITH_CYCLES_DEVICE_CUDA=OFF \
-DWITH_CYCLES_DEVICE_OPTIX=OFF

- name: Build Blender
shell: bash
run: cmake --build blender-build --config Release

- name: Install Blender
shell: bash
run: cmake --install blender-build --config Release
84 changes: 84 additions & 0 deletions devops/actions/blender/blender-build/patches/Fix-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
diff --git a/intern/cycles/util/atomic.h b/intern/cycles/util/atomic.h
index 1a41f0d9..3d173703 100644
--- a/intern/cycles/util/atomic.h
+++ b/intern/cycles/util/atomic.h
@@ -178,8 +178,7 @@ ccl_device_inline float atomic_add_and_fetch_float(ccl_global float *p, const fl
{
sycl::atomic_ref<float,
sycl::memory_order::relaxed,
- sycl::memory_scope::device,
- sycl::access::address_space::ext_intel_global_device_space>
+ sycl::memory_scope::device>
atomic(*p);
return atomic.fetch_add(x);
}
@@ -190,8 +189,7 @@ ccl_device_inline float atomic_compare_and_swap_float(ccl_global float *source,
{
sycl::atomic_ref<float,
sycl::memory_order::relaxed,
- sycl::memory_scope::device,
- sycl::access::address_space::ext_intel_global_device_space>
+ sycl::memory_scope::device>
atomic(*source);
atomic.compare_exchange_weak(old_val, new_val);
return old_val;
@@ -202,8 +200,7 @@ ccl_device_inline unsigned int atomic_fetch_and_add_uint32(ccl_global unsigned i
{
sycl::atomic_ref<unsigned int,
sycl::memory_order::relaxed,
- sycl::memory_scope::device,
- sycl::access::address_space::ext_intel_global_device_space>
+ sycl::memory_scope::device>
atomic(*p);
return atomic.fetch_add(x);
}
@@ -212,8 +209,7 @@ ccl_device_inline int atomic_fetch_and_add_uint32(ccl_global int *p, const int x
{
sycl::atomic_ref<int,
sycl::memory_order::relaxed,
- sycl::memory_scope::device,
- sycl::access::address_space::ext_intel_global_device_space>
+ sycl::memory_scope::device>
atomic(*p);
return atomic.fetch_add(x);
}
@@ -233,8 +229,7 @@ ccl_device_inline unsigned int atomic_fetch_and_sub_uint32(ccl_global unsigned i
{
sycl::atomic_ref<unsigned int,
sycl::memory_order::relaxed,
- sycl::memory_scope::device,
- sycl::access::address_space::ext_intel_global_device_space>
+ sycl::memory_scope::device>
atomic(*p);
return atomic.fetch_sub(x);
}
@@ -243,8 +238,7 @@ ccl_device_inline int atomic_fetch_and_sub_uint32(ccl_global int *p, const int x
{
sycl::atomic_ref<int,
sycl::memory_order::relaxed,
- sycl::memory_scope::device,
- sycl::access::address_space::ext_intel_global_device_space>
+ sycl::memory_scope::device>
atomic(*p);
return atomic.fetch_sub(x);
}
@@ -274,8 +268,7 @@ ccl_device_inline unsigned int atomic_fetch_and_or_uint32(ccl_global unsigned in
{
sycl::atomic_ref<unsigned int,
sycl::memory_order::relaxed,
- sycl::memory_scope::device,
- sycl::access::address_space::ext_intel_global_device_space>
+ sycl::memory_scope::device>
atomic(*p);
return atomic.fetch_or(x);
}
@@ -284,8 +277,7 @@ ccl_device_inline int atomic_fetch_and_or_uint32(ccl_global int *p, const int x)
{
sycl::atomic_ref<int,
sycl::memory_order::relaxed,
- sycl::memory_scope::device,
- sycl::access::address_space::ext_intel_global_device_space>
+ sycl::memory_scope::device>
atomic(*p);
return atomic.fetch_or(x);
}
21 changes: 21 additions & 0 deletions devops/actions/blender/blender-demo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Run Blender Classroom Demo'
description: 'Download and render the Blender Classroom demo scene with Intel GPU'

inputs:
blender_dir:
description: 'Blender installation directory'
required: true
blender_classroom_dir:
description: 'Blender classroom demo directory'
required: true
runs:
using: "composite"
steps:
- name: Render Classroom Scene
shell: bash
env:
BLENDER_DIR: ${{ inputs.blender_dir }}
CLASSROOM_DIR: ${{ inputs.blender_classroom_dir }}
run: |
BLENDER_EXE="$BLENDER_DIR/blender$([[ "${{ runner.os }}" == "Windows" ]] && echo ".exe")"
"$BLENDER_EXE" -b -noaudio --debug-cycles --verbose 3 --engine CYCLES "$CLASSROOM_DIR/classroom.blend" -f 1 -- --cycles-device ONEAPI
59 changes: 59 additions & 0 deletions devops/actions/blender/embree/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 'Build Intel Embree'
description: 'Clone and build Embree for Intel GPU with SYCL support'

inputs:
cmake_install_prefix:
description: 'CMAKE_INSTALL_PREFIX for Embree build'
required: false
default: '${{ github.workspace }}/embree-install'
c_compiler:
description: 'Path to C compiler'
required: true
cxx_compiler:
description: 'Path to C++ compiler'
required: true

runs:
using: "composite"
steps:
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756
with:
arch: amd64

- name: Checkout Embree
uses: ./devops/actions/cached_checkout
with:
repository: 'RenderKit/embree'
ref: 'v4.4.0'
path: 'embree-src'
cache_path: "D:\\\\github\\\\_work\\\\repo_cache\\\\"

- name: Update Embree Submodules
shell: bash
run: |
cd embree-src
git submodule update --init --recursive

- name: Configure Embree
shell: bash
env:
INSTALL_PREFIX_INPUT: ${{ inputs.cmake_install_prefix }}
C_COMPILER_INPUT: ${{ inputs.c_compiler }}
CXX_COMPILER_INPUT: ${{ inputs.cxx_compiler }}
run: |
cmake -GNinja -B embree-build -S embree-src \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX_INPUT" \
-DCMAKE_C_COMPILER="$C_COMPILER_INPUT" \
-DCMAKE_CXX_COMPILER="$CXX_COMPILER_INPUT" \
-DEMBREE_SYCL_SUPPORT=ON \
-DEMBREE_ISPC_SUPPORT=OFF \
-DEMBREE_TUTORIALS=OFF

- name: Build Embree
shell: bash
run: cmake --build embree-build --config Release

- name: Install Embree
shell: bash
run: cmake --install embree-build --config Release
Loading
Loading