diff --git a/.github/workflows/sycl-blender-build-and-test.yml b/.github/workflows/sycl-blender-build-and-test.yml new file mode 100644 index 0000000000000..18fc2bc28fc23 --- /dev/null +++ b/.github/workflows/sycl-blender-build-and-test.yml @@ -0,0 +1,85 @@ +name: Build and Test Blender + +on: + workflow_call: + inputs: + level_zero_dir: + description: 'Root directory of Level Zero SDK installation' + required: true + type: string + ccache_dir: + description: 'ccache directory' + required: true + type: string + blender_classroom_dir: + description: 'Blender classroom demo directory' + required: true + type: string + toolchain_artifact_ids: + description: 'Artifact IDs for toolchain download' + required: true + type: string + toolchain_repository: + description: 'Repository for toolchain download' + required: true + type: string + toolchain_run_id: + description: 'Run ID for toolchain download' + required: true + type: string + +jobs: + blender: + runs-on: ${{ fromJSON('["Windows","blender"]') }} + name: Build and Test Blender + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + sparse-checkout: | + devops/ + + - name: Download Toolchain + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + artifact-ids: ${{ inputs.toolchain_artifact_ids }} + repository: ${{ inputs.toolchain_repository }} + run-id: ${{ inputs.toolchain_run_id }} + github-token: ${{ github.token }} + + - name: Extract Toolchain + shell: bash + run: | + rm -rf install + mkdir install + tar -xf sycl_windows.tar.gz -C install + rm sycl_windows.tar.gz + + - name: Build OIDN + uses: ./devops/actions/blender/oidn + with: + cmake_install_prefix: ${{ github.workspace }}/oidn-install + c_compiler: ${{ github.workspace }}/install/bin/clang.exe + cxx_compiler: ${{ github.workspace }}/install/bin/clang++.exe + + - name: Build Embree + uses: ./devops/actions/blender/embree + with: + cmake_install_prefix: ${{ github.workspace }}/embree-install + c_compiler: ${{ github.workspace }}/install/bin/clang.exe + cxx_compiler: ${{ github.workspace }}/install/bin/clang++.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 }} diff --git a/.github/workflows/sycl-windows-precommit.yml b/.github/workflows/sycl-windows-precommit.yml index 4c747545df5bf..9685e85c1d161 100644 --- a/.github/workflows/sycl-windows-precommit.yml +++ b/.github/workflows/sycl-windows-precommit.yml @@ -52,7 +52,7 @@ jobs: build: needs: [detect_changes] if: | - success() + !success() && github.repository == 'intel/llvm' uses: ./.github/workflows/sycl-windows-build.yml with: @@ -60,6 +60,20 @@ jobs: e2e_binaries_artifact: sycl_windows_e2ebin e2e_binaries_new_offload_model_artifact: sycl_windows_e2ebin_with_new_offload_model + build_blender_deps: + # needs: build + if: | + !cancelled() + # && needs.build.outputs.build_conclusion == 'success' + uses: ./.github/workflows/sycl-blender-build-and-test.yml + with: + 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_ids: 6213524008 + toolchain_repository: intel/llvm + toolchain_run_id: 23831325486 + run_prebuilt_e2e_tests: needs: build # Continue if build was successful. diff --git a/devops/actions/blender/blender-build/action.yml b/devops/actions/blender/blender-build/action.yml new file mode 100644 index 0000000000000..97cfa13e340ba --- /dev/null +++ b/devops/actions/blender/blender-build/action.yml @@ -0,0 +1,105 @@ +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 + + - name: Checkout Blender + shell: bash + env: + EMBREE_DIR_INPUT: ${{ inputs.embree_dir }} + OIDN_DIR_INPUT: ${{ inputs.oidn_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" + + # 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: | + # Convert all paths to CMake-style (forward slashes) + 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") + + # Maybe re-add + # -DEMBREE_SYCL_SUPPORT=ON \ + # -DWITH_OPENIMAGEDENOISE=ON \ + # -DWITH_CYCLES_DEVICE_HIP=OFF \ + # -DWITH_CYCLES_DEVICE_CUDA=OFF \ + # -DWITH_CYCLES_DEVICE_OPTIX=OFF + + 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 diff --git a/devops/actions/blender/blender-build/patches/Fix-build.patch b/devops/actions/blender/blender-build/patches/Fix-build.patch new file mode 100644 index 0000000000000..cbeb6dd2dc4dc --- /dev/null +++ b/devops/actions/blender/blender-build/patches/Fix-build.patch @@ -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 ++ 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 ++ 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 ++ 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 ++ 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 ++ 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 ++ 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 ++ 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 ++ sycl::memory_scope::device> + atomic(*p); + return atomic.fetch_or(x); + } diff --git a/devops/actions/blender/blender-demo/action.yml b/devops/actions/blender/blender-demo/action.yml new file mode 100644 index 0000000000000..1aa2d68c48d1d --- /dev/null +++ b/devops/actions/blender/blender-demo/action.yml @@ -0,0 +1,25 @@ +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: | + if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then + BLENDER_EXE="$BLENDER_DIR/blender.exe" + else + BLENDER_EXE="$BLENDER_DIR/blender" + fi + "$BLENDER_EXE" -b -noaudio --debug-cycles --verbose 3 --engine CYCLES "$CLASSROOM_DIR/classroom.blend" -f 1 -- --cycles-device ONEAPI diff --git a/devops/actions/blender/embree/action.yml b/devops/actions/blender/embree/action.yml new file mode 100644 index 0000000000000..eadd935a8c573 --- /dev/null +++ b/devops/actions/blender/embree/action.yml @@ -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 diff --git a/devops/actions/blender/oidn/action.yml b/devops/actions/blender/oidn/action.yml new file mode 100644 index 0000000000000..ffd9959aa55b7 --- /dev/null +++ b/devops/actions/blender/oidn/action.yml @@ -0,0 +1,59 @@ +name: 'Build Intel Open Image Denoise (OIDN)' +description: 'Clone and build OIDN for Intel GPU with SYCL support' + +inputs: + cmake_install_prefix: + description: 'CMAKE_INSTALL_PREFIX for OIDN build' + required: false + default: '${{ github.workspace }}/oidn-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 OIDN + uses: ./devops/actions/cached_checkout + with: + repository: 'RenderKit/oidn' + ref: 'v2.4.1' + path: 'oidn-src' + cache_path: "D:\\\\github\\\\_work\\\\repo_cache\\\\" + + - name: Update OIDN Submodules + shell: bash + run: | + cd oidn-src + git submodule update --init --recursive + + - name: Configure OIDN + 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 oidn-build -S oidn-src \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX_INPUT" \ + -DCMAKE_C_COMPILER="$C_COMPILER_INPUT" \ + -DCMAKE_CXX_COMPILER="$CXX_COMPILER_INPUT" \ + -DOIDN_DEVICE_SYCL=ON \ + -DOIDN_DEVICE_CUDA=OFF \ + -DOIDN_DEVICE_HIP=OFF + + - name: Build OIDN + shell: bash + run: cmake --build oidn-build --config Release + + - name: Install OIDN + shell: bash + run: cmake --install oidn-build --config Release