Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
96 changes: 96 additions & 0 deletions .github/workflows/sycl-blender-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
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

env:
OIDN_INSTALL_DIR: "${{ github.workspace }}/oidn-install"
EMBREE_INSTALL_DIR: "${{ github.workspace }}/embree-install"
BLENDER_INSTALL_DIR: "${{ github.workspace }}/blender-install"

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/
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
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: ${{ env.OIDN_INSTALL_DIR }}
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: ${{ env.EMBREE_INSTALL_DIR }}
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: ${{ env.OIDN_INSTALL_DIR }}
embree_dir: ${{ env.EMBREE_INSTALL_DIR }}
level_zero_dir: ${{ inputs.level_zero_dir }}
cmake_install_prefix: ${{ env.BLENDER_INSTALL_DIR }}
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 }}

- name: Cleanup
shell: cmd

Check warning

Code scanning / zizmor

usage of GitHub Actions misfeatures Warning

usage of GitHub Actions misfeatures
Comment thread
sarnex marked this conversation as resolved.
Dismissed
if: always()
run: |
rmdir /q /s "${{ env.OIDN_INSTALL_DIR }}" "${{ env.EMBREE_INSTALL_DIR }}" "${{ env.BLENDER_INSTALL_DIR }}"

Check warning

Code scanning / zizmor

code injection via template expansion Warning

code injection via template expansion

Check warning

Code scanning / zizmor

code injection via template expansion Warning

code injection via template expansion

Check warning

Code scanning / zizmor

code injection via template expansion Warning

code injection via template expansion
Comment thread
sarnex marked this conversation as resolved.
Dismissed
Comment thread
sarnex marked this conversation as resolved.
Dismissed
Comment thread
sarnex marked this conversation as resolved.
Dismissed

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
108 changes: 108 additions & 0 deletions devops/actions/blender/blender-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
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
Copy link
Copy Markdown
Contributor

@KornevNikita KornevNikita Apr 14, 2026

Choose a reason for hiding this comment

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

Suggested change
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0

Same below and below and below. Not a blocker, feel free to ignore/make a follow up. I'm updating "uses: ..." across whole repo, so it'd be nice to have this.

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'll add this then merge, thanks

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
# Without 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
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 thread
sarnex marked this conversation as resolved.
Dismissed
Comment thread
sarnex marked this conversation as resolved.
Dismissed
Comment thread
sarnex marked this conversation as resolved.
Dismissed

- 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

- name: Cleanup
shell: cmd

Check warning

Code scanning / zizmor

usage of GitHub Actions misfeatures Warning

usage of GitHub Actions misfeatures
Comment thread
sarnex marked this conversation as resolved.
Dismissed
if: always()
run: |
rmdir /q /s blender-build blender-src
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
Loading
Loading