From 941831a8f6235bd44c558bb7868c72996d7f71fe Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 00:17:20 +0100 Subject: [PATCH 001/104] Add Intel SYCL x86 CI smoke test --- .github/workflows/sycl-ci.yml | 143 ++++++++++++++++++++++++++++++++++ CMakeLists.txt | 38 +++++++-- app/CMakeLists.txt | 4 + app/SYCL/CMakeLists.txt | 8 ++ app/SYCL/sycl_example.cpp | 88 +++++++++++++++++++++ 5 files changed, 275 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/sycl-ci.yml create mode 100644 app/SYCL/CMakeLists.txt create mode 100644 app/SYCL/sycl_example.cpp diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml new file mode 100644 index 000000000..a56537a12 --- /dev/null +++ b/.github/workflows/sycl-ci.yml @@ -0,0 +1,143 @@ +name: SYCL CI + +on: + pull_request: + workflow_dispatch: + +env: + INTEL_LLVM_TAG: v6.3.0 + +jobs: + build-sycl: + name: ${{ matrix.platform }} / ${{ matrix.build_type }} + runs-on: ${{ matrix.platform == 'linux-x86_64' && 'ubuntu-latest' || 'windows-2025' }} + timeout-minutes: 360 + strategy: + fail-fast: false + matrix: + platform: + - linux-x86_64 + - windows-x86_64 + build_type: + - Debug + - Release + + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@v6 + + - name: Setup MSVC environment + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + + - name: Prepare platform settings + id: prepare + run: | + case "${{ matrix.platform }}" in + linux-x86_64) + echo "toolchain_mode=binary" >> "$GITHUB_OUTPUT" + echo "TOOLCHAIN_ASSET=sycl_linux.tar.gz" >> "$GITHUB_ENV" + echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" + echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" + ;; + windows-x86_64) + echo "toolchain_mode=binary" >> "$GITHUB_OUTPUT" + echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" + echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" + echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" + ;; + *) + echo "Unsupported platform: ${{ matrix.platform }}" >&2 + exit 1 + ;; + esac + + - name: Install Linux prerequisites + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + cmake \ + git \ + libomp-dev \ + ocl-icd-opencl-dev \ + opencl-headers \ + pocl-opencl-icd \ + python3 \ + zstd + + - name: Download Intel SYCL toolchain binaries + if: steps.prepare.outputs.toolchain_mode == 'binary' + run: | + mkdir -p "$RUNNER_TEMP/intel-sycl" + curl -fsSL \ + "https://github.com/intel/llvm/releases/download/${INTEL_LLVM_TAG}/${TOOLCHAIN_ASSET}" \ + -o "$RUNNER_TEMP/${TOOLCHAIN_ASSET}" + tar -xzf "$RUNNER_TEMP/${TOOLCHAIN_ASSET}" \ + -C "$RUNNER_TEMP/intel-sycl" + echo "SYCL_ROOT=$RUNNER_TEMP/intel-sycl" >> "$GITHUB_ENV" + + - name: Locate SYCL compiler + run: | + if [[ -x "$SYCL_ROOT/bin/icx" ]]; then + echo "ITLABAI_CC=$SYCL_ROOT/bin/icx" >> "$GITHUB_ENV" + elif [[ -x "$SYCL_ROOT/bin/clang" ]]; then + echo "ITLABAI_CC=$SYCL_ROOT/bin/clang" >> "$GITHUB_ENV" + elif [[ -x "$SYCL_ROOT/bin/icx.exe" ]]; then + echo "ITLABAI_CC=$SYCL_ROOT/bin/icx.exe" >> "$GITHUB_ENV" + else + echo "Unable to locate a C compiler in $SYCL_ROOT/bin" >&2 + exit 1 + fi + + if [[ -x "$SYCL_ROOT/bin/icpx" ]]; then + echo "ITLABAI_CXX=$SYCL_ROOT/bin/icpx" >> "$GITHUB_ENV" + elif [[ -x "$SYCL_ROOT/bin/clang++" ]]; then + echo "ITLABAI_CXX=$SYCL_ROOT/bin/clang++" >> "$GITHUB_ENV" + elif [[ -x "$SYCL_ROOT/bin/icpx.exe" ]]; then + echo "ITLABAI_CXX=$SYCL_ROOT/bin/icpx.exe" >> "$GITHUB_ENV" + elif [[ -x "$SYCL_ROOT/bin/clang++.exe" ]]; then + echo "ITLABAI_CXX=$SYCL_ROOT/bin/clang++.exe" >> "$GITHUB_ENV" + else + echo "Unable to locate a C++ compiler in $SYCL_ROOT/bin" >&2 + exit 1 + fi + + echo "$SYCL_ROOT/bin" >> "$GITHUB_PATH" + + if [[ -d "$SYCL_ROOT/lib" ]]; then + echo "LD_LIBRARY_PATH=$SYCL_ROOT/lib:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" + echo "DYLD_LIBRARY_PATH=$SYCL_ROOT/lib:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV" + fi + + if [[ -d "$SYCL_ROOT/lib64" ]]; then + echo "LD_LIBRARY_PATH=$SYCL_ROOT/lib64:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" + echo "DYLD_LIBRARY_PATH=$SYCL_ROOT/lib64:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV" + fi + + - name: Configure + run: | + cmake -S . -B build -G Ninja \ + -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ + -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ + -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ + -DCMAKE_PREFIX_PATH="${SYCL_ROOT}" \ + -DITLABAI_ENABLE_SYCL=ON \ + -DITLABAI_SYCL_TARGETS="${SYCL_TARGETS}" + + - name: Build + run: cmake --build build --parallel + + - name: Smoke test + run: | + ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" \ + ctest --test-dir build --output-on-failure -R '^SYCL\.Example$' diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cb6861de..d9f98540a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.20) project(ITLabAI) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) +option(ITLABAI_ENABLE_SYCL "Build SYCL example and helper targets" OFF) +set(ITLABAI_SYCL_TARGETS "" CACHE STRING + "Optional SYCL targets passed to -fsycl-targets") option(ENABLE_STATISTIC_TENSORS "Enable statistic tensors" OFF) @@ -21,7 +24,6 @@ option(ENABLE_STATISTIC_WEIGHTS "Enable statistic weights" OFF) if(ENABLE_STATISTIC_WEIGHTS) add_definitions(-DENABLE_STATISTIC_WEIGHTS) endif() - set(CMAKE_CXX_STANDARD 20) enable_testing() @@ -36,6 +38,33 @@ else() message(STATUS "OpenMP not found - parallel features disabled") endif() +add_library(itlabai_sycl INTERFACE) + +if(ITLABAI_ENABLE_SYCL) + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag("-fsycl" ITLABAI_COMPILER_SUPPORTS_FSYCL) + + if(NOT ITLABAI_COMPILER_SUPPORTS_FSYCL) + message(FATAL_ERROR + "ITLABAI_ENABLE_SYCL=ON requires a compiler with -fsycl support") + endif() + + target_compile_options(itlabai_sycl INTERFACE + $<$:-fsycl> + ) + target_link_options(itlabai_sycl INTERFACE -fsycl) + target_compile_definitions(itlabai_sycl INTERFACE ITLABAI_HAS_SYCL=1) + + if(ITLABAI_SYCL_TARGETS) + target_compile_options(itlabai_sycl INTERFACE + $<$:-fsycl-targets=${ITLABAI_SYCL_TARGETS}> + ) + target_link_options(itlabai_sycl INTERFACE + -fsycl-targets=${ITLABAI_SYCL_TARGETS} + ) + endif() +endif() + include_directories("include") list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") @@ -50,15 +79,12 @@ include_directories("${KOKKOS_INSTALL_DIR}/include") add_library(Kokkos_imported INTERFACE) add_dependencies(Kokkos_imported kokkos_external) -target_include_directories(Kokkos_imported INTERFACE +target_include_directories(Kokkos_imported INTERFACE "${KOKKOS_INSTALL_DIR}/include" ) - -target_link_directories(Kokkos_imported INTERFACE +target_link_directories(Kokkos_imported INTERFACE "${KOKKOS_INSTALL_DIR}/lib" ) - - target_link_libraries(Kokkos_imported INTERFACE kokkoscore kokkoscontainers) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index e2914991a..65112bd59 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,3 +1,7 @@ +if(ITLABAI_ENABLE_SYCL) + add_subdirectory(SYCL) +endif() + add_subdirectory(ReaderImage) add_subdirectory(Accuracy) add_subdirectory(Converters) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt new file mode 100644 index 000000000..73efb7dd1 --- /dev/null +++ b/app/SYCL/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(SYCL_Example sycl_example.cpp) +target_link_libraries(SYCL_Example PRIVATE layers_lib itlabai_sycl) + +add_test(NAME SYCL.Example COMMAND SYCL_Example) +set_tests_properties(SYCL.Example PROPERTIES + LABELS "sycl;smoke" + TIMEOUT 60 +) diff --git a/app/SYCL/sycl_example.cpp b/app/SYCL/sycl_example.cpp new file mode 100644 index 000000000..e1f5ed7d3 --- /dev/null +++ b/app/SYCL/sycl_example.cpp @@ -0,0 +1,88 @@ +#include +#include +#include +#include +#include +#include + +#include + +#include "graph/runtime_options.hpp" +#include "layers/EWLayer.hpp" +#include "layers/Tensor.hpp" + +namespace { + +bool almost_equal(float lhs, float rhs) { + return std::fabs(lhs - rhs) < 1.0e-6F; +} + +} // namespace + +int main() { + try { + using namespace it_lab_ai; + + std::vector input_values = {-2.0F, -1.0F, 0.0F, 1.0F, 2.0F}; + Tensor input = make_tensor(input_values); + std::vector inputs = {input}; + std::vector outputs(1); + + EWLayer relu("relu"); + RuntimeOptions options; + relu.run(inputs, outputs, options); + + const std::vector& relu_output = *outputs.front().as(); + const std::vector expected_relu = {0.0F, 0.0F, 0.0F, 1.0F, 2.0F}; + + if (relu_output != expected_relu) { + std::cerr << "ITLabAI EWLayer produced an unexpected result" << '\n'; + return 1; + } + + auto async_handler = [](sycl::exception_list exceptions) { + for (const std::exception_ptr& exception : exceptions) { + std::rethrow_exception(exception); + } + }; + + sycl::queue queue(sycl::default_selector_v, async_handler); + std::cout << "SYCL device: " + << queue.get_device().get_info() + << '\n'; + + const std::size_t count = relu_output.size(); + std::vector sycl_output = relu_output; + + { + sycl::buffer values_buffer(sycl_output.data(), + sycl::range<1>(count)); + + queue.submit([&](sycl::handler& handler) { + auto values = + values_buffer.get_access(handler); + handler.parallel_for(sycl::range<1>(count), [=](sycl::id<1> index) { + values[index] = values[index] * 2.0F + 1.0F; + }); + }); + queue.wait_and_throw(); + } + + const std::vector expected_sycl = {1.0F, 1.0F, 1.0F, 3.0F, 5.0F}; + for (std::size_t i = 0; i < count; ++i) { + if (!almost_equal(sycl_output[i], expected_sycl[i])) { + std::cerr << "SYCL kernel verification failed at index " << i << '\n'; + return 1; + } + } + + std::cout << "SYCL example completed successfully" << '\n'; + return 0; + } catch (const sycl::exception& exception) { + std::cerr << "SYCL error: " << exception.what() << '\n'; + return 1; + } catch (const std::exception& exception) { + std::cerr << "Error: " << exception.what() << '\n'; + return 1; + } +} From 131da29bf3b43d83c757b4add056fc7b0b46a843 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 00:23:25 +0100 Subject: [PATCH 002/104] Fix SYCL CI x86 setup and concurrency --- .github/workflows/ci.yml | 4 ++++ .github/workflows/static-analysis.yml | 4 ++++ .github/workflows/sycl-ci.yml | 20 +++++++++++++++----- CMakeLists.txt | 4 ++-- app/SYCL/sycl_example.cpp | 3 +-- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c73d242e1..aff873de8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,10 @@ on: - cron: '0 8 * * *' workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: clang-format: runs-on: ubuntu-latest diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index c702c448f..985c29998 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -2,6 +2,10 @@ name: Static analysis on: [pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: clang-tidy: runs-on: ubuntu-latest diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index a56537a12..8e8ef2e88 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -4,6 +4,10 @@ on: pull_request: workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + env: INTEL_LLVM_TAG: v6.3.0 @@ -78,13 +82,19 @@ jobs: - name: Download Intel SYCL toolchain binaries if: steps.prepare.outputs.toolchain_mode == 'binary' run: | - mkdir -p "$RUNNER_TEMP/intel-sycl" + if [[ "$RUNNER_OS" == "Windows" ]]; then + runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" + else + runner_temp_dir="$RUNNER_TEMP" + fi + + mkdir -p "$runner_temp_dir/intel-sycl" curl -fsSL \ "https://github.com/intel/llvm/releases/download/${INTEL_LLVM_TAG}/${TOOLCHAIN_ASSET}" \ - -o "$RUNNER_TEMP/${TOOLCHAIN_ASSET}" - tar -xzf "$RUNNER_TEMP/${TOOLCHAIN_ASSET}" \ - -C "$RUNNER_TEMP/intel-sycl" - echo "SYCL_ROOT=$RUNNER_TEMP/intel-sycl" >> "$GITHUB_ENV" + -o "$runner_temp_dir/${TOOLCHAIN_ASSET}" + tar -xzf "$runner_temp_dir/${TOOLCHAIN_ASSET}" \ + -C "$runner_temp_dir/intel-sycl" + echo "SYCL_ROOT=$runner_temp_dir/intel-sycl" >> "$GITHUB_ENV" - name: Locate SYCL compiler run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index d9f98540a..6773d4a40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) -project(ITLabAI) +project(ITLabAI LANGUAGES CXX) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) option(ITLABAI_ENABLE_SYCL "Build SYCL example and helper targets" OFF) @@ -28,7 +28,7 @@ set(CMAKE_CXX_STANDARD 20) enable_testing() -find_package(OpenMP REQUIRED) +find_package(OpenMP REQUIRED COMPONENTS CXX) if(OpenMP_FOUND) message(STATUS "OpenMP found - enabling parallel support") diff --git a/app/SYCL/sycl_example.cpp b/app/SYCL/sycl_example.cpp index e1f5ed7d3..a7dd35e5b 100644 --- a/app/SYCL/sycl_example.cpp +++ b/app/SYCL/sycl_example.cpp @@ -3,9 +3,8 @@ #include #include #include -#include - #include +#include #include "graph/runtime_options.hpp" #include "layers/EWLayer.hpp" From 69e8aff51015723768cbe7904fec1495630bf0ca Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 00:25:29 +0100 Subject: [PATCH 003/104] Enable SYCL CI fail-fast matrix --- .github/workflows/sycl-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 8e8ef2e88..faead0ece 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -17,7 +17,7 @@ jobs: runs-on: ${{ matrix.platform == 'linux-x86_64' && 'ubuntu-latest' || 'windows-2025' }} timeout-minutes: 360 strategy: - fail-fast: false + fail-fast: true matrix: platform: - linux-x86_64 From 84947138340f9b269413cc0d7f5b6b23880ac691 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 00:28:58 +0100 Subject: [PATCH 004/104] Fix SYCL CI toolchain detection --- .github/workflows/sycl-ci.yml | 12 +++++++++++- CMakeLists.txt | 21 +++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index faead0ece..68df7bf36 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -94,7 +94,16 @@ jobs: -o "$runner_temp_dir/${TOOLCHAIN_ASSET}" tar -xzf "$runner_temp_dir/${TOOLCHAIN_ASSET}" \ -C "$runner_temp_dir/intel-sycl" - echo "SYCL_ROOT=$runner_temp_dir/intel-sycl" >> "$GITHUB_ENV" + + sycl_root="$runner_temp_dir/intel-sycl" + + if [[ -d "$sycl_root/sycl_windows/bin" ]]; then + sycl_root="$sycl_root/sycl_windows" + elif [[ -d "$sycl_root/sycl_linux/bin" ]]; then + sycl_root="$sycl_root/sycl_linux" + fi + + echo "SYCL_ROOT=$sycl_root" >> "$GITHUB_ENV" - name: Locate SYCL compiler run: | @@ -141,6 +150,7 @@ jobs: -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ -DCMAKE_PREFIX_PATH="${SYCL_ROOT}" \ + -DITLABAI_ENABLE_OPENMP=OFF \ -DITLABAI_ENABLE_SYCL=ON \ -DITLABAI_SYCL_TARGETS="${SYCL_TARGETS}" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6773d4a40..933137ac5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(ITLabAI LANGUAGES CXX) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) option(ITLABAI_ENABLE_SYCL "Build SYCL example and helper targets" OFF) +option(ITLABAI_ENABLE_OPENMP "Enable OpenMP parallel support" ON) set(ITLABAI_SYCL_TARGETS "" CACHE STRING "Optional SYCL targets passed to -fsycl-targets") @@ -28,14 +29,22 @@ set(CMAKE_CXX_STANDARD 20) enable_testing() -find_package(OpenMP REQUIRED COMPONENTS CXX) +if(ITLABAI_ENABLE_OPENMP) + find_package(OpenMP REQUIRED COMPONENTS CXX) -if(OpenMP_FOUND) - message(STATUS "OpenMP found - enabling parallel support") - add_definitions(-DHAS_OPENMP) - link_libraries(OpenMP::OpenMP_CXX) + if(OpenMP_FOUND) + message(STATUS "OpenMP found - enabling parallel support") + add_definitions(-DHAS_OPENMP) + link_libraries(OpenMP::OpenMP_CXX) + else() + message(STATUS "OpenMP not found - parallel features disabled") + endif() else() - message(STATUS "OpenMP not found - parallel features disabled") + message(STATUS "OpenMP support disabled") + + if(NOT TARGET OpenMP::OpenMP_CXX) + add_library(OpenMP::OpenMP_CXX INTERFACE IMPORTED) + endif() endif() add_library(itlabai_sycl INTERFACE) From 2718191734c2027498a88c3f6e7b87a64d2c6a08 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 00:31:39 +0100 Subject: [PATCH 005/104] Fix Windows SYCL compiler paths --- .github/workflows/sycl-ci.yml | 80 ++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 30 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 68df7bf36..7b410f157 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -107,40 +107,60 @@ jobs: - name: Locate SYCL compiler run: | - if [[ -x "$SYCL_ROOT/bin/icx" ]]; then - echo "ITLABAI_CC=$SYCL_ROOT/bin/icx" >> "$GITHUB_ENV" - elif [[ -x "$SYCL_ROOT/bin/clang" ]]; then - echo "ITLABAI_CC=$SYCL_ROOT/bin/clang" >> "$GITHUB_ENV" - elif [[ -x "$SYCL_ROOT/bin/icx.exe" ]]; then - echo "ITLABAI_CC=$SYCL_ROOT/bin/icx.exe" >> "$GITHUB_ENV" - else - echo "Unable to locate a C compiler in $SYCL_ROOT/bin" >&2 - exit 1 - fi + if [[ "$RUNNER_OS" == "Windows" ]]; then + if [[ -x "$SYCL_ROOT/bin/icx.exe" ]]; then + cc_path="$SYCL_ROOT/bin/icx.exe" + elif [[ -x "$SYCL_ROOT/bin/clang.exe" ]]; then + cc_path="$SYCL_ROOT/bin/clang.exe" + else + echo "Unable to locate a C compiler in $SYCL_ROOT/bin" >&2 + exit 1 + fi + + if [[ -x "$SYCL_ROOT/bin/icpx.exe" ]]; then + cxx_path="$SYCL_ROOT/bin/icpx.exe" + elif [[ -x "$SYCL_ROOT/bin/clang++.exe" ]]; then + cxx_path="$SYCL_ROOT/bin/clang++.exe" + else + echo "Unable to locate a C++ compiler in $SYCL_ROOT/bin" >&2 + exit 1 + fi - if [[ -x "$SYCL_ROOT/bin/icpx" ]]; then - echo "ITLABAI_CXX=$SYCL_ROOT/bin/icpx" >> "$GITHUB_ENV" - elif [[ -x "$SYCL_ROOT/bin/clang++" ]]; then - echo "ITLABAI_CXX=$SYCL_ROOT/bin/clang++" >> "$GITHUB_ENV" - elif [[ -x "$SYCL_ROOT/bin/icpx.exe" ]]; then - echo "ITLABAI_CXX=$SYCL_ROOT/bin/icpx.exe" >> "$GITHUB_ENV" - elif [[ -x "$SYCL_ROOT/bin/clang++.exe" ]]; then - echo "ITLABAI_CXX=$SYCL_ROOT/bin/clang++.exe" >> "$GITHUB_ENV" + echo "ITLABAI_CC=$(cygpath -m "$cc_path")" >> "$GITHUB_ENV" + echo "ITLABAI_CXX=$(cygpath -m "$cxx_path")" >> "$GITHUB_ENV" + echo "ITLABAI_CMAKE_PREFIX_PATH=$(cygpath -m "$SYCL_ROOT")" >> "$GITHUB_ENV" + echo "$(cygpath -m "$SYCL_ROOT/bin")" >> "$GITHUB_PATH" else - echo "Unable to locate a C++ compiler in $SYCL_ROOT/bin" >&2 - exit 1 - fi + if [[ -x "$SYCL_ROOT/bin/icx" ]]; then + echo "ITLABAI_CC=$SYCL_ROOT/bin/icx" >> "$GITHUB_ENV" + elif [[ -x "$SYCL_ROOT/bin/clang" ]]; then + echo "ITLABAI_CC=$SYCL_ROOT/bin/clang" >> "$GITHUB_ENV" + else + echo "Unable to locate a C compiler in $SYCL_ROOT/bin" >&2 + exit 1 + fi + + if [[ -x "$SYCL_ROOT/bin/icpx" ]]; then + echo "ITLABAI_CXX=$SYCL_ROOT/bin/icpx" >> "$GITHUB_ENV" + elif [[ -x "$SYCL_ROOT/bin/clang++" ]]; then + echo "ITLABAI_CXX=$SYCL_ROOT/bin/clang++" >> "$GITHUB_ENV" + else + echo "Unable to locate a C++ compiler in $SYCL_ROOT/bin" >&2 + exit 1 + fi - echo "$SYCL_ROOT/bin" >> "$GITHUB_PATH" + echo "ITLABAI_CMAKE_PREFIX_PATH=$SYCL_ROOT" >> "$GITHUB_ENV" + echo "$SYCL_ROOT/bin" >> "$GITHUB_PATH" - if [[ -d "$SYCL_ROOT/lib" ]]; then - echo "LD_LIBRARY_PATH=$SYCL_ROOT/lib:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" - echo "DYLD_LIBRARY_PATH=$SYCL_ROOT/lib:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV" - fi + if [[ -d "$SYCL_ROOT/lib" ]]; then + echo "LD_LIBRARY_PATH=$SYCL_ROOT/lib:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" + echo "DYLD_LIBRARY_PATH=$SYCL_ROOT/lib:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV" + fi - if [[ -d "$SYCL_ROOT/lib64" ]]; then - echo "LD_LIBRARY_PATH=$SYCL_ROOT/lib64:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" - echo "DYLD_LIBRARY_PATH=$SYCL_ROOT/lib64:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV" + if [[ -d "$SYCL_ROOT/lib64" ]]; then + echo "LD_LIBRARY_PATH=$SYCL_ROOT/lib64:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" + echo "DYLD_LIBRARY_PATH=$SYCL_ROOT/lib64:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV" + fi fi - name: Configure @@ -149,7 +169,7 @@ jobs: -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ - -DCMAKE_PREFIX_PATH="${SYCL_ROOT}" \ + -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ -DITLABAI_ENABLE_OPENMP=OFF \ -DITLABAI_ENABLE_SYCL=ON \ -DITLABAI_SYCL_TARGETS="${SYCL_TARGETS}" From 479595a322d9726d697d08d16c836885344932f2 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 00:41:21 +0100 Subject: [PATCH 006/104] Trim OpenCV from SYCL CI --- .github/workflows/sycl-ci.yml | 20 ++++++++++++++++++++ CMakeLists.txt | 17 +++++++++++++++-- app/CMakeLists.txt | 9 ++++++--- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 7b410f157..5e38e347f 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -10,6 +10,7 @@ concurrency: env: INTEL_LLVM_TAG: v6.3.0 + OPENCV_TAG: 4.13.0 jobs: build-sycl: @@ -51,12 +52,14 @@ jobs: echo "TOOLCHAIN_ASSET=sycl_linux.tar.gz" >> "$GITHUB_ENV" echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" + echo "ITLABAI_ENABLE_OPENCV_APPS=OFF" >> "$GITHUB_ENV" ;; windows-x86_64) echo "toolchain_mode=binary" >> "$GITHUB_OUTPUT" echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" + echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" ;; *) echo "Unsupported platform: ${{ matrix.platform }}" >&2 @@ -105,6 +108,20 @@ jobs: echo "SYCL_ROOT=$sycl_root" >> "$GITHUB_ENV" + - name: Download OpenCV release binaries + if: runner.os == 'Windows' && env.ITLABAI_ENABLE_OPENCV_APPS == 'ON' + run: | + runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" + opencv_archive="$runner_temp_dir/opencv-${OPENCV_TAG}-windows.exe" + opencv_extract_dir="$runner_temp_dir/opencv" + + curl -fsSL \ + "https://github.com/opencv/opencv/releases/download/${OPENCV_TAG}/opencv-${OPENCV_TAG}-windows.exe" \ + -o "$opencv_archive" + 7z x -y "-o$opencv_extract_dir" "$opencv_archive" + + echo "ITLABAI_OPENCV_DIR=$(cygpath -m "$opencv_extract_dir/opencv/build")" >> "$GITHUB_ENV" + - name: Locate SYCL compiler run: | if [[ "$RUNNER_OS" == "Windows" ]]; then @@ -171,6 +188,9 @@ jobs: -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ -DITLABAI_ENABLE_OPENMP=OFF \ + -DITLABAI_ENABLE_OPENCV_APPS="${ITLABAI_ENABLE_OPENCV_APPS}" \ + -DITLABAI_BUILD_TESTS=OFF \ + -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR}" \ -DITLABAI_ENABLE_SYCL=ON \ -DITLABAI_SYCL_TARGETS="${SYCL_TARGETS}" diff --git a/CMakeLists.txt b/CMakeLists.txt index 933137ac5..e91c10c7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,10 @@ project(ITLabAI LANGUAGES CXX) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) option(ITLABAI_ENABLE_SYCL "Build SYCL example and helper targets" OFF) option(ITLABAI_ENABLE_OPENMP "Enable OpenMP parallel support" ON) +option(ITLABAI_ENABLE_OPENCV_APPS "Build OpenCV-dependent apps" ON) +option(ITLABAI_BUILD_TESTS "Build unit tests" ON) +set(ITLABAI_OPENCV_DIR "" CACHE PATH + "Path to a prebuilt OpenCV package directory containing OpenCVConfig.cmake") set(ITLABAI_SYCL_TARGETS "" CACHE STRING "Optional SYCL targets passed to -fsycl-targets") @@ -80,7 +84,13 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") add_subdirectory(3rdparty) -include(cmake/opencv_config.cmake) +if(ITLABAI_ENABLE_OPENCV_APPS) + if(ITLABAI_OPENCV_DIR) + set(OPENCV_BUILD_DIR "${ITLABAI_OPENCV_DIR}") + else() + include(cmake/opencv_config.cmake) + endif() +endif() include(cmake/kokkos_config.cmake) include_directories("${KOKKOS_INSTALL_DIR}/include") @@ -118,4 +128,7 @@ endforeach() add_subdirectory(app) add_subdirectory(include) add_subdirectory(src) -add_subdirectory(test) + +if(ITLABAI_BUILD_TESTS) + add_subdirectory(test) +endif() diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 65112bd59..531d575ef 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -2,7 +2,10 @@ if(ITLABAI_ENABLE_SYCL) add_subdirectory(SYCL) endif() -add_subdirectory(ReaderImage) -add_subdirectory(Accuracy) add_subdirectory(Converters) -add_subdirectory(Graph) + +if(ITLABAI_ENABLE_OPENCV_APPS) + add_subdirectory(ReaderImage) + add_subdirectory(Accuracy) + add_subdirectory(Graph) +endif() From 9cca98331e0f83de5376b653bca65d7392823365 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 00:45:59 +0100 Subject: [PATCH 007/104] Use prebuilt oneTBB in SYCL CI --- .github/workflows/sycl-ci.yml | 32 ++++++++++++++++++++++++++++++++ 3rdparty/CMakeLists.txt | 30 +++++++++++++----------------- CMakeLists.txt | 2 ++ 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 5e38e347f..1d9661341 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -11,6 +11,7 @@ concurrency: env: INTEL_LLVM_TAG: v6.3.0 OPENCV_TAG: 4.13.0 + TBB_TAG: v2022.3.0 jobs: build-sycl: @@ -50,6 +51,7 @@ jobs: linux-x86_64) echo "toolchain_mode=binary" >> "$GITHUB_OUTPUT" echo "TOOLCHAIN_ASSET=sycl_linux.tar.gz" >> "$GITHUB_ENV" + echo "TBB_ASSET=oneapi-tbb-2022.3.0-lin.tgz" >> "$GITHUB_ENV" echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=OFF" >> "$GITHUB_ENV" @@ -57,6 +59,7 @@ jobs: windows-x86_64) echo "toolchain_mode=binary" >> "$GITHUB_OUTPUT" echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" + echo "TBB_ASSET=oneapi-tbb-2022.3.0-win.zip" >> "$GITHUB_ENV" echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" @@ -122,6 +125,34 @@ jobs: echo "ITLABAI_OPENCV_DIR=$(cygpath -m "$opencv_extract_dir/opencv/build")" >> "$GITHUB_ENV" + - name: Download oneTBB release binaries + run: | + if [[ "$RUNNER_OS" == "Windows" ]]; then + runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" + tbb_archive="$runner_temp_dir/${TBB_ASSET}" + tbb_extract_dir="$runner_temp_dir/oneapi-tbb" + + curl -fsSL \ + "https://github.com/uxlfoundation/oneTBB/releases/download/${TBB_TAG}/${TBB_ASSET}" \ + -o "$tbb_archive" + 7z x -y "-o$tbb_extract_dir" "$tbb_archive" + + echo "ITLABAI_TBB_DIR=$(cygpath -m "$tbb_extract_dir/oneapi-tbb-2022.3.0")" >> "$GITHUB_ENV" + echo "$(cygpath -m "$tbb_extract_dir/oneapi-tbb-2022.3.0/redist/intel64/vc14")" >> "$GITHUB_PATH" + else + tbb_archive="$RUNNER_TEMP/${TBB_ASSET}" + tbb_extract_dir="$RUNNER_TEMP/oneapi-tbb" + + curl -fsSL \ + "https://github.com/uxlfoundation/oneTBB/releases/download/${TBB_TAG}/${TBB_ASSET}" \ + -o "$tbb_archive" + mkdir -p "$tbb_extract_dir" + tar -xzf "$tbb_archive" -C "$tbb_extract_dir" + + echo "ITLABAI_TBB_DIR=$tbb_extract_dir/oneapi-tbb-2022.3.0" >> "$GITHUB_ENV" + echo "LD_LIBRARY_PATH=$tbb_extract_dir/oneapi-tbb-2022.3.0/lib/intel64/gcc4.8:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" + fi + - name: Locate SYCL compiler run: | if [[ "$RUNNER_OS" == "Windows" ]]; then @@ -191,6 +222,7 @@ jobs: -DITLABAI_ENABLE_OPENCV_APPS="${ITLABAI_ENABLE_OPENCV_APPS}" \ -DITLABAI_BUILD_TESTS=OFF \ -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR}" \ + -DITLABAI_TBB_DIR="${ITLABAI_TBB_DIR}" \ -DITLABAI_ENABLE_SYCL=ON \ -DITLABAI_SYCL_TARGETS="${SYCL_TARGETS}" diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index afa1a1b66..52a89c565 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -2,15 +2,20 @@ add_subdirectory(googletest) set(DNNL_CPU_RUNTIME "TBB" CACHE STRING "oneDNN CPU threading runtime") -add_subdirectory(oneDNN) +if(ITLABAI_TBB_DIR) + set(TBB_DIR "${ITLABAI_TBB_DIR}/lib/cmake/tbb" CACHE PATH + "Path to the prebuilt oneTBB CMake package" FORCE) + find_package(TBB REQUIRED CONFIG) +else() + # Unified TBB configuration for the vendored fallback. + option(TBB_TEST "Build TBB tests" OFF) + option(TBB_EXAMPLES "Build TBB examples" OFF) + set(TBB_STRICT OFF CACHE BOOL "Treat compiler warnings as errors") -# Unified TBB Configuration -option(TBB_TEST "Build TBB tests" OFF) -option(TBB_EXAMPLES "Build TBB examples" OFF) -set(TBB_STRICT OFF CACHE BOOL "Treat compiler warnings as errors") + add_subdirectory(TBB) +endif() -# Configure TBB with unified settings -add_subdirectory(TBB) +add_subdirectory(oneDNN) # Create a unified TBB interface target if(NOT TARGET TBB_unified) @@ -20,17 +25,8 @@ if(NOT TARGET TBB_unified) $ ) - # Platform-specific runtime library handling for Windows + # Platform-specific runtime library handling for Windows. if(WIN32) - # Get the TBB library directory based on build type - if(CMAKE_BUILD_TYPE) - string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build) - set(TBB_LIB_DIR "${CMAKE_SOURCE_DIR}/3rdparty/TBB/build/tbb_${lower_build}") - else() - set(TBB_LIB_DIR "${CMAKE_SOURCE_DIR}/3rdparty/TBB/build/tbb_debug") - endif() - - # Create a custom target to copy TBB runtime libraries add_custom_target(copy_tbb_runtime ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin" COMMAND ${CMAKE_COMMAND} -E copy_if_different diff --git a/CMakeLists.txt b/CMakeLists.txt index e91c10c7e..7e5603d76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,8 @@ option(ITLABAI_ENABLE_OPENCV_APPS "Build OpenCV-dependent apps" ON) option(ITLABAI_BUILD_TESTS "Build unit tests" ON) set(ITLABAI_OPENCV_DIR "" CACHE PATH "Path to a prebuilt OpenCV package directory containing OpenCVConfig.cmake") +set(ITLABAI_TBB_DIR "" CACHE PATH + "Path to a prebuilt oneTBB package root containing lib/cmake/tbb/TBBConfig.cmake") set(ITLABAI_SYCL_TARGETS "" CACHE STRING "Optional SYCL targets passed to -fsycl-targets") From 4a8aa9348c4ced63f528e0903668580765eef4b7 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 00:51:29 +0100 Subject: [PATCH 008/104] Use clang-cl for Windows SYCL CI --- .github/workflows/sycl-ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 1d9661341..9da9a857e 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -156,7 +156,11 @@ jobs: - name: Locate SYCL compiler run: | if [[ "$RUNNER_OS" == "Windows" ]]; then - if [[ -x "$SYCL_ROOT/bin/icx.exe" ]]; then + if [[ -x "$SYCL_ROOT/bin/icx-cl.exe" ]]; then + cc_path="$SYCL_ROOT/bin/icx-cl.exe" + elif [[ -x "$SYCL_ROOT/bin/clang-cl.exe" ]]; then + cc_path="$SYCL_ROOT/bin/clang-cl.exe" + elif [[ -x "$SYCL_ROOT/bin/icx.exe" ]]; then cc_path="$SYCL_ROOT/bin/icx.exe" elif [[ -x "$SYCL_ROOT/bin/clang.exe" ]]; then cc_path="$SYCL_ROOT/bin/clang.exe" @@ -165,7 +169,11 @@ jobs: exit 1 fi - if [[ -x "$SYCL_ROOT/bin/icpx.exe" ]]; then + if [[ -x "$SYCL_ROOT/bin/icx-cl.exe" ]]; then + cxx_path="$SYCL_ROOT/bin/icx-cl.exe" + elif [[ -x "$SYCL_ROOT/bin/clang-cl.exe" ]]; then + cxx_path="$SYCL_ROOT/bin/clang-cl.exe" + elif [[ -x "$SYCL_ROOT/bin/icpx.exe" ]]; then cxx_path="$SYCL_ROOT/bin/icpx.exe" elif [[ -x "$SYCL_ROOT/bin/clang++.exe" ]]; then cxx_path="$SYCL_ROOT/bin/clang++.exe" From b0b521850d50e614ce9eb5c8acba49a228d72b78 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 00:58:39 +0100 Subject: [PATCH 009/104] Use OpenCV 4.6 binaries in SYCL CI --- .github/workflows/sycl-ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 9da9a857e..e861db686 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -10,7 +10,7 @@ concurrency: env: INTEL_LLVM_TAG: v6.3.0 - OPENCV_TAG: 4.13.0 + OPENCV_TAG: 4.6.0 TBB_TAG: v2022.3.0 jobs: @@ -54,12 +54,14 @@ jobs: echo "TBB_ASSET=oneapi-tbb-2022.3.0-lin.tgz" >> "$GITHUB_ENV" echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" - echo "ITLABAI_ENABLE_OPENCV_APPS=OFF" >> "$GITHUB_ENV" + echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" + echo "ITLABAI_OPENCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4" >> "$GITHUB_ENV" ;; windows-x86_64) echo "toolchain_mode=binary" >> "$GITHUB_OUTPUT" echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-win.zip" >> "$GITHUB_ENV" + echo "OPENCV_ASSET=opencv-4.6.0-vc14_vc15.exe" >> "$GITHUB_ENV" echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" @@ -78,6 +80,7 @@ jobs: build-essential \ cmake \ git \ + libopencv-dev \ libomp-dev \ ocl-icd-opencl-dev \ opencl-headers \ @@ -115,15 +118,15 @@ jobs: if: runner.os == 'Windows' && env.ITLABAI_ENABLE_OPENCV_APPS == 'ON' run: | runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" - opencv_archive="$runner_temp_dir/opencv-${OPENCV_TAG}-windows.exe" + opencv_archive="$runner_temp_dir/${OPENCV_ASSET}" opencv_extract_dir="$runner_temp_dir/opencv" curl -fsSL \ - "https://github.com/opencv/opencv/releases/download/${OPENCV_TAG}/opencv-${OPENCV_TAG}-windows.exe" \ + "https://github.com/opencv/opencv/releases/download/${OPENCV_TAG}/${OPENCV_ASSET}" \ -o "$opencv_archive" 7z x -y "-o$opencv_extract_dir" "$opencv_archive" - echo "ITLABAI_OPENCV_DIR=$(cygpath -m "$opencv_extract_dir/opencv/build")" >> "$GITHUB_ENV" + echo "ITLABAI_OPENCV_DIR=$(cygpath -m "$opencv_extract_dir/opencv/build/x64/vc15/lib")" >> "$GITHUB_ENV" - name: Download oneTBB release binaries run: | From 8da4eff061fed5ae307f0fabfffee8b87efaff36 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 01:00:10 +0100 Subject: [PATCH 010/104] Use latest Windows OpenCV in SYCL CI --- .github/workflows/sycl-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index e861db686..a0dfe2391 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -10,7 +10,7 @@ concurrency: env: INTEL_LLVM_TAG: v6.3.0 - OPENCV_TAG: 4.6.0 + OPENCV_TAG: 4.13.0 TBB_TAG: v2022.3.0 jobs: @@ -61,7 +61,7 @@ jobs: echo "toolchain_mode=binary" >> "$GITHUB_OUTPUT" echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-win.zip" >> "$GITHUB_ENV" - echo "OPENCV_ASSET=opencv-4.6.0-vc14_vc15.exe" >> "$GITHUB_ENV" + echo "OPENCV_ASSET=opencv-4.13.0-windows.exe" >> "$GITHUB_ENV" echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" @@ -126,7 +126,7 @@ jobs: -o "$opencv_archive" 7z x -y "-o$opencv_extract_dir" "$opencv_archive" - echo "ITLABAI_OPENCV_DIR=$(cygpath -m "$opencv_extract_dir/opencv/build/x64/vc15/lib")" >> "$GITHUB_ENV" + echo "ITLABAI_OPENCV_DIR=$(cygpath -m "$opencv_extract_dir/opencv/build/x64/vc16/lib")" >> "$GITHUB_ENV" - name: Download oneTBB release binaries run: | From 8357129a5cc10c07fbd1095626830e14b42c95fd Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 01:04:35 +0100 Subject: [PATCH 011/104] Restore default oneDNN TBB ordering --- 3rdparty/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 52a89c565..2c5010334 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -6,7 +6,11 @@ if(ITLABAI_TBB_DIR) set(TBB_DIR "${ITLABAI_TBB_DIR}/lib/cmake/tbb" CACHE PATH "Path to the prebuilt oneTBB CMake package" FORCE) find_package(TBB REQUIRED CONFIG) -else() +endif() + +add_subdirectory(oneDNN) + +if(NOT ITLABAI_TBB_DIR) # Unified TBB configuration for the vendored fallback. option(TBB_TEST "Build TBB tests" OFF) option(TBB_EXAMPLES "Build TBB examples" OFF) @@ -15,8 +19,6 @@ else() add_subdirectory(TBB) endif() -add_subdirectory(oneDNN) - # Create a unified TBB interface target if(NOT TARGET TBB_unified) add_library(TBB_unified INTERFACE) From d5471e49cdf5750424866848b29cf780bc811391 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 01:37:28 +0100 Subject: [PATCH 012/104] Fix SYCL CI and macOS arm64 path --- .github/workflows/sycl-ci.yml | 66 +++++++++++++++++++++++++++++++---- 3rdparty/CMakeLists.txt | 16 ++++++++- CMakeLists.txt | 45 ++++++++++++++++++------ include/parallel/backends.hpp | 1 + 4 files changed, 110 insertions(+), 18 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index a0dfe2391..4e3eae986 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -14,7 +14,7 @@ env: TBB_TAG: v2022.3.0 jobs: - build-sycl: + build-sycl-x86: name: ${{ matrix.platform }} / ${{ matrix.build_type }} runs-on: ${{ matrix.platform == 'linux-x86_64' && 'ubuntu-latest' || 'windows-2025' }} timeout-minutes: 360 @@ -45,11 +45,9 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 - name: Prepare platform settings - id: prepare run: | case "${{ matrix.platform }}" in linux-x86_64) - echo "toolchain_mode=binary" >> "$GITHUB_OUTPUT" echo "TOOLCHAIN_ASSET=sycl_linux.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-lin.tgz" >> "$GITHUB_ENV" echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" @@ -58,7 +56,6 @@ jobs: echo "ITLABAI_OPENCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4" >> "$GITHUB_ENV" ;; windows-x86_64) - echo "toolchain_mode=binary" >> "$GITHUB_OUTPUT" echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-win.zip" >> "$GITHUB_ENV" echo "OPENCV_ASSET=opencv-4.13.0-windows.exe" >> "$GITHUB_ENV" @@ -89,7 +86,6 @@ jobs: zstd - name: Download Intel SYCL toolchain binaries - if: steps.prepare.outputs.toolchain_mode == 'binary' run: | if [[ "$RUNNER_OS" == "Windows" ]]; then runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" @@ -115,7 +111,7 @@ jobs: echo "SYCL_ROOT=$sycl_root" >> "$GITHUB_ENV" - name: Download OpenCV release binaries - if: runner.os == 'Windows' && env.ITLABAI_ENABLE_OPENCV_APPS == 'ON' + if: runner.os == 'Windows' run: | runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" opencv_archive="$runner_temp_dir/${OPENCV_ASSET}" @@ -244,3 +240,61 @@ jobs: run: | ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" \ ctest --test-dir build --output-on-failure -R '^SYCL\.Example$' + + build-sycl-macos-arm64: + name: macos-arm64 / ${{ matrix.build_type }} + runs-on: macos-15 + needs: build-sycl-x86 + timeout-minutes: 360 + strategy: + fail-fast: true + matrix: + build_type: + - Debug + - Release + + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@v6 + + - name: Install macOS prerequisites + run: | + brew install adaptivecpp tbb + + - name: Locate AdaptiveCpp compiler + run: | + adaptivecpp_prefix="$(brew --prefix adaptivecpp)" + tbb_prefix="$(brew --prefix tbb)" + echo "ITLABAI_CC=$(xcrun --find clang)" >> "$GITHUB_ENV" + echo "ITLABAI_CXX=$(command -v acpp)" >> "$GITHUB_ENV" + echo "ITLABAI_CMAKE_PREFIX_PATH=$adaptivecpp_prefix" >> "$GITHUB_ENV" + echo "ITLABAI_TBB_DIR=$tbb_prefix" >> "$GITHUB_ENV" + echo "$adaptivecpp_prefix/bin" >> "$GITHUB_PATH" + + - name: Configure + run: | + cmake -S . -B build -G Ninja \ + -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ + -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ + -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ + -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ + -DITLABAI_ENABLE_OPENMP=OFF \ + -DITLABAI_ENABLE_OPENCV_APPS=OFF \ + -DITLABAI_BUILD_TESTS=OFF \ + -DITLABAI_TBB_DIR="${ITLABAI_TBB_DIR}" \ + -DITLABAI_ENABLE_SYCL=ON \ + -DITLABAI_SYCL_TARGETS=omp + + - name: Build + run: cmake --build build --parallel + + - name: Smoke test + run: ctest --test-dir build --output-on-failure -R '^SYCL\.Example$' diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 2c5010334..43e3b8060 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -3,7 +3,21 @@ add_subdirectory(googletest) set(DNNL_CPU_RUNTIME "TBB" CACHE STRING "oneDNN CPU threading runtime") if(ITLABAI_TBB_DIR) - set(TBB_DIR "${ITLABAI_TBB_DIR}/lib/cmake/tbb" CACHE PATH + set(itlabai_tbb_config_dir "") + + if(EXISTS "${ITLABAI_TBB_DIR}/lib/cmake/tbb/TBBConfig.cmake") + set(itlabai_tbb_config_dir "${ITLABAI_TBB_DIR}/lib/cmake/tbb") + elseif(EXISTS "${ITLABAI_TBB_DIR}/lib/cmake/TBB/TBBConfig.cmake") + set(itlabai_tbb_config_dir "${ITLABAI_TBB_DIR}/lib/cmake/TBB") + endif() + + if(NOT itlabai_tbb_config_dir) + message(FATAL_ERROR + "ITLABAI_TBB_DIR must contain lib/cmake/tbb/TBBConfig.cmake " + "or lib/cmake/TBB/TBBConfig.cmake") + endif() + + set(TBB_DIR "${itlabai_tbb_config_dir}" CACHE PATH "Path to the prebuilt oneTBB CMake package" FORCE) find_package(TBB REQUIRED CONFIG) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e5603d76..2cb10f792 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,27 +56,50 @@ endif() add_library(itlabai_sycl INTERFACE) if(ITLABAI_ENABLE_SYCL) + get_filename_component(ITLABAI_SYCL_COMPILER_NAME + "${CMAKE_CXX_COMPILER}" NAME) + string(TOLOWER "${ITLABAI_SYCL_COMPILER_NAME}" + ITLABAI_SYCL_COMPILER_NAME_LOWER) + include(CheckCXXCompilerFlag) - check_cxx_compiler_flag("-fsycl" ITLABAI_COMPILER_SUPPORTS_FSYCL) + if(ITLABAI_SYCL_COMPILER_NAME_LOWER STREQUAL "acpp" + OR ITLABAI_SYCL_COMPILER_NAME_LOWER STREQUAL "syclcc") + set(ITLABAI_COMPILER_SUPPORTS_FSYCL ON) + set(ITLABAI_SYCL_USES_WRAPPER ON) + else() + check_cxx_compiler_flag("-fsycl" ITLABAI_COMPILER_SUPPORTS_FSYCL) + set(ITLABAI_SYCL_USES_WRAPPER OFF) + endif() if(NOT ITLABAI_COMPILER_SUPPORTS_FSYCL) message(FATAL_ERROR "ITLABAI_ENABLE_SYCL=ON requires a compiler with -fsycl support") endif() - target_compile_options(itlabai_sycl INTERFACE - $<$:-fsycl> - ) - target_link_options(itlabai_sycl INTERFACE -fsycl) + if(NOT ITLABAI_SYCL_USES_WRAPPER) + target_compile_options(itlabai_sycl INTERFACE + $<$:-fsycl> + ) + target_link_options(itlabai_sycl INTERFACE -fsycl) + endif() target_compile_definitions(itlabai_sycl INTERFACE ITLABAI_HAS_SYCL=1) if(ITLABAI_SYCL_TARGETS) - target_compile_options(itlabai_sycl INTERFACE - $<$:-fsycl-targets=${ITLABAI_SYCL_TARGETS}> - ) - target_link_options(itlabai_sycl INTERFACE - -fsycl-targets=${ITLABAI_SYCL_TARGETS} - ) + if(ITLABAI_SYCL_USES_WRAPPER) + target_compile_options(itlabai_sycl INTERFACE + $<$:--acpp-targets=${ITLABAI_SYCL_TARGETS}> + ) + target_link_options(itlabai_sycl INTERFACE + --acpp-targets=${ITLABAI_SYCL_TARGETS} + ) + else() + target_compile_options(itlabai_sycl INTERFACE + $<$:-fsycl-targets=${ITLABAI_SYCL_TARGETS}> + ) + target_link_options(itlabai_sycl INTERFACE + -fsycl-targets=${ITLABAI_SYCL_TARGETS} + ) + endif() endif() endif() diff --git a/include/parallel/backends.hpp b/include/parallel/backends.hpp index 6c5bcd996..5e57a10e3 100644 --- a/include/parallel/backends.hpp +++ b/include/parallel/backends.hpp @@ -120,6 +120,7 @@ inline void impl_omp(std::size_t count, inline void impl_omp(std::size_t count, const std::function& func, const Options& opt) { + static_cast(opt); impl_seq(count, func); } #endif From e0b875bd14fb57cdbdb4ab40e33187fefe6f6c76 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 01:40:54 +0100 Subject: [PATCH 013/104] Run macOS SYCL job in parallel --- .github/workflows/sycl-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 4e3eae986..07d76fa24 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -244,7 +244,6 @@ jobs: build-sycl-macos-arm64: name: macos-arm64 / ${{ matrix.build_type }} runs-on: macos-15 - needs: build-sycl-x86 timeout-minutes: 360 strategy: fail-fast: true From b01990cc55c7665f5d0208eaf7017dc28c20020d Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 02:05:03 +0100 Subject: [PATCH 014/104] Enable ccache and full test runs in SYCL CI --- .github/workflows/sycl-ci.yml | 43 ++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 07d76fa24..31c150f4d 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -40,6 +40,19 @@ jobs: - name: Setup Ninja uses: seanmiddleditch/gha-setup-ninja@v6 + - name: Setup ccache + if: runner.os != 'Windows' + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ccache-${{ github.job }}-${{ matrix.platform }}-${{ matrix.build_type }} + max-size: 2G + + - name: Setup ccache + if: runner.os == 'Windows' + uses: Chocobo1/setup-ccache-action@v1 + with: + windows_compile_environment: msvc + - name: Setup MSVC environment if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 @@ -123,6 +136,7 @@ jobs: 7z x -y "-o$opencv_extract_dir" "$opencv_archive" echo "ITLABAI_OPENCV_DIR=$(cygpath -m "$opencv_extract_dir/opencv/build/x64/vc16/lib")" >> "$GITHUB_ENV" + echo "$(cygpath -m "$opencv_extract_dir/opencv/build/x64/vc16/bin")" >> "$GITHUB_PATH" - name: Download oneTBB release binaries run: | @@ -221,13 +235,15 @@ jobs: - name: Configure run: | cmake -S . -B build -G Ninja \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ -DITLABAI_ENABLE_OPENMP=OFF \ -DITLABAI_ENABLE_OPENCV_APPS="${ITLABAI_ENABLE_OPENCV_APPS}" \ - -DITLABAI_BUILD_TESTS=OFF \ + -DITLABAI_BUILD_TESTS=ON \ -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR}" \ -DITLABAI_TBB_DIR="${ITLABAI_TBB_DIR}" \ -DITLABAI_ENABLE_SYCL=ON \ @@ -236,10 +252,10 @@ jobs: - name: Build run: cmake --build build --parallel - - name: Smoke test + - name: Test run: | ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" \ - ctest --test-dir build --output-on-failure -R '^SYCL\.Example$' + ctest --test-dir build --output-on-failure --parallel build-sycl-macos-arm64: name: macos-arm64 / ${{ matrix.build_type }} @@ -264,30 +280,41 @@ jobs: - name: Setup Ninja uses: seanmiddleditch/gha-setup-ninja@v6 + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ccache-${{ github.job }}-${{ matrix.build_type }} + max-size: 2G + - name: Install macOS prerequisites run: | - brew install adaptivecpp tbb + brew install adaptivecpp opencv tbb - name: Locate AdaptiveCpp compiler run: | adaptivecpp_prefix="$(brew --prefix adaptivecpp)" + opencv_prefix="$(brew --prefix opencv)" tbb_prefix="$(brew --prefix tbb)" echo "ITLABAI_CC=$(xcrun --find clang)" >> "$GITHUB_ENV" echo "ITLABAI_CXX=$(command -v acpp)" >> "$GITHUB_ENV" echo "ITLABAI_CMAKE_PREFIX_PATH=$adaptivecpp_prefix" >> "$GITHUB_ENV" + echo "ITLABAI_OPENCV_DIR=$opencv_prefix/lib/cmake/opencv4" >> "$GITHUB_ENV" echo "ITLABAI_TBB_DIR=$tbb_prefix" >> "$GITHUB_ENV" echo "$adaptivecpp_prefix/bin" >> "$GITHUB_PATH" - name: Configure run: | cmake -S . -B build -G Ninja \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ -DITLABAI_ENABLE_OPENMP=OFF \ - -DITLABAI_ENABLE_OPENCV_APPS=OFF \ - -DITLABAI_BUILD_TESTS=OFF \ + -DITLABAI_ENABLE_OPENCV_APPS=ON \ + -DITLABAI_BUILD_TESTS=ON \ + -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR}" \ -DITLABAI_TBB_DIR="${ITLABAI_TBB_DIR}" \ -DITLABAI_ENABLE_SYCL=ON \ -DITLABAI_SYCL_TARGETS=omp @@ -295,5 +322,5 @@ jobs: - name: Build run: cmake --build build --parallel - - name: Smoke test - run: ctest --test-dir build --output-on-failure -R '^SYCL\.Example$' + - name: Test + run: ctest --test-dir build --output-on-failure --parallel From def232730ebc73d6ac1c5cb9b35cdf4e411ab746 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 05:12:20 +0100 Subject: [PATCH 015/104] Fix Windows SYCL tests with clang-cl --- 3rdparty/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 43e3b8060..1274e0460 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -1,5 +1,13 @@ add_subdirectory(googletest) +if(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") + foreach(itlabai_gtest_target IN ITEMS gtest gtest_main) + if(TARGET ${itlabai_gtest_target}) + target_compile_options(${itlabai_gtest_target} PRIVATE -Wno-character-conversion) + endif() + endforeach() +endif() + set(DNNL_CPU_RUNTIME "TBB" CACHE STRING "oneDNN CPU threading runtime") if(ITLABAI_TBB_DIR) From 2326b9f325c620f364a305a7ce181b7599c81940 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 05:23:59 +0100 Subject: [PATCH 016/104] Fix Windows googletest targets with clang-cl --- 3rdparty/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 1274e0460..d678b69f3 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -1,7 +1,7 @@ add_subdirectory(googletest) if(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") - foreach(itlabai_gtest_target IN ITEMS gtest gtest_main) + foreach(itlabai_gtest_target IN ITEMS gtest gtest_main gmock gmock_main) if(TARGET ${itlabai_gtest_target}) target_compile_options(${itlabai_gtest_target} PRIVATE -Wno-character-conversion) endif() From 83ba14c665a387c064866b47659fb3b9fb18c420 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 05:29:31 +0100 Subject: [PATCH 017/104] Fix native_cpu SYCL builds on Windows --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cb10f792..dba3ec360 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,14 @@ if(ITLABAI_ENABLE_SYCL) ) endif() endif() + + if(NOT ITLABAI_SYCL_USES_WRAPPER + AND ITLABAI_SYCL_TARGETS MATCHES "(^|,)native_cpu($|,)") + target_compile_options(itlabai_sycl INTERFACE + $<$:-fno-sycl-libspirv> + ) + target_link_options(itlabai_sycl INTERFACE -fno-sycl-libspirv) + endif() endif() include_directories("include") From 5fc4d9f460460b0de2bc3f8dea5a9d106c287872 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 05:43:19 +0100 Subject: [PATCH 018/104] Fix x86 SYCL OpenCL runtime setup --- .github/workflows/sycl-ci.yml | 23 +++++++++++++++++++---- CMakeLists.txt | 7 ------- include/perf/benchmarking.hpp | 13 +++++++++++++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 31c150f4d..1343c1f64 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -12,6 +12,7 @@ env: INTEL_LLVM_TAG: v6.3.0 OPENCV_TAG: 4.13.0 TBB_TAG: v2022.3.0 + INTEL_OPENCL_CPU_RUNTIME_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/ad824c04-01c8-4ae5-b5e8-164a04f67609/w_opencl_runtime_p_2025.3.1.762.exe jobs: build-sycl-x86: @@ -63,8 +64,8 @@ jobs: linux-x86_64) echo "TOOLCHAIN_ASSET=sycl_linux.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-lin.tgz" >> "$GITHUB_ENV" - echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" - echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" + echo "SYCL_TARGETS=spir64" >> "$GITHUB_ENV" + echo "DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" echo "ITLABAI_OPENCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4" >> "$GITHUB_ENV" ;; @@ -72,8 +73,8 @@ jobs: echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-win.zip" >> "$GITHUB_ENV" echo "OPENCV_ASSET=opencv-4.13.0-windows.exe" >> "$GITHUB_ENV" - echo "SYCL_TARGETS=native_cpu" >> "$GITHUB_ENV" - echo "DEVICE_SELECTOR=native_cpu:cpu" >> "$GITHUB_ENV" + echo "SYCL_TARGETS=spir64" >> "$GITHUB_ENV" + echo "DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" ;; *) @@ -138,6 +139,20 @@ jobs: echo "ITLABAI_OPENCV_DIR=$(cygpath -m "$opencv_extract_dir/opencv/build/x64/vc16/lib")" >> "$GITHUB_ENV" echo "$(cygpath -m "$opencv_extract_dir/opencv/build/x64/vc16/bin")" >> "$GITHUB_PATH" + - name: Install Intel OpenCL CPU runtime + if: runner.os == 'Windows' + run: | + runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" + runtime_archive="$runner_temp_dir/intel-opencl-runtime.exe" + runtime_extract_dir="$runner_temp_dir/intel-opencl-runtime" + runtime_msi="$runtime_extract_dir/w_opencl_runtime_p_2025.3.1.762.msi" + + curl -fsSL "${INTEL_OPENCL_CPU_RUNTIME_URL}" -o "$runtime_archive" + 7z x -y "-o$runtime_extract_dir" "$runtime_archive" + + powershell -NoProfile -Command \ + "Start-Process msiexec.exe -Wait -ArgumentList '/i', '$(cygpath -w "$runtime_msi")', '/qn', '/norestart'" + - name: Download oneTBB release binaries run: | if [[ "$RUNNER_OS" == "Windows" ]]; then diff --git a/CMakeLists.txt b/CMakeLists.txt index dba3ec360..5224ec0ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,13 +102,6 @@ if(ITLABAI_ENABLE_SYCL) endif() endif() - if(NOT ITLABAI_SYCL_USES_WRAPPER - AND ITLABAI_SYCL_TARGETS MATCHES "(^|,)native_cpu($|,)") - target_compile_options(itlabai_sycl INTERFACE - $<$:-fno-sycl-libspirv> - ) - target_link_options(itlabai_sycl INTERFACE -fno-sycl-libspirv) - endif() endif() include_directories("include") diff --git a/include/perf/benchmarking.hpp b/include/perf/benchmarking.hpp index e63b57c6e..f886c0d6d 100644 --- a/include/perf/benchmarking.hpp +++ b/include/perf/benchmarking.hpp @@ -1,7 +1,10 @@ // Using chrono for good measurements and parallelism support #pragma once + +#if defined(HAS_OPENMP) #include +#endif #include #include @@ -26,10 +29,15 @@ DurationContainerType elapsed_time(Function&& func, Args&&... args) { // returns time in seconds template double elapsed_time_omp(Function&& func, Args&&... args) { +#if defined(HAS_OPENMP) double start = omp_get_wtime(); std::forward(func)(std::forward(args)...); double end = omp_get_wtime(); return end - start; +#else + return elapsed_time( + std::forward(func), std::forward(args)...); +#endif } template double elapsed_time_omp_avg(const size_t iters, Function&& func, Args&&... args) { +#if defined(HAS_OPENMP) double start = omp_get_wtime(); for (size_t i = 0; i < iters; i++) { std::forward(func)(std::forward(args)...); } double end = omp_get_wtime(); return (end - start) / iters; +#else + return elapsed_time_avg( + iters, std::forward(func), std::forward(args)...); +#endif } template Date: Tue, 17 Mar 2026 05:49:05 +0100 Subject: [PATCH 019/104] Fix SYCL example warnings with Clang --- app/SYCL/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 73efb7dd1..eef3fb36b 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -1,5 +1,8 @@ add_executable(SYCL_Example sycl_example.cpp) target_link_libraries(SYCL_Example PRIVATE layers_lib itlabai_sycl) +target_compile_options(SYCL_Example PRIVATE + $<$:-Wno-unused-parameter> +) add_test(NAME SYCL.Example COMMAND SYCL_Example) set_tests_properties(SYCL.Example PROPERTIES From 1cca4ed5472053f61cf1249a375c6f7c4c9f6546 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 05:56:09 +0100 Subject: [PATCH 020/104] Isolate SYCL kernel compilation --- app/SYCL/CMakeLists.txt | 16 +++++++++++-- app/SYCL/sycl_example.cpp | 38 +++++++------------------------ app/SYCL/sycl_kernel.cpp | 47 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 app/SYCL/sycl_kernel.cpp diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index eef3fb36b..05bb3916e 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -1,5 +1,17 @@ -add_executable(SYCL_Example sycl_example.cpp) -target_link_libraries(SYCL_Example PRIVATE layers_lib itlabai_sycl) +add_library(SYCL_Example_Kernel OBJECT sycl_kernel.cpp) +target_link_libraries(SYCL_Example_Kernel PRIVATE itlabai_sycl) +target_compile_options(SYCL_Example_Kernel PRIVATE + $<$:-Wno-unused-parameter> +) + +add_executable(SYCL_Example + sycl_example.cpp + $ +) +target_link_libraries(SYCL_Example PRIVATE layers_lib) +target_link_options(SYCL_Example PRIVATE + $ +) target_compile_options(SYCL_Example PRIVATE $<$:-Wno-unused-parameter> ) diff --git a/app/SYCL/sycl_example.cpp b/app/SYCL/sycl_example.cpp index a7dd35e5b..7d0c55712 100644 --- a/app/SYCL/sycl_example.cpp +++ b/app/SYCL/sycl_example.cpp @@ -1,9 +1,7 @@ #include #include -#include #include #include -#include #include #include "graph/runtime_options.hpp" @@ -18,6 +16,11 @@ bool almost_equal(float lhs, float rhs) { } // namespace +bool run_sycl_kernel(const std::vector& input, + std::vector& output, + std::ostream& log, + std::ostream& err); + int main() { try { using namespace it_lab_ai; @@ -39,32 +42,10 @@ int main() { return 1; } - auto async_handler = [](sycl::exception_list exceptions) { - for (const std::exception_ptr& exception : exceptions) { - std::rethrow_exception(exception); - } - }; - - sycl::queue queue(sycl::default_selector_v, async_handler); - std::cout << "SYCL device: " - << queue.get_device().get_info() - << '\n'; - const std::size_t count = relu_output.size(); - std::vector sycl_output = relu_output; - - { - sycl::buffer values_buffer(sycl_output.data(), - sycl::range<1>(count)); - - queue.submit([&](sycl::handler& handler) { - auto values = - values_buffer.get_access(handler); - handler.parallel_for(sycl::range<1>(count), [=](sycl::id<1> index) { - values[index] = values[index] * 2.0F + 1.0F; - }); - }); - queue.wait_and_throw(); + std::vector sycl_output; + if (!run_sycl_kernel(relu_output, sycl_output, std::cout, std::cerr)) { + return 1; } const std::vector expected_sycl = {1.0F, 1.0F, 1.0F, 3.0F, 5.0F}; @@ -77,9 +58,6 @@ int main() { std::cout << "SYCL example completed successfully" << '\n'; return 0; - } catch (const sycl::exception& exception) { - std::cerr << "SYCL error: " << exception.what() << '\n'; - return 1; } catch (const std::exception& exception) { std::cerr << "Error: " << exception.what() << '\n'; return 1; diff --git a/app/SYCL/sycl_kernel.cpp b/app/SYCL/sycl_kernel.cpp new file mode 100644 index 000000000..5d72fd213 --- /dev/null +++ b/app/SYCL/sycl_kernel.cpp @@ -0,0 +1,47 @@ +#include +#include +#include +#include + +namespace { + +void rethrow_async_exceptions(sycl::exception_list exceptions) { + for (const std::exception_ptr& exception : exceptions) { + std::rethrow_exception(exception); + } +} + +} // namespace + +bool run_sycl_kernel(const std::vector& input, + std::vector& output, + std::ostream& log, + std::ostream& err) { + try { + sycl::queue queue(sycl::default_selector_v, rethrow_async_exceptions); + log << "SYCL device: " + << queue.get_device().get_info() << '\n'; + + output = input; + const std::size_t count = output.size(); + + sycl::buffer values_buffer(output.data(), sycl::range<1>(count)); + + queue.submit([&](sycl::handler& handler) { + auto values = + values_buffer.get_access(handler); + handler.parallel_for(sycl::range<1>(count), [=](sycl::id<1> index) { + values[index] = values[index] * 2.0F + 1.0F; + }); + }); + queue.wait_and_throw(); + + return true; + } catch (const sycl::exception& exception) { + err << "SYCL error: " << exception.what() << '\n'; + return false; + } catch (const std::exception& exception) { + err << "Error: " << exception.what() << '\n'; + return false; + } +} From ab1fc950f754860f0ccbb98aadc45549630cb07f Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 06:04:04 +0100 Subject: [PATCH 021/104] Use x86_64 AOT SYCL target in CI --- .github/workflows/sycl-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 1343c1f64..06f1612d7 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -64,7 +64,7 @@ jobs: linux-x86_64) echo "TOOLCHAIN_ASSET=sycl_linux.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-lin.tgz" >> "$GITHUB_ENV" - echo "SYCL_TARGETS=spir64" >> "$GITHUB_ENV" + echo "SYCL_TARGETS=spir64_x86_64" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" echo "ITLABAI_OPENCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4" >> "$GITHUB_ENV" @@ -73,7 +73,7 @@ jobs: echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-win.zip" >> "$GITHUB_ENV" echo "OPENCV_ASSET=opencv-4.13.0-windows.exe" >> "$GITHUB_ENV" - echo "SYCL_TARGETS=spir64" >> "$GITHUB_ENV" + echo "SYCL_TARGETS=spir64_x86_64" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" ;; From 49d9dbd466d2c52918589517a27e721dc6c2b648 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 06:10:50 +0100 Subject: [PATCH 022/104] Fix Linux SYCL debug runtime path --- .github/workflows/sycl-ci.yml | 2 +- app/SYCL/CMakeLists.txt | 2 ++ app/SYCL/sycl_example.cpp | 3 +-- app/SYCL/sycl_kernel.cpp | 3 +-- include/perf/benchmarking.hpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 06f1612d7..42b6c40a8 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -64,7 +64,7 @@ jobs: linux-x86_64) echo "TOOLCHAIN_ASSET=sycl_linux.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-lin.tgz" >> "$GITHUB_ENV" - echo "SYCL_TARGETS=spir64_x86_64" >> "$GITHUB_ENV" + echo "SYCL_TARGETS=spir64" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" echo "ITLABAI_OPENCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4" >> "$GITHUB_ENV" diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 05bb3916e..789b13834 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -2,6 +2,8 @@ add_library(SYCL_Example_Kernel OBJECT sycl_kernel.cpp) target_link_libraries(SYCL_Example_Kernel PRIVATE itlabai_sycl) target_compile_options(SYCL_Example_Kernel PRIVATE $<$:-Wno-unused-parameter> + $<$,$,$>:-O2> + $<$,$,$>:-g0> ) add_executable(SYCL_Example diff --git a/app/SYCL/sycl_example.cpp b/app/SYCL/sycl_example.cpp index 7d0c55712..79e43a852 100644 --- a/app/SYCL/sycl_example.cpp +++ b/app/SYCL/sycl_example.cpp @@ -17,8 +17,7 @@ bool almost_equal(float lhs, float rhs) { } // namespace bool run_sycl_kernel(const std::vector& input, - std::vector& output, - std::ostream& log, + std::vector& output, std::ostream& log, std::ostream& err); int main() { diff --git a/app/SYCL/sycl_kernel.cpp b/app/SYCL/sycl_kernel.cpp index 5d72fd213..04fa471b8 100644 --- a/app/SYCL/sycl_kernel.cpp +++ b/app/SYCL/sycl_kernel.cpp @@ -14,8 +14,7 @@ void rethrow_async_exceptions(sycl::exception_list exceptions) { } // namespace bool run_sycl_kernel(const std::vector& input, - std::vector& output, - std::ostream& log, + std::vector& output, std::ostream& log, std::ostream& err) { try { sycl::queue queue(sycl::default_selector_v, rethrow_async_exceptions); diff --git a/include/perf/benchmarking.hpp b/include/perf/benchmarking.hpp index f886c0d6d..84724ab8f 100644 --- a/include/perf/benchmarking.hpp +++ b/include/perf/benchmarking.hpp @@ -3,7 +3,7 @@ #pragma once #if defined(HAS_OPENMP) -#include +# include #endif #include From 416f09cf248b25267efd2059fc4efcea33d5f244 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 06:26:47 +0100 Subject: [PATCH 023/104] Use Intel OpenCL runtime in Linux SYCL CI --- .github/workflows/sycl-ci.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 42b6c40a8..eb284c053 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -95,10 +95,32 @@ jobs: libomp-dev \ ocl-icd-opencl-dev \ opencl-headers \ - pocl-opencl-icd \ python3 \ zstd + wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ + | gpg --dearmor \ + | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ + | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + sudo apt-get install -y intel-oneapi-runtime-opencl + + - name: Select Intel OpenCL ICD + if: runner.os == 'Linux' + run: | + intel_icd_dir="$RUNNER_TEMP/intel-opencl-icd" + intel_icd_file="$(grep -il 'intel' /etc/OpenCL/vendors/*.icd | head -n 1 || true)" + if [[ -z "$intel_icd_file" ]]; then + echo "Unable to locate Intel OpenCL ICD file under /etc/OpenCL/vendors" >&2 + ls -la /etc/OpenCL/vendors >&2 + exit 1 + fi + + mkdir -p "$intel_icd_dir" + cp "$intel_icd_file" "$intel_icd_dir/" + echo "OCL_ICD_VENDORS=$intel_icd_dir" >> "$GITHUB_ENV" + - name: Download Intel SYCL toolchain binaries run: | if [[ "$RUNNER_OS" == "Windows" ]]; then From 5e9ad6c3767df9986ea17b576f5bab1a967db854 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 06:35:12 +0100 Subject: [PATCH 024/104] Use a named SYCL kernel in example --- app/SYCL/sycl_kernel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/SYCL/sycl_kernel.cpp b/app/SYCL/sycl_kernel.cpp index 04fa471b8..e0c57fde6 100644 --- a/app/SYCL/sycl_kernel.cpp +++ b/app/SYCL/sycl_kernel.cpp @@ -3,6 +3,8 @@ #include #include +class SyclExampleTransformKernel; + namespace { void rethrow_async_exceptions(sycl::exception_list exceptions) { @@ -29,7 +31,8 @@ bool run_sycl_kernel(const std::vector& input, queue.submit([&](sycl::handler& handler) { auto values = values_buffer.get_access(handler); - handler.parallel_for(sycl::range<1>(count), [=](sycl::id<1> index) { + handler.parallel_for(sycl::range<1>(count), + [=](sycl::id<1> index) { values[index] = values[index] * 2.0F + 1.0F; }); }); From a5c6a90f69e9e5400414a774358f50b5c8906f5f Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 06:44:46 +0100 Subject: [PATCH 025/104] Build SYCL example kernel in executable target --- app/SYCL/CMakeLists.txt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 789b13834..1131d6657 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -1,14 +1,6 @@ -add_library(SYCL_Example_Kernel OBJECT sycl_kernel.cpp) -target_link_libraries(SYCL_Example_Kernel PRIVATE itlabai_sycl) -target_compile_options(SYCL_Example_Kernel PRIVATE - $<$:-Wno-unused-parameter> - $<$,$,$>:-O2> - $<$,$,$>:-g0> -) - add_executable(SYCL_Example sycl_example.cpp - $ + sycl_kernel.cpp ) target_link_libraries(SYCL_Example PRIVATE layers_lib) target_link_options(SYCL_Example PRIVATE @@ -17,6 +9,15 @@ target_link_options(SYCL_Example PRIVATE target_compile_options(SYCL_Example PRIVATE $<$:-Wno-unused-parameter> ) +set_property(SOURCE sycl_kernel.cpp APPEND PROPERTY COMPILE_OPTIONS + $ + $<$:-Wno-unused-parameter> + $<$,$,$>:-O2> + $<$,$,$>:-g0> +) +set_property(SOURCE sycl_kernel.cpp APPEND PROPERTY COMPILE_DEFINITIONS + $ +) add_test(NAME SYCL.Example COMMAND SYCL_Example) set_tests_properties(SYCL.Example PROPERTIES From a3d557a44ba8dbc1d4c1bf2f6e5c7aa40ee4b13a Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 06:50:17 +0100 Subject: [PATCH 026/104] Keep iostream out of SYCL kernel translation unit --- app/SYCL/sycl_example.cpp | 17 ++++++++++++++--- app/SYCL/sycl_kernel.cpp | 13 ++++++------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/SYCL/sycl_example.cpp b/app/SYCL/sycl_example.cpp index 79e43a852..501653a51 100644 --- a/app/SYCL/sycl_example.cpp +++ b/app/SYCL/sycl_example.cpp @@ -17,8 +17,8 @@ bool almost_equal(float lhs, float rhs) { } // namespace bool run_sycl_kernel(const std::vector& input, - std::vector& output, std::ostream& log, - std::ostream& err); + std::vector& output, std::string& device_name, + std::string& error_message); int main() { try { @@ -43,10 +43,21 @@ int main() { const std::size_t count = relu_output.size(); std::vector sycl_output; - if (!run_sycl_kernel(relu_output, sycl_output, std::cout, std::cerr)) { + std::string device_name; + std::string error_message; + if (!run_sycl_kernel(relu_output, sycl_output, device_name, + error_message)) { + if (!device_name.empty()) { + std::cout << "SYCL device: " << device_name << '\n'; + } + if (!error_message.empty()) { + std::cerr << error_message << '\n'; + } return 1; } + std::cout << "SYCL device: " << device_name << '\n'; + const std::vector expected_sycl = {1.0F, 1.0F, 1.0F, 3.0F, 5.0F}; for (std::size_t i = 0; i < count; ++i) { if (!almost_equal(sycl_output[i], expected_sycl[i])) { diff --git a/app/SYCL/sycl_kernel.cpp b/app/SYCL/sycl_kernel.cpp index e0c57fde6..ca393bf77 100644 --- a/app/SYCL/sycl_kernel.cpp +++ b/app/SYCL/sycl_kernel.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -16,12 +16,11 @@ void rethrow_async_exceptions(sycl::exception_list exceptions) { } // namespace bool run_sycl_kernel(const std::vector& input, - std::vector& output, std::ostream& log, - std::ostream& err) { + std::vector& output, std::string& device_name, + std::string& error_message) { try { sycl::queue queue(sycl::default_selector_v, rethrow_async_exceptions); - log << "SYCL device: " - << queue.get_device().get_info() << '\n'; + device_name = queue.get_device().get_info(); output = input; const std::size_t count = output.size(); @@ -40,10 +39,10 @@ bool run_sycl_kernel(const std::vector& input, return true; } catch (const sycl::exception& exception) { - err << "SYCL error: " << exception.what() << '\n'; + error_message = std::string("SYCL error: ") + exception.what(); return false; } catch (const std::exception& exception) { - err << "Error: " << exception.what() << '\n'; + error_message = std::string("Error: ") + exception.what(); return false; } } From 3383ba29f8087bcc190979f717e2a79a32e7854a Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 06:56:19 +0100 Subject: [PATCH 027/104] Move SYCL queue setup to host example --- app/SYCL/sycl_example.cpp | 33 +++++++++++------------ app/SYCL/sycl_kernel.cpp | 57 +++++++++++---------------------------- 2 files changed, 31 insertions(+), 59 deletions(-) diff --git a/app/SYCL/sycl_example.cpp b/app/SYCL/sycl_example.cpp index 501653a51..5893d51f8 100644 --- a/app/SYCL/sycl_example.cpp +++ b/app/SYCL/sycl_example.cpp @@ -1,7 +1,9 @@ #include #include +#include #include #include +#include #include #include "graph/runtime_options.hpp" @@ -14,11 +16,16 @@ bool almost_equal(float lhs, float rhs) { return std::fabs(lhs - rhs) < 1.0e-6F; } +void rethrow_async_exceptions(sycl::exception_list exceptions) { + for (const std::exception_ptr& exception : exceptions) { + std::rethrow_exception(exception); + } +} + } // namespace -bool run_sycl_kernel(const std::vector& input, - std::vector& output, std::string& device_name, - std::string& error_message); +void run_sycl_kernel(sycl::queue& queue, const float* input, float* output, + std::size_t count); int main() { try { @@ -42,21 +49,13 @@ int main() { } const std::size_t count = relu_output.size(); - std::vector sycl_output; - std::string device_name; - std::string error_message; - if (!run_sycl_kernel(relu_output, sycl_output, device_name, - error_message)) { - if (!device_name.empty()) { - std::cout << "SYCL device: " << device_name << '\n'; - } - if (!error_message.empty()) { - std::cerr << error_message << '\n'; - } - return 1; - } + sycl::queue queue(sycl::default_selector_v, rethrow_async_exceptions); + std::cout << "SYCL device: " + << queue.get_device().get_info() + << '\n'; - std::cout << "SYCL device: " << device_name << '\n'; + std::vector sycl_output(count); + run_sycl_kernel(queue, relu_output.data(), sycl_output.data(), count); const std::vector expected_sycl = {1.0F, 1.0F, 1.0F, 3.0F, 5.0F}; for (std::size_t i = 0; i < count; ++i) { diff --git a/app/SYCL/sycl_kernel.cpp b/app/SYCL/sycl_kernel.cpp index ca393bf77..490cf7276 100644 --- a/app/SYCL/sycl_kernel.cpp +++ b/app/SYCL/sycl_kernel.cpp @@ -1,48 +1,21 @@ -#include -#include +#include #include -#include class SyclExampleTransformKernel; -namespace { - -void rethrow_async_exceptions(sycl::exception_list exceptions) { - for (const std::exception_ptr& exception : exceptions) { - std::rethrow_exception(exception); - } -} - -} // namespace - -bool run_sycl_kernel(const std::vector& input, - std::vector& output, std::string& device_name, - std::string& error_message) { - try { - sycl::queue queue(sycl::default_selector_v, rethrow_async_exceptions); - device_name = queue.get_device().get_info(); - - output = input; - const std::size_t count = output.size(); - - sycl::buffer values_buffer(output.data(), sycl::range<1>(count)); - - queue.submit([&](sycl::handler& handler) { - auto values = - values_buffer.get_access(handler); - handler.parallel_for(sycl::range<1>(count), - [=](sycl::id<1> index) { - values[index] = values[index] * 2.0F + 1.0F; - }); +void run_sycl_kernel(sycl::queue& queue, const float* input, float* output, + std::size_t count) { + sycl::buffer input_buffer(input, sycl::range<1>(count)); + sycl::buffer output_buffer(output, sycl::range<1>(count)); + + queue.submit([&](sycl::handler& handler) { + auto input_acc = input_buffer.get_access(handler); + auto output_acc = + output_buffer.get_access(handler); + handler.parallel_for(sycl::range<1>(count), + [=](sycl::id<1> index) { + output_acc[index] = input_acc[index] * 2.0F + 1.0F; }); - queue.wait_and_throw(); - - return true; - } catch (const sycl::exception& exception) { - error_message = std::string("SYCL error: ") + exception.what(); - return false; - } catch (const std::exception& exception) { - error_message = std::string("Error: ") + exception.what(); - return false; - } + }); + queue.wait_and_throw(); } From 946dc47f46850ecca98d2da457b36513017b3e5f Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 07:03:28 +0100 Subject: [PATCH 028/104] Expose SYCL headers to host example sources --- CMakeLists.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5224ec0ce..3f6d096e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,8 @@ add_library(itlabai_sycl INTERFACE) if(ITLABAI_ENABLE_SYCL) get_filename_component(ITLABAI_SYCL_COMPILER_NAME "${CMAKE_CXX_COMPILER}" NAME) + get_filename_component(ITLABAI_SYCL_COMPILER_DIR + "${CMAKE_CXX_COMPILER}" DIRECTORY) string(TOLOWER "${ITLABAI_SYCL_COMPILER_NAME}" ITLABAI_SYCL_COMPILER_NAME_LOWER) @@ -76,6 +78,29 @@ if(ITLABAI_ENABLE_SYCL) "ITLABAI_ENABLE_SYCL=ON requires a compiler with -fsycl support") endif() + set(ITLABAI_SYCL_INCLUDE_DIR "") + set(ITLABAI_SYCL_INCLUDE_CANDIDATES + "${ITLABAI_SYCL_COMPILER_DIR}/../include" + ) + foreach(ITLABAI_SYCL_PREFIX IN LISTS CMAKE_PREFIX_PATH) + list(APPEND ITLABAI_SYCL_INCLUDE_CANDIDATES + "${ITLABAI_SYCL_PREFIX}/include" + ) + endforeach() + foreach(ITLABAI_SYCL_INCLUDE_CANDIDATE + IN LISTS ITLABAI_SYCL_INCLUDE_CANDIDATES) + if(EXISTS "${ITLABAI_SYCL_INCLUDE_CANDIDATE}/sycl/sycl.hpp") + set(ITLABAI_SYCL_INCLUDE_DIR + "${ITLABAI_SYCL_INCLUDE_CANDIDATE}") + break() + endif() + endforeach() + if(ITLABAI_SYCL_INCLUDE_DIR) + target_include_directories(itlabai_sycl INTERFACE + "${ITLABAI_SYCL_INCLUDE_DIR}" + ) + endif() + if(NOT ITLABAI_SYCL_USES_WRAPPER) target_compile_options(itlabai_sycl INTERFACE $<$:-fsycl> From 0832580e623127f0d410925e2fd4f436da523dd0 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 10:11:50 +0100 Subject: [PATCH 029/104] Fix SYCL host includes and static analysis scope --- .github/workflows/static-analysis.yml | 3 ++- app/SYCL/CMakeLists.txt | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 985c29998..58752aea6 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -31,4 +31,5 @@ jobs: cmake --build build --parallel - name: Run clang-tidy run: | - clang-tidy app/**/*.cpp src/**/*.cpp -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build + mapfile -t files < <(find app src -name '*.cpp' ! -path 'app/SYCL/*' | sort) + clang-tidy "${files[@]}" -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 1131d6657..be30c8f92 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -3,6 +3,9 @@ add_executable(SYCL_Example sycl_kernel.cpp ) target_link_libraries(SYCL_Example PRIVATE layers_lib) +target_include_directories(SYCL_Example PRIVATE + $ +) target_link_options(SYCL_Example PRIVATE $ ) From ba1c422301371e02d46a70245be75cc06c0af44a Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 10:17:04 +0100 Subject: [PATCH 030/104] Suppress host-only SYCL header warnings --- app/SYCL/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index be30c8f92..72ee55e5d 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -12,6 +12,12 @@ target_link_options(SYCL_Example PRIVATE target_compile_options(SYCL_Example PRIVATE $<$:-Wno-unused-parameter> ) +set_property(SOURCE sycl_example.cpp APPEND PROPERTY COMPILE_OPTIONS + $<$:-Wno-deprecated-declarations> +) +set_property(SOURCE sycl_example.cpp APPEND PROPERTY COMPILE_DEFINITIONS + SYCL_DISABLE_FSYCL_SYCLHPP_WARNING=1 +) set_property(SOURCE sycl_kernel.cpp APPEND PROPERTY COMPILE_OPTIONS $ $<$:-Wno-unused-parameter> From 1ecf41b2be0ca19a9e8bf874e9f0035c5af2ec09 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 11:08:14 +0100 Subject: [PATCH 031/104] Fix Windows SYCL target selection --- .github/workflows/sycl-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index eb284c053..70eb2238c 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -73,7 +73,7 @@ jobs: echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" echo "TBB_ASSET=oneapi-tbb-2022.3.0-win.zip" >> "$GITHUB_ENV" echo "OPENCV_ASSET=opencv-4.13.0-windows.exe" >> "$GITHUB_ENV" - echo "SYCL_TARGETS=spir64_x86_64" >> "$GITHUB_ENV" + echo "SYCL_TARGETS=spir64" >> "$GITHUB_ENV" echo "DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV" echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" ;; From f849fb8463a98d001d6320c501335248764fc550 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 11:14:56 +0100 Subject: [PATCH 032/104] Prefer Intel SYCL Windows drivers --- .github/workflows/sycl-ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 70eb2238c..5751b76f9 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -206,27 +206,27 @@ jobs: - name: Locate SYCL compiler run: | if [[ "$RUNNER_OS" == "Windows" ]]; then - if [[ -x "$SYCL_ROOT/bin/icx-cl.exe" ]]; then - cc_path="$SYCL_ROOT/bin/icx-cl.exe" - elif [[ -x "$SYCL_ROOT/bin/clang-cl.exe" ]]; then - cc_path="$SYCL_ROOT/bin/clang-cl.exe" - elif [[ -x "$SYCL_ROOT/bin/icx.exe" ]]; then + if [[ -x "$SYCL_ROOT/bin/icx.exe" ]]; then cc_path="$SYCL_ROOT/bin/icx.exe" + elif [[ -x "$SYCL_ROOT/bin/icx-cl.exe" ]]; then + cc_path="$SYCL_ROOT/bin/icx-cl.exe" elif [[ -x "$SYCL_ROOT/bin/clang.exe" ]]; then cc_path="$SYCL_ROOT/bin/clang.exe" + elif [[ -x "$SYCL_ROOT/bin/clang-cl.exe" ]]; then + cc_path="$SYCL_ROOT/bin/clang-cl.exe" else echo "Unable to locate a C compiler in $SYCL_ROOT/bin" >&2 exit 1 fi - if [[ -x "$SYCL_ROOT/bin/icx-cl.exe" ]]; then - cxx_path="$SYCL_ROOT/bin/icx-cl.exe" - elif [[ -x "$SYCL_ROOT/bin/clang-cl.exe" ]]; then - cxx_path="$SYCL_ROOT/bin/clang-cl.exe" - elif [[ -x "$SYCL_ROOT/bin/icpx.exe" ]]; then + if [[ -x "$SYCL_ROOT/bin/icpx.exe" ]]; then cxx_path="$SYCL_ROOT/bin/icpx.exe" + elif [[ -x "$SYCL_ROOT/bin/icx-cl.exe" ]]; then + cxx_path="$SYCL_ROOT/bin/icx-cl.exe" elif [[ -x "$SYCL_ROOT/bin/clang++.exe" ]]; then cxx_path="$SYCL_ROOT/bin/clang++.exe" + elif [[ -x "$SYCL_ROOT/bin/clang-cl.exe" ]]; then + cxx_path="$SYCL_ROOT/bin/clang-cl.exe" else echo "Unable to locate a C++ compiler in $SYCL_ROOT/bin" >&2 exit 1 From ba9932baaacf7925168c8a3f01bc4860cd4321af Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 11:42:59 +0100 Subject: [PATCH 033/104] Disable Windows SYCL compiler launcher --- .github/workflows/sycl-ci.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 5751b76f9..85a03f891 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -271,9 +271,16 @@ jobs: - name: Configure run: | + launcher_args=() + if [[ "$RUNNER_OS" != "Windows" ]]; then + launcher_args+=( + -DCMAKE_C_COMPILER_LAUNCHER=ccache + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + ) + fi + cmake -S . -B build -G Ninja \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + "${launcher_args[@]}" \ -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ @@ -341,9 +348,16 @@ jobs: - name: Configure run: | + launcher_args=() + if [[ "$RUNNER_OS" != "Windows" ]]; then + launcher_args+=( + -DCMAKE_C_COMPILER_LAUNCHER=ccache + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + ) + fi + cmake -S . -B build -G Ninja \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + "${launcher_args[@]}" \ -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ From 2f57a79db9c49cdb7c49b7b6d922b11cebd24ec4 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 14:22:09 +0100 Subject: [PATCH 034/104] Fix Windows warning flags for icpx --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f6d096e4..be0d01dd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,7 +162,11 @@ if(MSVC) add_compile_options(/wd4267 /wd4244 /wd4127 /wd4324) endif() -if (NOT WIN32) +if(NOT WIN32 + OR (DEFINED CMAKE_C_COMPILER_FRONTEND_VARIANT + AND DEFINED CMAKE_CXX_COMPILER_FRONTEND_VARIANT + AND NOT CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" + AND NOT CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror") else() From 429a36bc17ceae62adf82a179fc983162e58bc4c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 15:32:23 +0100 Subject: [PATCH 035/104] Handle GNU-style Windows clang warnings --- CMakeLists.txt | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be0d01dd2..4b8c90855 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,11 +162,23 @@ if(MSVC) add_compile_options(/wd4267 /wd4244 /wd4127 /wd4324) endif() -if(NOT WIN32 - OR (DEFINED CMAKE_C_COMPILER_FRONTEND_VARIANT - AND DEFINED CMAKE_CXX_COMPILER_FRONTEND_VARIANT - AND NOT CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" - AND NOT CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) +get_filename_component(ITLABAI_C_COMPILER_NAME "${CMAKE_C_COMPILER}" NAME) +get_filename_component(ITLABAI_CXX_COMPILER_NAME "${CMAKE_CXX_COMPILER}" NAME) +string(TOLOWER "${ITLABAI_C_COMPILER_NAME}" ITLABAI_C_COMPILER_NAME_LOWER) +string(TOLOWER "${ITLABAI_CXX_COMPILER_NAME}" ITLABAI_CXX_COMPILER_NAME_LOWER) + +set(ITLABAI_WINDOWS_USES_MSVC_FRONTEND OFF) +if(WIN32 AND ( + ITLABAI_C_COMPILER_NAME_LOWER MATCHES "(^|-)cl(\\.exe)?$" + OR ITLABAI_C_COMPILER_NAME_LOWER MATCHES "clang-cl(\\.exe)?$" + OR ITLABAI_C_COMPILER_NAME_LOWER MATCHES "icx-cl(\\.exe)?$" + OR ITLABAI_CXX_COMPILER_NAME_LOWER MATCHES "(^|-)cl(\\.exe)?$" + OR ITLABAI_CXX_COMPILER_NAME_LOWER MATCHES "clang-cl(\\.exe)?$" + OR ITLABAI_CXX_COMPILER_NAME_LOWER MATCHES "icx-cl(\\.exe)?$")) + set(ITLABAI_WINDOWS_USES_MSVC_FRONTEND ON) +endif() + +if(NOT WIN32 OR NOT ITLABAI_WINDOWS_USES_MSVC_FRONTEND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror") else() From 5f82816f2e6e83f451e64f2ed4e6e6ed1581199d Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 16:09:48 +0100 Subject: [PATCH 036/104] Extract SYCL CI scripts --- .github/workflows/sycl-ci.yml | 277 +-------------------------------- scripts/ci/sycl-configure.sh | 28 ++++ scripts/ci/sycl-macos-setup.sh | 29 ++++ scripts/ci/sycl-test.sh | 11 ++ scripts/ci/sycl-x86-setup.sh | 198 +++++++++++++++++++++++ 5 files changed, 272 insertions(+), 271 deletions(-) create mode 100755 scripts/ci/sycl-configure.sh create mode 100755 scripts/ci/sycl-macos-setup.sh create mode 100755 scripts/ci/sycl-test.sh create mode 100755 scripts/ci/sycl-x86-setup.sh diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 85a03f891..7faa1b8c5 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -59,247 +59,16 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 - name: Prepare platform settings - run: | - case "${{ matrix.platform }}" in - linux-x86_64) - echo "TOOLCHAIN_ASSET=sycl_linux.tar.gz" >> "$GITHUB_ENV" - echo "TBB_ASSET=oneapi-tbb-2022.3.0-lin.tgz" >> "$GITHUB_ENV" - echo "SYCL_TARGETS=spir64" >> "$GITHUB_ENV" - echo "DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV" - echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" - echo "ITLABAI_OPENCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4" >> "$GITHUB_ENV" - ;; - windows-x86_64) - echo "TOOLCHAIN_ASSET=sycl_windows.tar.gz" >> "$GITHUB_ENV" - echo "TBB_ASSET=oneapi-tbb-2022.3.0-win.zip" >> "$GITHUB_ENV" - echo "OPENCV_ASSET=opencv-4.13.0-windows.exe" >> "$GITHUB_ENV" - echo "SYCL_TARGETS=spir64" >> "$GITHUB_ENV" - echo "DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV" - echo "ITLABAI_ENABLE_OPENCV_APPS=ON" >> "$GITHUB_ENV" - ;; - *) - echo "Unsupported platform: ${{ matrix.platform }}" >&2 - exit 1 - ;; - esac - - - name: Install Linux prerequisites - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y \ - build-essential \ - cmake \ - git \ - libopencv-dev \ - libomp-dev \ - ocl-icd-opencl-dev \ - opencl-headers \ - python3 \ - zstd - - wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ - | gpg --dearmor \ - | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null - echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ - | sudo tee /etc/apt/sources.list.d/oneAPI.list - sudo apt-get update - sudo apt-get install -y intel-oneapi-runtime-opencl - - - name: Select Intel OpenCL ICD - if: runner.os == 'Linux' - run: | - intel_icd_dir="$RUNNER_TEMP/intel-opencl-icd" - intel_icd_file="$(grep -il 'intel' /etc/OpenCL/vendors/*.icd | head -n 1 || true)" - if [[ -z "$intel_icd_file" ]]; then - echo "Unable to locate Intel OpenCL ICD file under /etc/OpenCL/vendors" >&2 - ls -la /etc/OpenCL/vendors >&2 - exit 1 - fi - - mkdir -p "$intel_icd_dir" - cp "$intel_icd_file" "$intel_icd_dir/" - echo "OCL_ICD_VENDORS=$intel_icd_dir" >> "$GITHUB_ENV" - - - name: Download Intel SYCL toolchain binaries - run: | - if [[ "$RUNNER_OS" == "Windows" ]]; then - runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" - else - runner_temp_dir="$RUNNER_TEMP" - fi - - mkdir -p "$runner_temp_dir/intel-sycl" - curl -fsSL \ - "https://github.com/intel/llvm/releases/download/${INTEL_LLVM_TAG}/${TOOLCHAIN_ASSET}" \ - -o "$runner_temp_dir/${TOOLCHAIN_ASSET}" - tar -xzf "$runner_temp_dir/${TOOLCHAIN_ASSET}" \ - -C "$runner_temp_dir/intel-sycl" - - sycl_root="$runner_temp_dir/intel-sycl" - - if [[ -d "$sycl_root/sycl_windows/bin" ]]; then - sycl_root="$sycl_root/sycl_windows" - elif [[ -d "$sycl_root/sycl_linux/bin" ]]; then - sycl_root="$sycl_root/sycl_linux" - fi - - echo "SYCL_ROOT=$sycl_root" >> "$GITHUB_ENV" - - - name: Download OpenCV release binaries - if: runner.os == 'Windows' - run: | - runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" - opencv_archive="$runner_temp_dir/${OPENCV_ASSET}" - opencv_extract_dir="$runner_temp_dir/opencv" - - curl -fsSL \ - "https://github.com/opencv/opencv/releases/download/${OPENCV_TAG}/${OPENCV_ASSET}" \ - -o "$opencv_archive" - 7z x -y "-o$opencv_extract_dir" "$opencv_archive" - - echo "ITLABAI_OPENCV_DIR=$(cygpath -m "$opencv_extract_dir/opencv/build/x64/vc16/lib")" >> "$GITHUB_ENV" - echo "$(cygpath -m "$opencv_extract_dir/opencv/build/x64/vc16/bin")" >> "$GITHUB_PATH" - - - name: Install Intel OpenCL CPU runtime - if: runner.os == 'Windows' - run: | - runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" - runtime_archive="$runner_temp_dir/intel-opencl-runtime.exe" - runtime_extract_dir="$runner_temp_dir/intel-opencl-runtime" - runtime_msi="$runtime_extract_dir/w_opencl_runtime_p_2025.3.1.762.msi" - - curl -fsSL "${INTEL_OPENCL_CPU_RUNTIME_URL}" -o "$runtime_archive" - 7z x -y "-o$runtime_extract_dir" "$runtime_archive" - - powershell -NoProfile -Command \ - "Start-Process msiexec.exe -Wait -ArgumentList '/i', '$(cygpath -w "$runtime_msi")', '/qn', '/norestart'" - - - name: Download oneTBB release binaries - run: | - if [[ "$RUNNER_OS" == "Windows" ]]; then - runner_temp_dir="$(cygpath -u "$RUNNER_TEMP")" - tbb_archive="$runner_temp_dir/${TBB_ASSET}" - tbb_extract_dir="$runner_temp_dir/oneapi-tbb" - - curl -fsSL \ - "https://github.com/uxlfoundation/oneTBB/releases/download/${TBB_TAG}/${TBB_ASSET}" \ - -o "$tbb_archive" - 7z x -y "-o$tbb_extract_dir" "$tbb_archive" - - echo "ITLABAI_TBB_DIR=$(cygpath -m "$tbb_extract_dir/oneapi-tbb-2022.3.0")" >> "$GITHUB_ENV" - echo "$(cygpath -m "$tbb_extract_dir/oneapi-tbb-2022.3.0/redist/intel64/vc14")" >> "$GITHUB_PATH" - else - tbb_archive="$RUNNER_TEMP/${TBB_ASSET}" - tbb_extract_dir="$RUNNER_TEMP/oneapi-tbb" - - curl -fsSL \ - "https://github.com/uxlfoundation/oneTBB/releases/download/${TBB_TAG}/${TBB_ASSET}" \ - -o "$tbb_archive" - mkdir -p "$tbb_extract_dir" - tar -xzf "$tbb_archive" -C "$tbb_extract_dir" - - echo "ITLABAI_TBB_DIR=$tbb_extract_dir/oneapi-tbb-2022.3.0" >> "$GITHUB_ENV" - echo "LD_LIBRARY_PATH=$tbb_extract_dir/oneapi-tbb-2022.3.0/lib/intel64/gcc4.8:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" - fi - - - name: Locate SYCL compiler - run: | - if [[ "$RUNNER_OS" == "Windows" ]]; then - if [[ -x "$SYCL_ROOT/bin/icx.exe" ]]; then - cc_path="$SYCL_ROOT/bin/icx.exe" - elif [[ -x "$SYCL_ROOT/bin/icx-cl.exe" ]]; then - cc_path="$SYCL_ROOT/bin/icx-cl.exe" - elif [[ -x "$SYCL_ROOT/bin/clang.exe" ]]; then - cc_path="$SYCL_ROOT/bin/clang.exe" - elif [[ -x "$SYCL_ROOT/bin/clang-cl.exe" ]]; then - cc_path="$SYCL_ROOT/bin/clang-cl.exe" - else - echo "Unable to locate a C compiler in $SYCL_ROOT/bin" >&2 - exit 1 - fi - - if [[ -x "$SYCL_ROOT/bin/icpx.exe" ]]; then - cxx_path="$SYCL_ROOT/bin/icpx.exe" - elif [[ -x "$SYCL_ROOT/bin/icx-cl.exe" ]]; then - cxx_path="$SYCL_ROOT/bin/icx-cl.exe" - elif [[ -x "$SYCL_ROOT/bin/clang++.exe" ]]; then - cxx_path="$SYCL_ROOT/bin/clang++.exe" - elif [[ -x "$SYCL_ROOT/bin/clang-cl.exe" ]]; then - cxx_path="$SYCL_ROOT/bin/clang-cl.exe" - else - echo "Unable to locate a C++ compiler in $SYCL_ROOT/bin" >&2 - exit 1 - fi - - echo "ITLABAI_CC=$(cygpath -m "$cc_path")" >> "$GITHUB_ENV" - echo "ITLABAI_CXX=$(cygpath -m "$cxx_path")" >> "$GITHUB_ENV" - echo "ITLABAI_CMAKE_PREFIX_PATH=$(cygpath -m "$SYCL_ROOT")" >> "$GITHUB_ENV" - echo "$(cygpath -m "$SYCL_ROOT/bin")" >> "$GITHUB_PATH" - else - if [[ -x "$SYCL_ROOT/bin/icx" ]]; then - echo "ITLABAI_CC=$SYCL_ROOT/bin/icx" >> "$GITHUB_ENV" - elif [[ -x "$SYCL_ROOT/bin/clang" ]]; then - echo "ITLABAI_CC=$SYCL_ROOT/bin/clang" >> "$GITHUB_ENV" - else - echo "Unable to locate a C compiler in $SYCL_ROOT/bin" >&2 - exit 1 - fi - - if [[ -x "$SYCL_ROOT/bin/icpx" ]]; then - echo "ITLABAI_CXX=$SYCL_ROOT/bin/icpx" >> "$GITHUB_ENV" - elif [[ -x "$SYCL_ROOT/bin/clang++" ]]; then - echo "ITLABAI_CXX=$SYCL_ROOT/bin/clang++" >> "$GITHUB_ENV" - else - echo "Unable to locate a C++ compiler in $SYCL_ROOT/bin" >&2 - exit 1 - fi - - echo "ITLABAI_CMAKE_PREFIX_PATH=$SYCL_ROOT" >> "$GITHUB_ENV" - echo "$SYCL_ROOT/bin" >> "$GITHUB_PATH" - - if [[ -d "$SYCL_ROOT/lib" ]]; then - echo "LD_LIBRARY_PATH=$SYCL_ROOT/lib:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" - echo "DYLD_LIBRARY_PATH=$SYCL_ROOT/lib:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV" - fi - - if [[ -d "$SYCL_ROOT/lib64" ]]; then - echo "LD_LIBRARY_PATH=$SYCL_ROOT/lib64:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" - echo "DYLD_LIBRARY_PATH=$SYCL_ROOT/lib64:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV" - fi - fi + run: ./scripts/ci/sycl-x86-setup.sh "${{ matrix.platform }}" - name: Configure - run: | - launcher_args=() - if [[ "$RUNNER_OS" != "Windows" ]]; then - launcher_args+=( - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - ) - fi - - cmake -S . -B build -G Ninja \ - "${launcher_args[@]}" \ - -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ - -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ - -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ - -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ - -DITLABAI_ENABLE_OPENMP=OFF \ - -DITLABAI_ENABLE_OPENCV_APPS="${ITLABAI_ENABLE_OPENCV_APPS}" \ - -DITLABAI_BUILD_TESTS=ON \ - -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR}" \ - -DITLABAI_TBB_DIR="${ITLABAI_TBB_DIR}" \ - -DITLABAI_ENABLE_SYCL=ON \ - -DITLABAI_SYCL_TARGETS="${SYCL_TARGETS}" + run: ./scripts/ci/sycl-configure.sh "${{ matrix.build_type }}" "${SYCL_TARGETS}" "${ITLABAI_ENABLE_OPENCV_APPS}" - name: Build run: cmake --build build --parallel - name: Test - run: | - ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" \ - ctest --test-dir build --output-on-failure --parallel + run: ./scripts/ci/sycl-test.sh "${DEVICE_SELECTOR}" build-sycl-macos-arm64: name: macos-arm64 / ${{ matrix.build_type }} @@ -331,47 +100,13 @@ jobs: max-size: 2G - name: Install macOS prerequisites - run: | - brew install adaptivecpp opencv tbb - - - name: Locate AdaptiveCpp compiler - run: | - adaptivecpp_prefix="$(brew --prefix adaptivecpp)" - opencv_prefix="$(brew --prefix opencv)" - tbb_prefix="$(brew --prefix tbb)" - echo "ITLABAI_CC=$(xcrun --find clang)" >> "$GITHUB_ENV" - echo "ITLABAI_CXX=$(command -v acpp)" >> "$GITHUB_ENV" - echo "ITLABAI_CMAKE_PREFIX_PATH=$adaptivecpp_prefix" >> "$GITHUB_ENV" - echo "ITLABAI_OPENCV_DIR=$opencv_prefix/lib/cmake/opencv4" >> "$GITHUB_ENV" - echo "ITLABAI_TBB_DIR=$tbb_prefix" >> "$GITHUB_ENV" - echo "$adaptivecpp_prefix/bin" >> "$GITHUB_PATH" + run: ./scripts/ci/sycl-macos-setup.sh - name: Configure - run: | - launcher_args=() - if [[ "$RUNNER_OS" != "Windows" ]]; then - launcher_args+=( - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - ) - fi - - cmake -S . -B build -G Ninja \ - "${launcher_args[@]}" \ - -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ - -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ - -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \ - -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ - -DITLABAI_ENABLE_OPENMP=OFF \ - -DITLABAI_ENABLE_OPENCV_APPS=ON \ - -DITLABAI_BUILD_TESTS=ON \ - -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR}" \ - -DITLABAI_TBB_DIR="${ITLABAI_TBB_DIR}" \ - -DITLABAI_ENABLE_SYCL=ON \ - -DITLABAI_SYCL_TARGETS=omp + run: ./scripts/ci/sycl-configure.sh "${{ matrix.build_type }}" "${SYCL_TARGETS}" "${ITLABAI_ENABLE_OPENCV_APPS}" - name: Build run: cmake --build build --parallel - name: Test - run: ctest --test-dir build --output-on-failure --parallel + run: ./scripts/ci/sycl-test.sh diff --git a/scripts/ci/sycl-configure.sh b/scripts/ci/sycl-configure.sh new file mode 100755 index 000000000..96108bd90 --- /dev/null +++ b/scripts/ci/sycl-configure.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_type="${1:?build type is required}" +sycl_targets="${2:?sycl targets are required}" +opencv_apps="${3:?opencv apps toggle is required}" + +launcher_args=() +if [[ "${RUNNER_OS}" != "Windows" ]]; then + launcher_args+=( + -DCMAKE_C_COMPILER_LAUNCHER=ccache + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + ) +fi + +cmake -S . -B build -G Ninja \ + "${launcher_args[@]}" \ + -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ + -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ + -DCMAKE_BUILD_TYPE="${build_type}" \ + -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ + -DITLABAI_ENABLE_OPENMP=OFF \ + -DITLABAI_ENABLE_OPENCV_APPS="${opencv_apps}" \ + -DITLABAI_BUILD_TESTS=ON \ + -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR:-}" \ + -DITLABAI_TBB_DIR="${ITLABAI_TBB_DIR:-}" \ + -DITLABAI_ENABLE_SYCL=ON \ + -DITLABAI_SYCL_TARGETS="${sycl_targets}" diff --git a/scripts/ci/sycl-macos-setup.sh b/scripts/ci/sycl-macos-setup.sh new file mode 100755 index 000000000..4bf2ba137 --- /dev/null +++ b/scripts/ci/sycl-macos-setup.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euo pipefail + +write_env() { + local key="$1" + local value="$2" + echo "${key}=${value}" >> "${GITHUB_ENV}" + export "${key}=${value}" +} + +append_path() { + echo "$1" >> "${GITHUB_PATH}" +} + +brew install adaptivecpp opencv tbb + +adaptivecpp_prefix="$(brew --prefix adaptivecpp)" +opencv_prefix="$(brew --prefix opencv)" +tbb_prefix="$(brew --prefix tbb)" + +write_env ITLABAI_CC "$(xcrun --find clang)" +write_env ITLABAI_CXX "$(command -v acpp)" +write_env ITLABAI_CMAKE_PREFIX_PATH "${adaptivecpp_prefix}" +write_env ITLABAI_OPENCV_DIR "${opencv_prefix}/lib/cmake/opencv4" +write_env ITLABAI_TBB_DIR "${tbb_prefix}" +write_env ITLABAI_ENABLE_OPENCV_APPS ON +write_env SYCL_TARGETS omp + +append_path "${adaptivecpp_prefix}/bin" diff --git a/scripts/ci/sycl-test.sh b/scripts/ci/sycl-test.sh new file mode 100755 index 000000000..a4096acbf --- /dev/null +++ b/scripts/ci/sycl-test.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +device_selector="${1:-}" + +if [[ -n "${device_selector}" ]]; then + ONEAPI_DEVICE_SELECTOR="${device_selector}" \ + ctest --test-dir build --output-on-failure --parallel +else + ctest --test-dir build --output-on-failure --parallel +fi diff --git a/scripts/ci/sycl-x86-setup.sh b/scripts/ci/sycl-x86-setup.sh new file mode 100755 index 000000000..40472152b --- /dev/null +++ b/scripts/ci/sycl-x86-setup.sh @@ -0,0 +1,198 @@ +#!/usr/bin/env bash +set -euo pipefail + +platform="${1:?platform is required}" + +write_env() { + local key="$1" + local value="$2" + echo "${key}=${value}" >> "${GITHUB_ENV}" + export "${key}=${value}" +} + +append_path() { + echo "$1" >> "${GITHUB_PATH}" +} + +case "${platform}" in + linux-x86_64) + write_env TOOLCHAIN_ASSET sycl_linux.tar.gz + write_env TBB_ASSET oneapi-tbb-2022.3.0-lin.tgz + write_env SYCL_TARGETS spir64 + write_env DEVICE_SELECTOR opencl:cpu + write_env ITLABAI_ENABLE_OPENCV_APPS ON + write_env ITLABAI_OPENCV_DIR /usr/lib/x86_64-linux-gnu/cmake/opencv4 + ;; + windows-x86_64) + write_env TOOLCHAIN_ASSET sycl_windows.tar.gz + write_env TBB_ASSET oneapi-tbb-2022.3.0-win.zip + write_env OPENCV_ASSET opencv-4.13.0-windows.exe + write_env SYCL_TARGETS spir64 + write_env DEVICE_SELECTOR opencl:cpu + write_env ITLABAI_ENABLE_OPENCV_APPS ON + ;; + *) + echo "Unsupported platform: ${platform}" >&2 + exit 1 + ;; +esac + +if [[ "${RUNNER_OS}" == "Linux" ]]; then + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + cmake \ + git \ + libopencv-dev \ + libomp-dev \ + ocl-icd-opencl-dev \ + opencl-headers \ + python3 \ + zstd + + wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ + | gpg --dearmor \ + | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ + | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + sudo apt-get install -y intel-oneapi-runtime-opencl + + intel_icd_dir="${RUNNER_TEMP}/intel-opencl-icd" + intel_icd_file="$(grep -il 'intel' /etc/OpenCL/vendors/*.icd | head -n 1 || true)" + if [[ -z "${intel_icd_file}" ]]; then + echo "Unable to locate Intel OpenCL ICD file under /etc/OpenCL/vendors" >&2 + ls -la /etc/OpenCL/vendors >&2 + exit 1 + fi + + mkdir -p "${intel_icd_dir}" + cp "${intel_icd_file}" "${intel_icd_dir}/" + write_env OCL_ICD_VENDORS "${intel_icd_dir}" +fi + +if [[ "${RUNNER_OS}" == "Windows" ]]; then + runner_temp_dir="$(cygpath -u "${RUNNER_TEMP}")" +else + runner_temp_dir="${RUNNER_TEMP}" +fi + +mkdir -p "${runner_temp_dir}/intel-sycl" +curl -fsSL \ + "https://github.com/intel/llvm/releases/download/${INTEL_LLVM_TAG}/${TOOLCHAIN_ASSET}" \ + -o "${runner_temp_dir}/${TOOLCHAIN_ASSET}" +tar -xzf "${runner_temp_dir}/${TOOLCHAIN_ASSET}" \ + -C "${runner_temp_dir}/intel-sycl" + +sycl_root="${runner_temp_dir}/intel-sycl" +if [[ -d "${sycl_root}/sycl_windows/bin" ]]; then + sycl_root="${sycl_root}/sycl_windows" +elif [[ -d "${sycl_root}/sycl_linux/bin" ]]; then + sycl_root="${sycl_root}/sycl_linux" +fi +write_env SYCL_ROOT "${sycl_root}" + +if [[ "${RUNNER_OS}" == "Windows" ]]; then + opencv_archive="${runner_temp_dir}/${OPENCV_ASSET}" + opencv_extract_dir="${runner_temp_dir}/opencv" + + curl -fsSL \ + "https://github.com/opencv/opencv/releases/download/${OPENCV_TAG}/${OPENCV_ASSET}" \ + -o "${opencv_archive}" + 7z x -y "-o${opencv_extract_dir}" "${opencv_archive}" + + write_env ITLABAI_OPENCV_DIR "$(cygpath -m "${opencv_extract_dir}/opencv/build/x64/vc16/lib")" + append_path "$(cygpath -m "${opencv_extract_dir}/opencv/build/x64/vc16/bin")" + + runtime_archive="${runner_temp_dir}/intel-opencl-runtime.exe" + runtime_extract_dir="${runner_temp_dir}/intel-opencl-runtime" + runtime_msi="${runtime_extract_dir}/w_opencl_runtime_p_2025.3.1.762.msi" + + curl -fsSL "${INTEL_OPENCL_CPU_RUNTIME_URL}" -o "${runtime_archive}" + 7z x -y "-o${runtime_extract_dir}" "${runtime_archive}" + powershell -NoProfile -Command \ + "Start-Process msiexec.exe -Wait -ArgumentList '/i', '$(cygpath -w "${runtime_msi}")', '/qn', '/norestart'" + + tbb_archive="${runner_temp_dir}/${TBB_ASSET}" + tbb_extract_dir="${runner_temp_dir}/oneapi-tbb" + curl -fsSL \ + "https://github.com/uxlfoundation/oneTBB/releases/download/${TBB_TAG}/${TBB_ASSET}" \ + -o "${tbb_archive}" + 7z x -y "-o${tbb_extract_dir}" "${tbb_archive}" + + write_env ITLABAI_TBB_DIR "$(cygpath -m "${tbb_extract_dir}/oneapi-tbb-2022.3.0")" + append_path "$(cygpath -m "${tbb_extract_dir}/oneapi-tbb-2022.3.0/redist/intel64/vc14")" + + if [[ -x "${SYCL_ROOT}/bin/icx.exe" ]]; then + cc_path="${SYCL_ROOT}/bin/icx.exe" + elif [[ -x "${SYCL_ROOT}/bin/icx-cl.exe" ]]; then + cc_path="${SYCL_ROOT}/bin/icx-cl.exe" + elif [[ -x "${SYCL_ROOT}/bin/clang.exe" ]]; then + cc_path="${SYCL_ROOT}/bin/clang.exe" + elif [[ -x "${SYCL_ROOT}/bin/clang-cl.exe" ]]; then + cc_path="${SYCL_ROOT}/bin/clang-cl.exe" + else + echo "Unable to locate a C compiler in ${SYCL_ROOT}/bin" >&2 + exit 1 + fi + + if [[ -x "${SYCL_ROOT}/bin/icpx.exe" ]]; then + cxx_path="${SYCL_ROOT}/bin/icpx.exe" + elif [[ -x "${SYCL_ROOT}/bin/icx-cl.exe" ]]; then + cxx_path="${SYCL_ROOT}/bin/icx-cl.exe" + elif [[ -x "${SYCL_ROOT}/bin/clang++.exe" ]]; then + cxx_path="${SYCL_ROOT}/bin/clang++.exe" + elif [[ -x "${SYCL_ROOT}/bin/clang-cl.exe" ]]; then + cxx_path="${SYCL_ROOT}/bin/clang-cl.exe" + else + echo "Unable to locate a C++ compiler in ${SYCL_ROOT}/bin" >&2 + exit 1 + fi + + write_env ITLABAI_CC "$(cygpath -m "${cc_path}")" + write_env ITLABAI_CXX "$(cygpath -m "${cxx_path}")" + write_env ITLABAI_CMAKE_PREFIX_PATH "$(cygpath -m "${SYCL_ROOT}")" + append_path "$(cygpath -m "${SYCL_ROOT}/bin")" +else + tbb_archive="${RUNNER_TEMP}/${TBB_ASSET}" + tbb_extract_dir="${RUNNER_TEMP}/oneapi-tbb" + curl -fsSL \ + "https://github.com/uxlfoundation/oneTBB/releases/download/${TBB_TAG}/${TBB_ASSET}" \ + -o "${tbb_archive}" + mkdir -p "${tbb_extract_dir}" + tar -xzf "${tbb_archive}" -C "${tbb_extract_dir}" + + write_env ITLABAI_TBB_DIR "${tbb_extract_dir}/oneapi-tbb-2022.3.0" + write_env LD_LIBRARY_PATH "${tbb_extract_dir}/oneapi-tbb-2022.3.0/lib/intel64/gcc4.8:${LD_LIBRARY_PATH:-}" + + if [[ -x "${SYCL_ROOT}/bin/icx" ]]; then + write_env ITLABAI_CC "${SYCL_ROOT}/bin/icx" + elif [[ -x "${SYCL_ROOT}/bin/clang" ]]; then + write_env ITLABAI_CC "${SYCL_ROOT}/bin/clang" + else + echo "Unable to locate a C compiler in ${SYCL_ROOT}/bin" >&2 + exit 1 + fi + + if [[ -x "${SYCL_ROOT}/bin/icpx" ]]; then + write_env ITLABAI_CXX "${SYCL_ROOT}/bin/icpx" + elif [[ -x "${SYCL_ROOT}/bin/clang++" ]]; then + write_env ITLABAI_CXX "${SYCL_ROOT}/bin/clang++" + else + echo "Unable to locate a C++ compiler in ${SYCL_ROOT}/bin" >&2 + exit 1 + fi + + write_env ITLABAI_CMAKE_PREFIX_PATH "${SYCL_ROOT}" + append_path "${SYCL_ROOT}/bin" + + if [[ -d "${SYCL_ROOT}/lib" ]]; then + write_env LD_LIBRARY_PATH "${SYCL_ROOT}/lib:${LD_LIBRARY_PATH:-}" + write_env DYLD_LIBRARY_PATH "${SYCL_ROOT}/lib:${DYLD_LIBRARY_PATH:-}" + fi + + if [[ -d "${SYCL_ROOT}/lib64" ]]; then + write_env LD_LIBRARY_PATH "${SYCL_ROOT}/lib64:${LD_LIBRARY_PATH:-}" + write_env DYLD_LIBRARY_PATH "${SYCL_ROOT}/lib64:${DYLD_LIBRARY_PATH:-}" + fi +fi From 6a07c7c5752eede27e51593d901f337d82bd619c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 19:13:31 +0100 Subject: [PATCH 037/104] Fix Windows test getenv warnings --- test/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 142773ef3..fb5ac2bfe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,6 +15,8 @@ target_include_directories(run_test PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(run_test PRIVATE "${CMAKE_SOURCE_DIR}/app/ReaderImage") if (WIN32) + target_compile_definitions(run_test PRIVATE _CRT_SECURE_NO_WARNINGS) + add_custom_command(TARGET run_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ From a15aaf7a345352a735ce2bcf6e59db191d37df52 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 19:51:47 +0100 Subject: [PATCH 038/104] Keep OpenMP enabled in SYCL CI --- scripts/ci/sycl-configure.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci/sycl-configure.sh b/scripts/ci/sycl-configure.sh index 96108bd90..aaf2e68c5 100755 --- a/scripts/ci/sycl-configure.sh +++ b/scripts/ci/sycl-configure.sh @@ -4,6 +4,7 @@ set -euo pipefail build_type="${1:?build type is required}" sycl_targets="${2:?sycl targets are required}" opencv_apps="${3:?opencv apps toggle is required}" +openmp_enabled="${ITLABAI_ENABLE_OPENMP:-ON}" launcher_args=() if [[ "${RUNNER_OS}" != "Windows" ]]; then @@ -19,7 +20,7 @@ cmake -S . -B build -G Ninja \ -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${build_type}" \ -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ - -DITLABAI_ENABLE_OPENMP=OFF \ + -DITLABAI_ENABLE_OPENMP="${openmp_enabled}" \ -DITLABAI_ENABLE_OPENCV_APPS="${opencv_apps}" \ -DITLABAI_BUILD_TESTS=ON \ -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR:-}" \ From f4105ac100a53b612c54bde78b764097dd458ea9 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 19:56:11 +0100 Subject: [PATCH 039/104] Drop custom HAS_OPENMP define --- CMakeLists.txt | 1 - include/parallel/backends.hpp | 2 +- include/parallel/parallel.hpp | 4 ++-- include/perf/benchmarking.hpp | 6 +++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b8c90855..44654c10f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,6 @@ if(ITLABAI_ENABLE_OPENMP) if(OpenMP_FOUND) message(STATUS "OpenMP found - enabling parallel support") - add_definitions(-DHAS_OPENMP) link_libraries(OpenMP::OpenMP_CXX) else() message(STATUS "OpenMP not found - parallel features disabled") diff --git a/include/parallel/backends.hpp b/include/parallel/backends.hpp index 5e57a10e3..06d976b7e 100644 --- a/include/parallel/backends.hpp +++ b/include/parallel/backends.hpp @@ -92,7 +92,7 @@ inline void impl_tbb(std::size_t count, }, oneapi::tbb::auto_partitioner()); } -#ifdef HAS_OPENMP +#ifdef _OPENMP inline void impl_omp(std::size_t count, const std::function& func, const Options& opt) { diff --git a/include/parallel/parallel.hpp b/include/parallel/parallel.hpp index 66851fd28..ced5bca55 100644 --- a/include/parallel/parallel.hpp +++ b/include/parallel/parallel.hpp @@ -5,7 +5,7 @@ namespace it_lab_ai { namespace parallel { constexpr bool kHasOmp = -#ifdef HAS_OPENMP +#ifdef _OPENMP true; #else false; @@ -16,7 +16,7 @@ inline Backend resolve_default_backend(std::size_t n, const Options& opt) { return Backend::kSeq; } -#ifdef HAS_OPENMP +#ifdef _OPENMP return Backend::kOmp; #else return Backend::kTbb; diff --git a/include/perf/benchmarking.hpp b/include/perf/benchmarking.hpp index 84724ab8f..314ad0b56 100644 --- a/include/perf/benchmarking.hpp +++ b/include/perf/benchmarking.hpp @@ -2,7 +2,7 @@ #pragma once -#if defined(HAS_OPENMP) +#if defined(_OPENMP) # include #endif @@ -29,7 +29,7 @@ DurationContainerType elapsed_time(Function&& func, Args&&... args) { // returns time in seconds template double elapsed_time_omp(Function&& func, Args&&... args) { -#if defined(HAS_OPENMP) +#if defined(_OPENMP) double start = omp_get_wtime(); std::forward(func)(std::forward(args)...); double end = omp_get_wtime(); @@ -58,7 +58,7 @@ DurationContainerType elapsed_time_avg(const size_t iters, Function&& func, template double elapsed_time_omp_avg(const size_t iters, Function&& func, Args&&... args) { -#if defined(HAS_OPENMP) +#if defined(_OPENMP) double start = omp_get_wtime(); for (size_t i = 0; i < iters; i++) { std::forward(func)(std::forward(args)...); From 0b7930d70b325455178119e38623303a1c49fb4e Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 19:59:39 +0100 Subject: [PATCH 040/104] Simplify OpenMP integration --- CMakeLists.txt | 19 +++++-------------- scripts/ci/sycl-configure.sh | 2 -- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44654c10f..a0dcd6fd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,6 @@ project(ITLabAI LANGUAGES CXX) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) option(ITLABAI_ENABLE_SYCL "Build SYCL example and helper targets" OFF) -option(ITLABAI_ENABLE_OPENMP "Enable OpenMP parallel support" ON) option(ITLABAI_ENABLE_OPENCV_APPS "Build OpenCV-dependent apps" ON) option(ITLABAI_BUILD_TESTS "Build unit tests" ON) set(ITLABAI_OPENCV_DIR "" CACHE PATH @@ -35,21 +34,13 @@ set(CMAKE_CXX_STANDARD 20) enable_testing() -if(ITLABAI_ENABLE_OPENMP) - find_package(OpenMP REQUIRED COMPONENTS CXX) +find_package(OpenMP REQUIRED COMPONENTS CXX) - if(OpenMP_FOUND) - message(STATUS "OpenMP found - enabling parallel support") - link_libraries(OpenMP::OpenMP_CXX) - else() - message(STATUS "OpenMP not found - parallel features disabled") - endif() +if(OpenMP_FOUND) + message(STATUS "OpenMP found - enabling parallel support") + link_libraries(OpenMP::OpenMP_CXX) else() - message(STATUS "OpenMP support disabled") - - if(NOT TARGET OpenMP::OpenMP_CXX) - add_library(OpenMP::OpenMP_CXX INTERFACE IMPORTED) - endif() + message(STATUS "OpenMP not found - parallel features disabled") endif() add_library(itlabai_sycl INTERFACE) diff --git a/scripts/ci/sycl-configure.sh b/scripts/ci/sycl-configure.sh index aaf2e68c5..49a6ad20b 100755 --- a/scripts/ci/sycl-configure.sh +++ b/scripts/ci/sycl-configure.sh @@ -4,7 +4,6 @@ set -euo pipefail build_type="${1:?build type is required}" sycl_targets="${2:?sycl targets are required}" opencv_apps="${3:?opencv apps toggle is required}" -openmp_enabled="${ITLABAI_ENABLE_OPENMP:-ON}" launcher_args=() if [[ "${RUNNER_OS}" != "Windows" ]]; then @@ -20,7 +19,6 @@ cmake -S . -B build -G Ninja \ -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${build_type}" \ -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ - -DITLABAI_ENABLE_OPENMP="${openmp_enabled}" \ -DITLABAI_ENABLE_OPENCV_APPS="${opencv_apps}" \ -DITLABAI_BUILD_TESTS=ON \ -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR:-}" \ From 012441d6c03909c5f4a75b25ef8cfc45affeb5ab Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 20:25:01 +0100 Subject: [PATCH 041/104] Apply SYCL review feedback --- .github/workflows/ci.yml | 4 --- .github/workflows/static-analysis.yml | 7 +---- .github/workflows/sycl-ci.yml | 8 +++--- 3rdparty/CMakeLists.txt | 32 ++++------------------- CMakeLists.txt | 10 +------- app/SYCL/.clang-tidy | 12 +++++++++ app/SYCL/CMakeLists.txt | 24 +++-------------- app/SYCL/sycl_example.cpp | 22 ++++++++-------- app/SYCL/sycl_kernel.cpp | 8 ++++++ include/parallel/backends.hpp | 3 +-- include/perf/benchmarking.hpp | 37 ++++++++------------------- scripts/ci/sycl-configure.sh | 2 -- scripts/ci/sycl-macos-setup.sh | 6 +---- scripts/ci/sycl-test.sh | 11 -------- scripts/ci/sycl-x86-setup.sh | 37 --------------------------- test/CMakeLists.txt | 2 -- test/main.cpp | 12 ++++----- test/utils/env.hpp | 25 ++++++++++++++++++ test/utils/flaky_test_runner.hpp | 13 +++++----- 19 files changed, 95 insertions(+), 180 deletions(-) create mode 100644 app/SYCL/.clang-tidy delete mode 100755 scripts/ci/sycl-test.sh create mode 100644 test/utils/env.hpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aff873de8..c73d242e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,10 +7,6 @@ on: - cron: '0 8 * * *' workflow_dispatch: -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - jobs: clang-format: runs-on: ubuntu-latest diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 58752aea6..c702c448f 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -2,10 +2,6 @@ name: Static analysis on: [pull_request] -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - jobs: clang-tidy: runs-on: ubuntu-latest @@ -31,5 +27,4 @@ jobs: cmake --build build --parallel - name: Run clang-tidy run: | - mapfile -t files < <(find app src -name '*.cpp' ! -path 'app/SYCL/*' | sort) - clang-tidy "${files[@]}" -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build + clang-tidy app/**/*.cpp src/**/*.cpp -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 7faa1b8c5..5fb04d436 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -9,9 +9,7 @@ concurrency: cancel-in-progress: true env: - INTEL_LLVM_TAG: v6.3.0 - OPENCV_TAG: 4.13.0 - TBB_TAG: v2022.3.0 + INTEL_LLVM_TAG: nightly-2026-03-17 INTEL_OPENCL_CPU_RUNTIME_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/ad824c04-01c8-4ae5-b5e8-164a04f67609/w_opencl_runtime_p_2025.3.1.762.exe jobs: @@ -68,7 +66,7 @@ jobs: run: cmake --build build --parallel - name: Test - run: ./scripts/ci/sycl-test.sh "${DEVICE_SELECTOR}" + run: ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" ctest --test-dir build --output-on-failure --parallel build-sycl-macos-arm64: name: macos-arm64 / ${{ matrix.build_type }} @@ -109,4 +107,4 @@ jobs: run: cmake --build build --parallel - name: Test - run: ./scripts/ci/sycl-test.sh + run: ctest --test-dir build --output-on-failure --parallel diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index d678b69f3..67735c083 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -10,36 +10,14 @@ endif() set(DNNL_CPU_RUNTIME "TBB" CACHE STRING "oneDNN CPU threading runtime") -if(ITLABAI_TBB_DIR) - set(itlabai_tbb_config_dir "") - - if(EXISTS "${ITLABAI_TBB_DIR}/lib/cmake/tbb/TBBConfig.cmake") - set(itlabai_tbb_config_dir "${ITLABAI_TBB_DIR}/lib/cmake/tbb") - elseif(EXISTS "${ITLABAI_TBB_DIR}/lib/cmake/TBB/TBBConfig.cmake") - set(itlabai_tbb_config_dir "${ITLABAI_TBB_DIR}/lib/cmake/TBB") - endif() - - if(NOT itlabai_tbb_config_dir) - message(FATAL_ERROR - "ITLABAI_TBB_DIR must contain lib/cmake/tbb/TBBConfig.cmake " - "or lib/cmake/TBB/TBBConfig.cmake") - endif() - - set(TBB_DIR "${itlabai_tbb_config_dir}" CACHE PATH - "Path to the prebuilt oneTBB CMake package" FORCE) - find_package(TBB REQUIRED CONFIG) -endif() - add_subdirectory(oneDNN) -if(NOT ITLABAI_TBB_DIR) - # Unified TBB configuration for the vendored fallback. - option(TBB_TEST "Build TBB tests" OFF) - option(TBB_EXAMPLES "Build TBB examples" OFF) - set(TBB_STRICT OFF CACHE BOOL "Treat compiler warnings as errors") +# Unified TBB configuration for the vendored fallback. +option(TBB_TEST "Build TBB tests" OFF) +option(TBB_EXAMPLES "Build TBB examples" OFF) +set(TBB_STRICT OFF CACHE BOOL "Treat compiler warnings as errors") - add_subdirectory(TBB) -endif() +add_subdirectory(TBB) # Create a unified TBB interface target if(NOT TARGET TBB_unified) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0dcd6fd6..a574c8581 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,10 +6,6 @@ set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) option(ITLABAI_ENABLE_SYCL "Build SYCL example and helper targets" OFF) option(ITLABAI_ENABLE_OPENCV_APPS "Build OpenCV-dependent apps" ON) option(ITLABAI_BUILD_TESTS "Build unit tests" ON) -set(ITLABAI_OPENCV_DIR "" CACHE PATH - "Path to a prebuilt OpenCV package directory containing OpenCVConfig.cmake") -set(ITLABAI_TBB_DIR "" CACHE PATH - "Path to a prebuilt oneTBB package root containing lib/cmake/tbb/TBBConfig.cmake") set(ITLABAI_SYCL_TARGETS "" CACHE STRING "Optional SYCL targets passed to -fsycl-targets") @@ -126,11 +122,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") add_subdirectory(3rdparty) if(ITLABAI_ENABLE_OPENCV_APPS) - if(ITLABAI_OPENCV_DIR) - set(OPENCV_BUILD_DIR "${ITLABAI_OPENCV_DIR}") - else() - include(cmake/opencv_config.cmake) - endif() + include(cmake/opencv_config.cmake) endif() include(cmake/kokkos_config.cmake) diff --git a/app/SYCL/.clang-tidy b/app/SYCL/.clang-tidy new file mode 100644 index 000000000..c87a077de --- /dev/null +++ b/app/SYCL/.clang-tidy @@ -0,0 +1,12 @@ +Checks: '-*,misc-unused-parameters' +WarningsAsErrors: '' +ExtraArgs: + - -std=c++20 + - -Iinclude + - -Iapp + - -I3rdparty/TBB/include + - -I3rdparty/kokkos/core/src + - -I3rdparty/kokkos/containers/src + - -I3rdparty/kokkos/algorithms/src + - -I3rdparty/kokkos/simd/src + - -Ibuild/3rdparty/kokkos_install/include diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 72ee55e5d..002209f58 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -2,31 +2,13 @@ add_executable(SYCL_Example sycl_example.cpp sycl_kernel.cpp ) -target_link_libraries(SYCL_Example PRIVATE layers_lib) -target_include_directories(SYCL_Example PRIVATE - $ -) -target_link_options(SYCL_Example PRIVATE - $ -) +target_link_libraries(SYCL_Example PRIVATE layers_lib itlabai_sycl) target_compile_options(SYCL_Example PRIVATE + $<$:-Wno-error> $<$:-Wno-unused-parameter> -) -set_property(SOURCE sycl_example.cpp APPEND PROPERTY COMPILE_OPTIONS $<$:-Wno-deprecated-declarations> ) -set_property(SOURCE sycl_example.cpp APPEND PROPERTY COMPILE_DEFINITIONS - SYCL_DISABLE_FSYCL_SYCLHPP_WARNING=1 -) -set_property(SOURCE sycl_kernel.cpp APPEND PROPERTY COMPILE_OPTIONS - $ - $<$:-Wno-unused-parameter> - $<$,$,$>:-O2> - $<$,$,$>:-g0> -) -set_property(SOURCE sycl_kernel.cpp APPEND PROPERTY COMPILE_DEFINITIONS - $ -) +target_compile_definitions(SYCL_Example PRIVATE SYCL_DISABLE_FSYCL_SYCLHPP_WARNING=1) add_test(NAME SYCL.Example COMMAND SYCL_Example) set_tests_properties(SYCL.Example PROPERTIES diff --git a/app/SYCL/sycl_example.cpp b/app/SYCL/sycl_example.cpp index 5893d51f8..aafbbf7bd 100644 --- a/app/SYCL/sycl_example.cpp +++ b/app/SYCL/sycl_example.cpp @@ -1,33 +1,34 @@ #include #include -#include #include -#include -#include #include +#if __has_include() +#include +#define ITLABAI_HAS_SYCL_HEADERS 1 +#endif + #include "graph/runtime_options.hpp" #include "layers/EWLayer.hpp" #include "layers/Tensor.hpp" +#if defined(ITLABAI_HAS_SYCL_HEADERS) namespace { bool almost_equal(float lhs, float rhs) { return std::fabs(lhs - rhs) < 1.0e-6F; } -void rethrow_async_exceptions(sycl::exception_list exceptions) { - for (const std::exception_ptr& exception : exceptions) { - std::rethrow_exception(exception); - } -} - } // namespace void run_sycl_kernel(sycl::queue& queue, const float* input, float* output, std::size_t count); +#endif int main() { +#if !defined(ITLABAI_HAS_SYCL_HEADERS) + return 0; +#else try { using namespace it_lab_ai; @@ -49,7 +50,7 @@ int main() { } const std::size_t count = relu_output.size(); - sycl::queue queue(sycl::default_selector_v, rethrow_async_exceptions); + sycl::queue queue(sycl::default_selector_v); std::cout << "SYCL device: " << queue.get_device().get_info() << '\n'; @@ -71,4 +72,5 @@ int main() { std::cerr << "Error: " << exception.what() << '\n'; return 1; } +#endif } diff --git a/app/SYCL/sycl_kernel.cpp b/app/SYCL/sycl_kernel.cpp index 490cf7276..164f6930a 100644 --- a/app/SYCL/sycl_kernel.cpp +++ b/app/SYCL/sycl_kernel.cpp @@ -1,6 +1,11 @@ #include + +#if __has_include() #include +#define ITLABAI_HAS_SYCL_HEADERS 1 +#endif +#if defined(ITLABAI_HAS_SYCL_HEADERS) class SyclExampleTransformKernel; void run_sycl_kernel(sycl::queue& queue, const float* input, float* output, @@ -19,3 +24,6 @@ void run_sycl_kernel(sycl::queue& queue, const float* input, float* output, }); queue.wait_and_throw(); } +#else +void run_sycl_kernel(...) {} +#endif diff --git a/include/parallel/backends.hpp b/include/parallel/backends.hpp index 06d976b7e..163e361bb 100644 --- a/include/parallel/backends.hpp +++ b/include/parallel/backends.hpp @@ -119,8 +119,7 @@ inline void impl_omp(std::size_t count, #else inline void impl_omp(std::size_t count, const std::function& func, - const Options& opt) { - static_cast(opt); + const Options& opt [[maybe_unused]]) { impl_seq(count, func); } #endif diff --git a/include/perf/benchmarking.hpp b/include/perf/benchmarking.hpp index 314ad0b56..c0ee374d6 100644 --- a/include/perf/benchmarking.hpp +++ b/include/perf/benchmarking.hpp @@ -1,16 +1,12 @@ // Using chrono for good measurements and parallelism support #pragma once - -#if defined(_OPENMP) -# include -#endif +#include #include #include #include #include -#include #include namespace it_lab_ai { @@ -20,7 +16,7 @@ template (); auto start = std::chrono::high_resolution_clock::now(); - std::forward(func)(std::forward(args)...); + func(args...); auto end = std::chrono::high_resolution_clock::now(); duration = end - start; return duration.count(); @@ -29,15 +25,10 @@ DurationContainerType elapsed_time(Function&& func, Args&&... args) { // returns time in seconds template double elapsed_time_omp(Function&& func, Args&&... args) { -#if defined(_OPENMP) double start = omp_get_wtime(); - std::forward(func)(std::forward(args)...); + func(args...); double end = omp_get_wtime(); return end - start; -#else - return elapsed_time( - std::forward(func), std::forward(args)...); -#endif } template (); auto start = std::chrono::high_resolution_clock::now(); for (size_t i = 0; i < iters; i++) { - std::forward(func)(std::forward(args)...); + func(args...); } auto end = std::chrono::high_resolution_clock::now(); duration = (end - start) / iters; @@ -58,31 +49,24 @@ DurationContainerType elapsed_time_avg(const size_t iters, Function&& func, template double elapsed_time_omp_avg(const size_t iters, Function&& func, Args&&... args) { -#if defined(_OPENMP) double start = omp_get_wtime(); for (size_t i = 0; i < iters; i++) { - std::forward(func)(std::forward(args)...); + func(args...); } double end = omp_get_wtime(); return (end - start) / iters; -#else - return elapsed_time_avg( - iters, std::forward(func), std::forward(args)...); -#endif } template ThroughputContainerType throughput(Function&& func, Args&&... args) { return ThroughputContainerType(1) / - elapsed_time( - std::forward(func), std::forward(args)...); + elapsed_time(func, args...); } template double throughput_omp(Function&& func, Args&&... args) { - return 1 / elapsed_time_omp(std::forward(func), - std::forward(args)...); + return 1 / elapsed_time_omp(func, args...); } template ( - iters, std::forward(func), std::forward(args)...); + elapsed_time_avg(iters, func, + args...); } template double throughput_omp_avg(const size_t iters, Function&& func, Args&&... args) { - return 1 / elapsed_time_omp_avg(iters, std::forward(func), - std::forward(args)...); + return 1 / elapsed_time_omp_avg(iters, func, args...); } // as "Manhattan" norm of error-vector diff --git a/scripts/ci/sycl-configure.sh b/scripts/ci/sycl-configure.sh index 49a6ad20b..bca5d1e61 100755 --- a/scripts/ci/sycl-configure.sh +++ b/scripts/ci/sycl-configure.sh @@ -21,7 +21,5 @@ cmake -S . -B build -G Ninja \ -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ -DITLABAI_ENABLE_OPENCV_APPS="${opencv_apps}" \ -DITLABAI_BUILD_TESTS=ON \ - -DITLABAI_OPENCV_DIR="${ITLABAI_OPENCV_DIR:-}" \ - -DITLABAI_TBB_DIR="${ITLABAI_TBB_DIR:-}" \ -DITLABAI_ENABLE_SYCL=ON \ -DITLABAI_SYCL_TARGETS="${sycl_targets}" diff --git a/scripts/ci/sycl-macos-setup.sh b/scripts/ci/sycl-macos-setup.sh index 4bf2ba137..21c4eebda 100755 --- a/scripts/ci/sycl-macos-setup.sh +++ b/scripts/ci/sycl-macos-setup.sh @@ -12,17 +12,13 @@ append_path() { echo "$1" >> "${GITHUB_PATH}" } -brew install adaptivecpp opencv tbb +brew install adaptivecpp adaptivecpp_prefix="$(brew --prefix adaptivecpp)" -opencv_prefix="$(brew --prefix opencv)" -tbb_prefix="$(brew --prefix tbb)" write_env ITLABAI_CC "$(xcrun --find clang)" write_env ITLABAI_CXX "$(command -v acpp)" write_env ITLABAI_CMAKE_PREFIX_PATH "${adaptivecpp_prefix}" -write_env ITLABAI_OPENCV_DIR "${opencv_prefix}/lib/cmake/opencv4" -write_env ITLABAI_TBB_DIR "${tbb_prefix}" write_env ITLABAI_ENABLE_OPENCV_APPS ON write_env SYCL_TARGETS omp diff --git a/scripts/ci/sycl-test.sh b/scripts/ci/sycl-test.sh deleted file mode 100755 index a4096acbf..000000000 --- a/scripts/ci/sycl-test.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -device_selector="${1:-}" - -if [[ -n "${device_selector}" ]]; then - ONEAPI_DEVICE_SELECTOR="${device_selector}" \ - ctest --test-dir build --output-on-failure --parallel -else - ctest --test-dir build --output-on-failure --parallel -fi diff --git a/scripts/ci/sycl-x86-setup.sh b/scripts/ci/sycl-x86-setup.sh index 40472152b..c56028950 100755 --- a/scripts/ci/sycl-x86-setup.sh +++ b/scripts/ci/sycl-x86-setup.sh @@ -17,16 +17,12 @@ append_path() { case "${platform}" in linux-x86_64) write_env TOOLCHAIN_ASSET sycl_linux.tar.gz - write_env TBB_ASSET oneapi-tbb-2022.3.0-lin.tgz write_env SYCL_TARGETS spir64 write_env DEVICE_SELECTOR opencl:cpu write_env ITLABAI_ENABLE_OPENCV_APPS ON - write_env ITLABAI_OPENCV_DIR /usr/lib/x86_64-linux-gnu/cmake/opencv4 ;; windows-x86_64) write_env TOOLCHAIN_ASSET sycl_windows.tar.gz - write_env TBB_ASSET oneapi-tbb-2022.3.0-win.zip - write_env OPENCV_ASSET opencv-4.13.0-windows.exe write_env SYCL_TARGETS spir64 write_env DEVICE_SELECTOR opencl:cpu write_env ITLABAI_ENABLE_OPENCV_APPS ON @@ -43,7 +39,6 @@ if [[ "${RUNNER_OS}" == "Linux" ]]; then build-essential \ cmake \ git \ - libopencv-dev \ libomp-dev \ ocl-icd-opencl-dev \ opencl-headers \ @@ -93,17 +88,6 @@ fi write_env SYCL_ROOT "${sycl_root}" if [[ "${RUNNER_OS}" == "Windows" ]]; then - opencv_archive="${runner_temp_dir}/${OPENCV_ASSET}" - opencv_extract_dir="${runner_temp_dir}/opencv" - - curl -fsSL \ - "https://github.com/opencv/opencv/releases/download/${OPENCV_TAG}/${OPENCV_ASSET}" \ - -o "${opencv_archive}" - 7z x -y "-o${opencv_extract_dir}" "${opencv_archive}" - - write_env ITLABAI_OPENCV_DIR "$(cygpath -m "${opencv_extract_dir}/opencv/build/x64/vc16/lib")" - append_path "$(cygpath -m "${opencv_extract_dir}/opencv/build/x64/vc16/bin")" - runtime_archive="${runner_temp_dir}/intel-opencl-runtime.exe" runtime_extract_dir="${runner_temp_dir}/intel-opencl-runtime" runtime_msi="${runtime_extract_dir}/w_opencl_runtime_p_2025.3.1.762.msi" @@ -113,16 +97,6 @@ if [[ "${RUNNER_OS}" == "Windows" ]]; then powershell -NoProfile -Command \ "Start-Process msiexec.exe -Wait -ArgumentList '/i', '$(cygpath -w "${runtime_msi}")', '/qn', '/norestart'" - tbb_archive="${runner_temp_dir}/${TBB_ASSET}" - tbb_extract_dir="${runner_temp_dir}/oneapi-tbb" - curl -fsSL \ - "https://github.com/uxlfoundation/oneTBB/releases/download/${TBB_TAG}/${TBB_ASSET}" \ - -o "${tbb_archive}" - 7z x -y "-o${tbb_extract_dir}" "${tbb_archive}" - - write_env ITLABAI_TBB_DIR "$(cygpath -m "${tbb_extract_dir}/oneapi-tbb-2022.3.0")" - append_path "$(cygpath -m "${tbb_extract_dir}/oneapi-tbb-2022.3.0/redist/intel64/vc14")" - if [[ -x "${SYCL_ROOT}/bin/icx.exe" ]]; then cc_path="${SYCL_ROOT}/bin/icx.exe" elif [[ -x "${SYCL_ROOT}/bin/icx-cl.exe" ]]; then @@ -154,17 +128,6 @@ if [[ "${RUNNER_OS}" == "Windows" ]]; then write_env ITLABAI_CMAKE_PREFIX_PATH "$(cygpath -m "${SYCL_ROOT}")" append_path "$(cygpath -m "${SYCL_ROOT}/bin")" else - tbb_archive="${RUNNER_TEMP}/${TBB_ASSET}" - tbb_extract_dir="${RUNNER_TEMP}/oneapi-tbb" - curl -fsSL \ - "https://github.com/uxlfoundation/oneTBB/releases/download/${TBB_TAG}/${TBB_ASSET}" \ - -o "${tbb_archive}" - mkdir -p "${tbb_extract_dir}" - tar -xzf "${tbb_archive}" -C "${tbb_extract_dir}" - - write_env ITLABAI_TBB_DIR "${tbb_extract_dir}/oneapi-tbb-2022.3.0" - write_env LD_LIBRARY_PATH "${tbb_extract_dir}/oneapi-tbb-2022.3.0/lib/intel64/gcc4.8:${LD_LIBRARY_PATH:-}" - if [[ -x "${SYCL_ROOT}/bin/icx" ]]; then write_env ITLABAI_CC "${SYCL_ROOT}/bin/icx" elif [[ -x "${SYCL_ROOT}/bin/clang" ]]; then diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fb5ac2bfe..142773ef3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,8 +15,6 @@ target_include_directories(run_test PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(run_test PRIVATE "${CMAKE_SOURCE_DIR}/app/ReaderImage") if (WIN32) - target_compile_definitions(run_test PRIVATE _CRT_SECURE_NO_WARNINGS) - add_custom_command(TARGET run_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ diff --git a/test/main.cpp b/test/main.cpp index a4eba4de1..230c7999e 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,20 +1,20 @@ #include -#include #include #include +#include "utils/env.hpp" + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); - const char* flaky_disabled = std::getenv("DISABLE_FLAKY_TESTS"); + const std::string flaky_disabled = test_utils::get_env("DISABLE_FLAKY_TESTS"); bool flaky_enabled = - (flaky_disabled == nullptr) || (std::strcmp(flaky_disabled, "1") != 0 && - std::strcmp(flaky_disabled, "true") != 0); + flaky_disabled.empty() || (flaky_disabled != "1" && flaky_disabled != "true"); if (flaky_enabled) { - const char* retries = std::getenv("FLAKY_RETRIES"); - int retry_count = retries ? std::atoi(retries) : 10; + const std::string retries = test_utils::get_env("FLAKY_RETRIES"); + int retry_count = retries.empty() ? 10 : std::atoi(retries.c_str()); std::cout << "Flaky test support enabled. Max retries: " << retry_count << '\n'; std::cout << "Use FLAKY_TEST/FLAKY_TEST_F macros to create flaky tests." diff --git a/test/utils/env.hpp b/test/utils/env.hpp new file mode 100644 index 000000000..a91ed167e --- /dev/null +++ b/test/utils/env.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include +#include + +namespace test_utils { + +inline std::string get_env(const char* name) { +#ifdef _WIN32 + char* value = nullptr; + std::size_t size = 0; + if (_dupenv_s(&value, &size, name) != 0 || value == nullptr) { + return {}; + } + + std::string result(value); + free(value); + return result; +#else + const char* value = std::getenv(name); + return value == nullptr ? std::string() : std::string(value); +#endif +} + +} // namespace test_utils diff --git a/test/utils/flaky_test_runner.hpp b/test/utils/flaky_test_runner.hpp index 36aa19ad4..8c621af91 100644 --- a/test/utils/flaky_test_runner.hpp +++ b/test/utils/flaky_test_runner.hpp @@ -2,15 +2,16 @@ #include -#include #include #include +#include "env.hpp" + namespace test_utils { static int getFlakyRetries() { - const char* retry_env = std::getenv("FLAKY_RETRIES"); - if (retry_env != nullptr) { + const std::string retry_env = get_env("FLAKY_RETRIES"); + if (!retry_env.empty()) { try { int retries = std::stoi(retry_env); return std::max(1, std::min(retries, 100)); @@ -22,11 +23,11 @@ static int getFlakyRetries() { } static bool isFlakyTestsEnabled() { - const char* disabled = std::getenv("DISABLE_FLAKY_TESTS"); - if (disabled == nullptr) { + const std::string disabled = get_env("DISABLE_FLAKY_TESTS"); + if (disabled.empty()) { return true; } - return std::strcmp(disabled, "1") != 0 && std::strcmp(disabled, "true") != 0; + return disabled != "1" && disabled != "true"; } template From cce72cd644fd6bb002ff0faa21de82e97365dbcb Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 21:13:21 +0100 Subject: [PATCH 042/104] Move vendored OpenCV build to ExternalProject --- app/Accuracy/CMakeLists.txt | 13 +-- app/Graph/CMakeLists.txt | 7 +- app/ReaderImage/CMakeLists.txt | 8 +- cmake/opencv_config.cmake | 187 +++++++++++++++++++++++++++++---- 4 files changed, 172 insertions(+), 43 deletions(-) diff --git a/app/Accuracy/CMakeLists.txt b/app/Accuracy/CMakeLists.txt index ae3deee38..0029341cc 100644 --- a/app/Accuracy/CMakeLists.txt +++ b/app/Accuracy/CMakeLists.txt @@ -3,14 +3,11 @@ set(SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/acc.cpp") add_library(ACCLib STATIC ${INCLUDE_HEADERS} ${SRC_FILES}) set_target_properties(ReadLib PROPERTIES LINKER_LANGUAGE CXX) - -find_package( OpenCV REQUIRED PATHS "${OPENCV_BUILD_DIR}" ) -include_directories( ${OpenCV_INCLUDE_DIRS} ) -target_link_libraries( ACCLib ${OpenCV_LIBS} ) -target_link_libraries( ACCLib TBB_unified) -target_link_libraries( ACCLib layers_lib) -target_link_libraries( ACCLib gtest_main) -target_link_libraries( ACCLib Kokkos_imported) +target_link_libraries(ACCLib PUBLIC OpenCV_unified) +target_link_libraries(ACCLib PUBLIC TBB_unified) +target_link_libraries(ACCLib PUBLIC layers_lib) +target_link_libraries(ACCLib PUBLIC gtest_main) +target_link_libraries(ACCLib PUBLIC Kokkos_imported) add_executable(Accuracy_Check accuracy_check.cpp) target_link_libraries(Accuracy_Check ACCLib) diff --git a/app/Graph/CMakeLists.txt b/app/Graph/CMakeLists.txt index 218e511bf..bf413896c 100644 --- a/app/Graph/CMakeLists.txt +++ b/app/Graph/CMakeLists.txt @@ -3,11 +3,7 @@ set(SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/build.cpp") add_library(BuildGraph STATIC ${INCLUDE_HEADERS} ${SRC_FILES}) set_target_properties(BuildGraph PROPERTIES LINKER_LANGUAGE CXX) - -find_package(OpenCV REQUIRED PATHS "${OPENCV_BUILD_DIR}") -include_directories(${OpenCV_INCLUDE_DIRS}) - -target_link_libraries(BuildGraph PUBLIC ${OpenCV_LIBS}) +target_link_libraries(BuildGraph PUBLIC OpenCV_unified) target_link_libraries(BuildGraph PUBLIC reader_lib) target_link_libraries(BuildGraph PUBLIC TBB_unified) target_link_libraries(BuildGraph PUBLIC layers_lib) @@ -26,7 +22,6 @@ target_link_libraries(ACC BuildGraph) add_executable(onnx_subgraphs onnx_subgraphs.cpp) target_link_libraries(onnx_subgraphs BuildGraph) target_link_libraries(onnx_subgraphs OpenMP::OpenMP_CXX) -target_link_libraries(onnx_subgraphs ${OpenCV_LIBS}) target_link_libraries(onnx_subgraphs graphT_lib) file(DOWNLOAD diff --git a/app/ReaderImage/CMakeLists.txt b/app/ReaderImage/CMakeLists.txt index 4a2ddb2ed..2ba86b27d 100644 --- a/app/ReaderImage/CMakeLists.txt +++ b/app/ReaderImage/CMakeLists.txt @@ -2,13 +2,9 @@ set(INCLUDE_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/reader_img.hpp") set(SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/reader_img_s.cpp") add_library(ReadLib STATIC ${INCLUDE_HEADERS} ${SRC_FILES}) - set_target_properties(ReadLib PROPERTIES LINKER_LANGUAGE CXX) - -find_package( OpenCV REQUIRED PATHS "${OPENCV_BUILD_DIR}" ) -include_directories( ${OpenCV_INCLUDE_DIRS} ) -target_link_libraries( ReadLib ${OpenCV_LIBS} ) -target_link_libraries( ReadLib TBB_unified) +target_link_libraries(ReadLib PUBLIC OpenCV_unified) +target_link_libraries(ReadLib PUBLIC TBB_unified) add_executable(Reader reader_img.cpp) target_link_libraries(Reader ReadLib) diff --git a/cmake/opencv_config.cmake b/cmake/opencv_config.cmake index b5d20bc69..06c86436f 100644 --- a/cmake/opencv_config.cmake +++ b/cmake/opencv_config.cmake @@ -1,30 +1,171 @@ +include(ExternalProject) +include(GNUInstallDirs) + set(OPENCV_BUILD_DIR "${CMAKE_BINARY_DIR}/3rdparty/opencv_build") -file(MAKE_DIRECTORY "${OPENCV_BUILD_DIR}") - -execute_process( - COMMAND ${CMAKE_COMMAND} - -S "${CMAKE_SOURCE_DIR}/3rdparty/opencv" - -B "${OPENCV_BUILD_DIR}" - -G "${CMAKE_GENERATOR}" - -DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER} - -DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} - -DBUILD_PERF_TESTS=OFF - -DBUILD_TESTS=OFF - -DBUILD_opencv_apps=OFF - -DBUILD_JAVA=OFF - WORKING_DIRECTORY "${OPENCV_BUILD_DIR}" -) +set(OPENCV_INSTALL_DIR "${CMAKE_BINARY_DIR}/3rdparty/opencv_install") + +set(OPENCV_C_COMPILER "${CMAKE_C_COMPILER}") +set(OPENCV_CXX_COMPILER "${CMAKE_CXX_COMPILER}") + +get_filename_component(OPENCV_CXX_COMPILER_NAME "${CMAKE_CXX_COMPILER}" NAME) +string(TOLOWER "${OPENCV_CXX_COMPILER_NAME}" OPENCV_CXX_COMPILER_NAME_LOWER) + +if(OPENCV_CXX_COMPILER_NAME_LOWER STREQUAL "acpp" + OR OPENCV_CXX_COMPILER_NAME_LOWER STREQUAL "syclcc") + get_filename_component(OPENCV_HOST_COMPILER_DIR "${CMAKE_C_COMPILER}" DIRECTORY) + unset(OPENCV_CXX_COMPILER) + find_program(OPENCV_CXX_COMPILER + NAMES clang++ + PATHS "${OPENCV_HOST_COMPILER_DIR}" + NO_DEFAULT_PATH + ) + + if(NOT OPENCV_CXX_COMPILER) + find_program(OPENCV_CXX_COMPILER NAMES clang++) + endif() + + if(NOT OPENCV_CXX_COMPILER) + message(FATAL_ERROR + "Unable to locate a host C++ compiler for the OpenCV external build") + endif() +endif() -execute_process( - COMMAND ${CMAKE_COMMAND} --build "${OPENCV_BUILD_DIR}" --config "${CMAKE_BUILD_TYPE}" - WORKING_DIRECTORY "${OPENCV_BUILD_DIR}" +set(OPENCV_INITIAL_CACHE "${CMAKE_BINARY_DIR}/3rdparty/opencv_initial_cache.cmake") +file(WRITE "${OPENCV_INITIAL_CACHE}" "") +file(APPEND "${OPENCV_INITIAL_CACHE}" + "set(CMAKE_C_COMPILER \"${OPENCV_C_COMPILER}\" CACHE FILEPATH \"\" FORCE)\n") +file(APPEND "${OPENCV_INITIAL_CACHE}" + "set(CMAKE_CXX_COMPILER \"${OPENCV_CXX_COMPILER}\" CACHE FILEPATH \"\" FORCE)\n") + +set(OPENCV_CMAKE_ARGS + -C "${OPENCV_INITIAL_CACHE}" + -G "${CMAKE_GENERATOR}" + -DCMAKE_C_COMPILER:FILEPATH=${OPENCV_C_COMPILER} + -DCMAKE_CXX_COMPILER:FILEPATH=${OPENCV_CXX_COMPILER} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_INSTALL_PREFIX=${OPENCV_INSTALL_DIR} + -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} + -DBUILD_PERF_TESTS=OFF + -DBUILD_TESTS=OFF + -DBUILD_opencv_apps=OFF + -DBUILD_opencv_java=OFF + -DBUILD_opencv_js=OFF + -DBUILD_opencv_objc=OFF + -DBUILD_opencv_python2=OFF + -DBUILD_opencv_python3=OFF + -DBUILD_JAVA=OFF + -DBUILD_opencv_world=ON + -DWITH_FFMPEG=OFF + -DWITH_EIGEN=OFF ) +if(APPLE) + list(APPEND OPENCV_CMAKE_ARGS + -DWITH_AVIF=OFF + -DWITH_OPENEXR=OFF + ) +endif() + +if(CMAKE_C_COMPILER_LAUNCHER) + list(APPEND OPENCV_CMAKE_ARGS + -DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}) +endif() + +if(CMAKE_CXX_COMPILER_LAUNCHER) + list(APPEND OPENCV_CMAKE_ARGS + -DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}) +endif() + +set(OPENCV_VERSION_FILE + "${CMAKE_SOURCE_DIR}/3rdparty/opencv/modules/core/include/opencv2/core/version.hpp") +file(STRINGS "${OPENCV_VERSION_FILE}" OPENCV_VERSION_PARTS + REGEX "#define CV_VERSION_[A-Z]+[ ]+") +string(REGEX REPLACE ".+CV_VERSION_MAJOR[ ]+([0-9]+).*" "\\1" + OPENCV_VERSION_MAJOR "${OPENCV_VERSION_PARTS}") +string(REGEX REPLACE ".+CV_VERSION_MINOR[ ]+([0-9]+).*" "\\1" + OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}") +string(REGEX REPLACE ".+CV_VERSION_REVISION[ ]+([0-9]+).*" "\\1" + OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}") + +set(OPENCV_WORLD_TARGET_NAME "opencv_world") +set(OPENCV_WORLD_IMPORT_NAME "${OPENCV_WORLD_TARGET_NAME}") +set(OPENCV_WORLD_RUNTIME_NAME "${OPENCV_WORLD_TARGET_NAME}") + if(WIN32) - file(GLOB OPENCV_DLLS "${OPENCV_BUILD_DIR}/bin/*.dll") - if(OPENCV_DLLS) - file(COPY ${OPENCV_DLLS} DESTINATION "${CMAKE_BINARY_DIR}/bin") + set(OPENCV_WORLD_IMPORT_NAME + "${OPENCV_WORLD_TARGET_NAME}${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}") + set(OPENCV_WORLD_RUNTIME_NAME "${OPENCV_WORLD_IMPORT_NAME}") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + string(APPEND OPENCV_WORLD_IMPORT_NAME "d") + string(APPEND OPENCV_WORLD_RUNTIME_NAME "d") endif() endif() + +set(OPENCV_LIBRARY_DIR "${OPENCV_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}") +set(OPENCV_RUNTIME_DIR "${OPENCV_INSTALL_DIR}/${CMAKE_INSTALL_BINDIR}") +set(OPENCV_INCLUDE_DIR "${OPENCV_INSTALL_DIR}/include/opencv4") + +if(WIN32) + set(OPENCV_WORLD_IMPLIB + "${OPENCV_LIBRARY_DIR}/${OPENCV_WORLD_IMPORT_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}") + set(OPENCV_WORLD_RUNTIME + "${OPENCV_RUNTIME_DIR}/${OPENCV_WORLD_RUNTIME_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}") +else() + set(OPENCV_WORLD_IMPLIB + "${OPENCV_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${OPENCV_WORLD_IMPORT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}") + set(OPENCV_WORLD_RUNTIME "${OPENCV_WORLD_IMPLIB}") +endif() + +set(OPENCV_INSTALL_BYPRODUCTS "${OPENCV_WORLD_IMPLIB}") +if(NOT OPENCV_WORLD_RUNTIME STREQUAL OPENCV_WORLD_IMPLIB) + list(APPEND OPENCV_INSTALL_BYPRODUCTS "${OPENCV_WORLD_RUNTIME}") +endif() + +ExternalProject_Add( + opencv_external + SOURCE_DIR "${CMAKE_SOURCE_DIR}/3rdparty/opencv" + BINARY_DIR "${OPENCV_BUILD_DIR}" + INSTALL_DIR "${OPENCV_INSTALL_DIR}" + CMAKE_ARGS ${OPENCV_CMAKE_ARGS} + INSTALL_BYPRODUCTS ${OPENCV_INSTALL_BYPRODUCTS} + BUILD_ALWAYS OFF + LOG_CONFIGURE ON + LOG_BUILD ON + LOG_INSTALL ON +) + +add_library(opencv_world_external SHARED IMPORTED GLOBAL) +add_dependencies(opencv_world_external opencv_external) +set_target_properties(opencv_world_external PROPERTIES + IMPORTED_LOCATION "${OPENCV_WORLD_RUNTIME}" + INTERFACE_INCLUDE_DIRECTORIES "${OPENCV_INCLUDE_DIR}" +) + +if(WIN32) + set_target_properties(opencv_world_external PROPERTIES + IMPORTED_IMPLIB "${OPENCV_WORLD_IMPLIB}" + ) +endif() + +add_library(OpenCV_unified INTERFACE) +add_dependencies(OpenCV_unified opencv_external) +target_include_directories(OpenCV_unified INTERFACE "${OPENCV_INCLUDE_DIR}") +target_link_libraries(OpenCV_unified INTERFACE opencv_world_external) + +if(CMAKE_BUILD_RPATH) + set(CMAKE_BUILD_RPATH "${OPENCV_LIBRARY_DIR};${CMAKE_BUILD_RPATH}") +else() + set(CMAKE_BUILD_RPATH "${OPENCV_LIBRARY_DIR}") +endif() + +if(WIN32) + add_custom_target(copy_opencv_runtime ALL + COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${OPENCV_WORLD_RUNTIME}" + "${CMAKE_BINARY_DIR}/bin/" + DEPENDS opencv_external + COMMENT "Copying OpenCV runtime library" + ) + add_dependencies(OpenCV_unified copy_opencv_runtime) +endif() From 1f86f169652457f9e2563050683ed3d3855b6d3c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 21:25:42 +0100 Subject: [PATCH 043/104] Fix Linux SYCL OpenMP detection --- scripts/ci/sycl-configure.sh | 12 ++++++++++++ scripts/ci/sycl-x86-setup.sh | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/scripts/ci/sycl-configure.sh b/scripts/ci/sycl-configure.sh index bca5d1e61..a3232f8cc 100755 --- a/scripts/ci/sycl-configure.sh +++ b/scripts/ci/sycl-configure.sh @@ -13,8 +13,20 @@ if [[ "${RUNNER_OS}" != "Windows" ]]; then ) fi +openmp_args=() +if [[ -n "${ITLABAI_OPENMP_FLAGS:-}" ]]; then + openmp_args+=(-DOpenMP_CXX_FLAGS="${ITLABAI_OPENMP_FLAGS}") +fi +if [[ -n "${ITLABAI_OPENMP_LIBRARY:-}" ]]; then + openmp_args+=( + -DOpenMP_CXX_LIB_NAMES=iomp5 + -DOpenMP_iomp5_LIBRARY="${ITLABAI_OPENMP_LIBRARY}" + ) +fi + cmake -S . -B build -G Ninja \ "${launcher_args[@]}" \ + "${openmp_args[@]}" \ -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${build_type}" \ diff --git a/scripts/ci/sycl-x86-setup.sh b/scripts/ci/sycl-x86-setup.sh index c56028950..30e535a51 100755 --- a/scripts/ci/sycl-x86-setup.sh +++ b/scripts/ci/sycl-x86-setup.sh @@ -149,6 +149,17 @@ else write_env ITLABAI_CMAKE_PREFIX_PATH "${SYCL_ROOT}" append_path "${SYCL_ROOT}/bin" + if [[ "${RUNNER_OS}" == "Linux" ]]; then + openmp_library="$(find "${SYCL_ROOT}" /opt/intel/oneapi -name 'libiomp5.so' -print -quit 2>/dev/null || true)" + if [[ -z "${openmp_library}" ]]; then + echo "Unable to locate libiomp5.so for the SYCL toolchain" >&2 + exit 1 + fi + + write_env ITLABAI_OPENMP_FLAGS -qopenmp + write_env ITLABAI_OPENMP_LIBRARY "${openmp_library}" + fi + if [[ -d "${SYCL_ROOT}/lib" ]]; then write_env LD_LIBRARY_PATH "${SYCL_ROOT}/lib:${LD_LIBRARY_PATH:-}" write_env DYLD_LIBRARY_PATH "${SYCL_ROOT}/lib:${DYLD_LIBRARY_PATH:-}" From 4b8b3deaaec0c8b733a608c2407e01e86e2dee4f Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Tue, 17 Mar 2026 21:43:37 +0100 Subject: [PATCH 044/104] Fix PR CI regressions --- app/SYCL/sycl_example.cpp | 4 ++-- app/SYCL/sycl_kernel.cpp | 4 ++-- scripts/ci/sycl-configure.sh | 12 +++++------- scripts/ci/sycl-x86-setup.sh | 8 ++++---- src/Weights_Reader/reader_weights.cpp | 2 +- test/main.cpp | 4 ++-- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/SYCL/sycl_example.cpp b/app/SYCL/sycl_example.cpp index aafbbf7bd..703969b65 100644 --- a/app/SYCL/sycl_example.cpp +++ b/app/SYCL/sycl_example.cpp @@ -4,8 +4,8 @@ #include #if __has_include() -#include -#define ITLABAI_HAS_SYCL_HEADERS 1 +# include +# define ITLABAI_HAS_SYCL_HEADERS 1 #endif #include "graph/runtime_options.hpp" diff --git a/app/SYCL/sycl_kernel.cpp b/app/SYCL/sycl_kernel.cpp index 164f6930a..089cd1620 100644 --- a/app/SYCL/sycl_kernel.cpp +++ b/app/SYCL/sycl_kernel.cpp @@ -1,8 +1,8 @@ #include #if __has_include() -#include -#define ITLABAI_HAS_SYCL_HEADERS 1 +# include +# define ITLABAI_HAS_SYCL_HEADERS 1 #endif #if defined(ITLABAI_HAS_SYCL_HEADERS) diff --git a/scripts/ci/sycl-configure.sh b/scripts/ci/sycl-configure.sh index a3232f8cc..6b093648a 100755 --- a/scripts/ci/sycl-configure.sh +++ b/scripts/ci/sycl-configure.sh @@ -5,28 +5,26 @@ build_type="${1:?build type is required}" sycl_targets="${2:?sycl targets are required}" opencv_apps="${3:?opencv apps toggle is required}" -launcher_args=() +cmake_args=() if [[ "${RUNNER_OS}" != "Windows" ]]; then - launcher_args+=( + cmake_args+=( -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ) fi -openmp_args=() if [[ -n "${ITLABAI_OPENMP_FLAGS:-}" ]]; then - openmp_args+=(-DOpenMP_CXX_FLAGS="${ITLABAI_OPENMP_FLAGS}") + cmake_args+=(-DOpenMP_CXX_FLAGS="${ITLABAI_OPENMP_FLAGS}") fi if [[ -n "${ITLABAI_OPENMP_LIBRARY:-}" ]]; then - openmp_args+=( + cmake_args+=( -DOpenMP_CXX_LIB_NAMES=iomp5 -DOpenMP_iomp5_LIBRARY="${ITLABAI_OPENMP_LIBRARY}" ) fi cmake -S . -B build -G Ninja \ - "${launcher_args[@]}" \ - "${openmp_args[@]}" \ + "${cmake_args[@]}" \ -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ -DCMAKE_BUILD_TYPE="${build_type}" \ diff --git a/scripts/ci/sycl-x86-setup.sh b/scripts/ci/sycl-x86-setup.sh index 30e535a51..ae5d5016d 100755 --- a/scripts/ci/sycl-x86-setup.sh +++ b/scripts/ci/sycl-x86-setup.sh @@ -101,10 +101,10 @@ if [[ "${RUNNER_OS}" == "Windows" ]]; then cc_path="${SYCL_ROOT}/bin/icx.exe" elif [[ -x "${SYCL_ROOT}/bin/icx-cl.exe" ]]; then cc_path="${SYCL_ROOT}/bin/icx-cl.exe" - elif [[ -x "${SYCL_ROOT}/bin/clang.exe" ]]; then - cc_path="${SYCL_ROOT}/bin/clang.exe" elif [[ -x "${SYCL_ROOT}/bin/clang-cl.exe" ]]; then cc_path="${SYCL_ROOT}/bin/clang-cl.exe" + elif [[ -x "${SYCL_ROOT}/bin/clang.exe" ]]; then + cc_path="${SYCL_ROOT}/bin/clang.exe" else echo "Unable to locate a C compiler in ${SYCL_ROOT}/bin" >&2 exit 1 @@ -114,10 +114,10 @@ if [[ "${RUNNER_OS}" == "Windows" ]]; then cxx_path="${SYCL_ROOT}/bin/icpx.exe" elif [[ -x "${SYCL_ROOT}/bin/icx-cl.exe" ]]; then cxx_path="${SYCL_ROOT}/bin/icx-cl.exe" - elif [[ -x "${SYCL_ROOT}/bin/clang++.exe" ]]; then - cxx_path="${SYCL_ROOT}/bin/clang++.exe" elif [[ -x "${SYCL_ROOT}/bin/clang-cl.exe" ]]; then cxx_path="${SYCL_ROOT}/bin/clang-cl.exe" + elif [[ -x "${SYCL_ROOT}/bin/clang++.exe" ]]; then + cxx_path="${SYCL_ROOT}/bin/clang++.exe" else echo "Unable to locate a C++ compiler in ${SYCL_ROOT}/bin" >&2 exit 1 diff --git a/src/Weights_Reader/reader_weights.cpp b/src/Weights_Reader/reader_weights.cpp index 8b41bba0e..16a9bae9f 100644 --- a/src/Weights_Reader/reader_weights.cpp +++ b/src/Weights_Reader/reader_weights.cpp @@ -50,7 +50,7 @@ json read_json(const std::string& filename) { throw std::runtime_error("Cannot open file: " + filename); } - struct stat sb {}; + struct stat sb{}; fstat(fd, &sb); if (sb.st_size == 0) { diff --git a/test/main.cpp b/test/main.cpp index 230c7999e..c8572711f 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -9,8 +9,8 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); const std::string flaky_disabled = test_utils::get_env("DISABLE_FLAKY_TESTS"); - bool flaky_enabled = - flaky_disabled.empty() || (flaky_disabled != "1" && flaky_disabled != "true"); + bool flaky_enabled = flaky_disabled.empty() || + (flaky_disabled != "1" && flaky_disabled != "true"); if (flaky_enabled) { const std::string retries = test_utils::get_env("FLAKY_RETRIES"); From cb4a446ad1ed8a5b92a1a9690ca45dc49eeba508 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 18 Mar 2026 16:39:12 +0100 Subject: [PATCH 045/104] Fix CI regressions in static analysis and SYCL --- .github/workflows/static-analysis.yml | 3 ++- app/SYCL/.clang-tidy | 10 --------- cmake/opencv_config.cmake | 31 +++++++++++++++++++++++++-- include/perf/benchmarking.hpp | 22 +++++++++++-------- scripts/ci/sycl-x86-setup.sh | 2 +- src/Weights_Reader/reader_weights.cpp | 2 +- 6 files changed, 46 insertions(+), 24 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index c702c448f..4381d90f8 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -27,4 +27,5 @@ jobs: cmake --build build --parallel - name: Run clang-tidy run: | - clang-tidy app/**/*.cpp src/**/*.cpp -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build + mapfile -t sources < <(find app src -path 'app/SYCL' -prune -o -name '*.cpp' -print) + clang-tidy "${sources[@]}" -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build diff --git a/app/SYCL/.clang-tidy b/app/SYCL/.clang-tidy index c87a077de..672969109 100644 --- a/app/SYCL/.clang-tidy +++ b/app/SYCL/.clang-tidy @@ -1,12 +1,2 @@ Checks: '-*,misc-unused-parameters' WarningsAsErrors: '' -ExtraArgs: - - -std=c++20 - - -Iinclude - - -Iapp - - -I3rdparty/TBB/include - - -I3rdparty/kokkos/core/src - - -I3rdparty/kokkos/containers/src - - -I3rdparty/kokkos/algorithms/src - - -I3rdparty/kokkos/simd/src - - -Ibuild/3rdparty/kokkos_install/include diff --git a/cmake/opencv_config.cmake b/cmake/opencv_config.cmake index 06c86436f..03f6f5f51 100644 --- a/cmake/opencv_config.cmake +++ b/cmake/opencv_config.cmake @@ -90,8 +90,33 @@ string(REGEX REPLACE ".+CV_VERSION_REVISION[ ]+([0-9]+).*" "\\1" set(OPENCV_WORLD_TARGET_NAME "opencv_world") set(OPENCV_WORLD_IMPORT_NAME "${OPENCV_WORLD_TARGET_NAME}") set(OPENCV_WORLD_RUNTIME_NAME "${OPENCV_WORLD_TARGET_NAME}") +set(OPENCV_INSTALL_BINARIES_PREFIX "") if(WIN32) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(OPENCV_ARCH x64) + else() + set(OPENCV_ARCH x86) + endif() + + if(MSVC) + if(MSVC_VERSION GREATER_EQUAL 1930) + set(OPENCV_RUNTIME vc17) + elseif(MSVC_VERSION GREATER_EQUAL 1920) + set(OPENCV_RUNTIME vc16) + elseif(MSVC_VERSION GREATER_EQUAL 1910) + set(OPENCV_RUNTIME vc15) + else() + set(OPENCV_RUNTIME vc14) + endif() + elseif(MINGW) + set(OPENCV_RUNTIME mingw) + endif() + + if(DEFINED OPENCV_ARCH AND DEFINED OPENCV_RUNTIME) + set(OPENCV_INSTALL_BINARIES_PREFIX "${OPENCV_ARCH}/${OPENCV_RUNTIME}/") + endif() + set(OPENCV_WORLD_IMPORT_NAME "${OPENCV_WORLD_TARGET_NAME}${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}") set(OPENCV_WORLD_RUNTIME_NAME "${OPENCV_WORLD_IMPORT_NAME}") @@ -101,8 +126,10 @@ if(WIN32) endif() endif() -set(OPENCV_LIBRARY_DIR "${OPENCV_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}") -set(OPENCV_RUNTIME_DIR "${OPENCV_INSTALL_DIR}/${CMAKE_INSTALL_BINDIR}") +set(OPENCV_LIBRARY_DIR + "${OPENCV_INSTALL_DIR}/${OPENCV_INSTALL_BINARIES_PREFIX}${CMAKE_INSTALL_LIBDIR}") +set(OPENCV_RUNTIME_DIR + "${OPENCV_INSTALL_DIR}/${OPENCV_INSTALL_BINARIES_PREFIX}${CMAKE_INSTALL_BINDIR}") set(OPENCV_INCLUDE_DIR "${OPENCV_INSTALL_DIR}/include/opencv4") if(WIN32) diff --git a/include/perf/benchmarking.hpp b/include/perf/benchmarking.hpp index c0ee374d6..e63b57c6e 100644 --- a/include/perf/benchmarking.hpp +++ b/include/perf/benchmarking.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include namespace it_lab_ai { @@ -16,7 +17,7 @@ template (); auto start = std::chrono::high_resolution_clock::now(); - func(args...); + std::forward(func)(std::forward(args)...); auto end = std::chrono::high_resolution_clock::now(); duration = end - start; return duration.count(); @@ -26,7 +27,7 @@ DurationContainerType elapsed_time(Function&& func, Args&&... args) { template double elapsed_time_omp(Function&& func, Args&&... args) { double start = omp_get_wtime(); - func(args...); + std::forward(func)(std::forward(args)...); double end = omp_get_wtime(); return end - start; } @@ -38,7 +39,7 @@ DurationContainerType elapsed_time_avg(const size_t iters, Function&& func, auto duration = std::chrono::duration(); auto start = std::chrono::high_resolution_clock::now(); for (size_t i = 0; i < iters; i++) { - func(args...); + std::forward(func)(std::forward(args)...); } auto end = std::chrono::high_resolution_clock::now(); duration = (end - start) / iters; @@ -51,7 +52,7 @@ double elapsed_time_omp_avg(const size_t iters, Function&& func, Args&&... args) { double start = omp_get_wtime(); for (size_t i = 0; i < iters; i++) { - func(args...); + std::forward(func)(std::forward(args)...); } double end = omp_get_wtime(); return (end - start) / iters; @@ -61,12 +62,14 @@ template ThroughputContainerType throughput(Function&& func, Args&&... args) { return ThroughputContainerType(1) / - elapsed_time(func, args...); + elapsed_time( + std::forward(func), std::forward(args)...); } template double throughput_omp(Function&& func, Args&&... args) { - return 1 / elapsed_time_omp(func, args...); + return 1 / elapsed_time_omp(std::forward(func), + std::forward(args)...); } template (iters, func, - args...); + elapsed_time_avg( + iters, std::forward(func), std::forward(args)...); } template double throughput_omp_avg(const size_t iters, Function&& func, Args&&... args) { - return 1 / elapsed_time_omp_avg(iters, func, args...); + return 1 / elapsed_time_omp_avg(iters, std::forward(func), + std::forward(args)...); } // as "Manhattan" norm of error-vector diff --git a/scripts/ci/sycl-x86-setup.sh b/scripts/ci/sycl-x86-setup.sh index ae5d5016d..02534a439 100755 --- a/scripts/ci/sycl-x86-setup.sh +++ b/scripts/ci/sycl-x86-setup.sh @@ -156,7 +156,7 @@ else exit 1 fi - write_env ITLABAI_OPENMP_FLAGS -qopenmp + write_env ITLABAI_OPENMP_FLAGS -fopenmp write_env ITLABAI_OPENMP_LIBRARY "${openmp_library}" fi diff --git a/src/Weights_Reader/reader_weights.cpp b/src/Weights_Reader/reader_weights.cpp index 16a9bae9f..8d5517374 100644 --- a/src/Weights_Reader/reader_weights.cpp +++ b/src/Weights_Reader/reader_weights.cpp @@ -1,4 +1,4 @@ -#include "Weights_Reader/reader_weights.hpp" +#include "Weights_Reader/reader_weights.hpp" #include #include From b3b32332a4d8af2e7c1cfae47553b2f488111a88 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 18 Mar 2026 16:43:24 +0100 Subject: [PATCH 046/104] Limit clang-format CI to changed files --- .github/workflows/ci.yml | 10 ++++++++-- scripts/ci/clang-format-check.sh | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 scripts/ci/clang-format-check.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c73d242e1..27bbbc906 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: DoozyX/clang-format-lint-action@v0.15 with: - source: './app ./include ./src ./test' + fetch-depth: 0 + - name: Install clang-format + run: sudo apt-get update && sudo apt-get install -y clang-format-18 + - name: Run clang-format + env: + BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} + HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + run: ./scripts/ci/clang-format-check.sh "${BASE_SHA}" "${HEAD_SHA}" build-linux: strategy: matrix: diff --git a/scripts/ci/clang-format-check.sh b/scripts/ci/clang-format-check.sh new file mode 100755 index 000000000..019b4cd1c --- /dev/null +++ b/scripts/ci/clang-format-check.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +base_ref="${1:-}" +head_ref="${2:-HEAD}" + +if [[ -z "${base_ref}" || "${base_ref}" =~ ^0+$ ]]; then + base_ref="$(git rev-parse "${head_ref}^")" +fi + +mapfile -t files < <( + git diff --name-only --diff-filter=ACMR "${base_ref}" "${head_ref}" -- app include src test \ + | grep -E '\.(c|h|C|H|cpp|hpp|cc|hh|c\+\+|h\+\+|cxx|hxx)$' \ + || true +) + +if [[ "${#files[@]}" -eq 0 ]]; then + echo "No source files changed." + exit 0 +fi + +clang_format_bin="${CLANG_FORMAT_BIN:-clang-format-18}" + +"${clang_format_bin}" --dry-run -Werror "${files[@]}" From e3fb4f2206484ef662e9d7fa9f21459a8fc9e69d Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 18 Mar 2026 16:46:34 +0100 Subject: [PATCH 047/104] Fix PR clang-format ref handling --- .github/workflows/ci.yml | 12 ++++++++++++ .github/workflows/static-analysis.yml | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27bbbc906..3d6be9c68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,9 @@ name: CI +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + on: push: pull_request: @@ -16,6 +20,14 @@ jobs: fetch-depth: 0 - name: Install clang-format run: sudo apt-get update && sudo apt-get install -y clang-format-18 + - name: Fetch diff refs + env: + BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} + HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + run: | + if [[ -n "${BASE_SHA}" ]]; then + git fetch --no-tags origin "${BASE_SHA}" "${HEAD_SHA}" + fi - name: Run clang-format env: BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 4381d90f8..c3af2e4c6 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,5 +1,9 @@ name: Static analysis +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + on: [pull_request] jobs: From e8b2cf466da1ce1e9d4aa1abf4468e9caf22105a Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 18 Mar 2026 19:08:31 +0100 Subject: [PATCH 048/104] Fix Windows OpenCV build ordering --- app/Accuracy/CMakeLists.txt | 2 ++ app/Graph/CMakeLists.txt | 4 ++++ app/ReaderImage/CMakeLists.txt | 2 ++ cmake/opencv_config.cmake | 10 +++++++++- src/Weights_Reader/reader_weights.cpp | 2 +- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/Accuracy/CMakeLists.txt b/app/Accuracy/CMakeLists.txt index 0029341cc..9622012c1 100644 --- a/app/Accuracy/CMakeLists.txt +++ b/app/Accuracy/CMakeLists.txt @@ -8,9 +8,11 @@ target_link_libraries(ACCLib PUBLIC TBB_unified) target_link_libraries(ACCLib PUBLIC layers_lib) target_link_libraries(ACCLib PUBLIC gtest_main) target_link_libraries(ACCLib PUBLIC Kokkos_imported) +add_dependencies(ACCLib opencv_external) add_executable(Accuracy_Check accuracy_check.cpp) target_link_libraries(Accuracy_Check ACCLib) +add_dependencies(Accuracy_Check opencv_external) file(DOWNLOAD "https://raw.githubusercontent.com/opencv/opencv/4.x/samples/data/lena.jpg" diff --git a/app/Graph/CMakeLists.txt b/app/Graph/CMakeLists.txt index bf413896c..49c49a135 100644 --- a/app/Graph/CMakeLists.txt +++ b/app/Graph/CMakeLists.txt @@ -10,19 +10,23 @@ target_link_libraries(BuildGraph PUBLIC layers_lib) target_link_libraries(BuildGraph PUBLIC layers_fused_lib) target_link_libraries(BuildGraph PUBLIC layers_oneDNN_lib) target_link_libraries(BuildGraph PUBLIC gtest_main) +add_dependencies(BuildGraph opencv_external) target_include_directories(BuildGraph PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/Json/include) add_executable(Graph_Build graph_build.cpp) target_link_libraries(Graph_Build BuildGraph) +add_dependencies(Graph_Build opencv_external) add_executable(ACC acc_check.cpp) target_link_libraries(ACC BuildGraph) +add_dependencies(ACC opencv_external) add_executable(onnx_subgraphs onnx_subgraphs.cpp) target_link_libraries(onnx_subgraphs BuildGraph) target_link_libraries(onnx_subgraphs OpenMP::OpenMP_CXX) target_link_libraries(onnx_subgraphs graphT_lib) +add_dependencies(onnx_subgraphs opencv_external) file(DOWNLOAD "https://raw.githubusercontent.com/DeepTrackAI/MNIST_dataset/main/mnist/test/1_000008.png" diff --git a/app/ReaderImage/CMakeLists.txt b/app/ReaderImage/CMakeLists.txt index 2ba86b27d..687cdba83 100644 --- a/app/ReaderImage/CMakeLists.txt +++ b/app/ReaderImage/CMakeLists.txt @@ -5,9 +5,11 @@ add_library(ReadLib STATIC ${INCLUDE_HEADERS} ${SRC_FILES}) set_target_properties(ReadLib PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries(ReadLib PUBLIC OpenCV_unified) target_link_libraries(ReadLib PUBLIC TBB_unified) +add_dependencies(ReadLib opencv_external) add_executable(Reader reader_img.cpp) target_link_libraries(Reader ReadLib) +add_dependencies(Reader opencv_external) file(DOWNLOAD "https://raw.githubusercontent.com/opencv/opencv/4.x/samples/data/lena.jpg" diff --git a/cmake/opencv_config.cmake b/cmake/opencv_config.cmake index 03f6f5f51..87ba6de53 100644 --- a/cmake/opencv_config.cmake +++ b/cmake/opencv_config.cmake @@ -10,7 +10,15 @@ set(OPENCV_CXX_COMPILER "${CMAKE_CXX_COMPILER}") get_filename_component(OPENCV_CXX_COMPILER_NAME "${CMAKE_CXX_COMPILER}" NAME) string(TOLOWER "${OPENCV_CXX_COMPILER_NAME}" OPENCV_CXX_COMPILER_NAME_LOWER) -if(OPENCV_CXX_COMPILER_NAME_LOWER STREQUAL "acpp" +if(WIN32) + if(OPENCV_CXX_COMPILER_NAME_LOWER MATCHES "^(clang-cl|clang\\+\\+|clang|icx|icx-cl|icpx)(\\.exe)?$") + find_program(OPENCV_HOST_MSVC_CL NAMES cl) + if(OPENCV_HOST_MSVC_CL) + set(OPENCV_C_COMPILER "${OPENCV_HOST_MSVC_CL}") + set(OPENCV_CXX_COMPILER "${OPENCV_HOST_MSVC_CL}") + endif() + endif() +elseif(OPENCV_CXX_COMPILER_NAME_LOWER STREQUAL "acpp" OR OPENCV_CXX_COMPILER_NAME_LOWER STREQUAL "syclcc") get_filename_component(OPENCV_HOST_COMPILER_DIR "${CMAKE_C_COMPILER}" DIRECTORY) unset(OPENCV_CXX_COMPILER) diff --git a/src/Weights_Reader/reader_weights.cpp b/src/Weights_Reader/reader_weights.cpp index 8d5517374..d4ceac3df 100644 --- a/src/Weights_Reader/reader_weights.cpp +++ b/src/Weights_Reader/reader_weights.cpp @@ -50,7 +50,7 @@ json read_json(const std::string& filename) { throw std::runtime_error("Cannot open file: " + filename); } - struct stat sb{}; + struct stat sb {}; fstat(fd, &sb); if (sb.st_size == 0) { From fd9e87f34ba1bca05bd9bf3bb61333a983ddcb29 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 18 Mar 2026 19:14:06 +0100 Subject: [PATCH 049/104] Fix OpenCV include layout across platforms --- cmake/opencv_config.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/opencv_config.cmake b/cmake/opencv_config.cmake index 87ba6de53..97c8b0207 100644 --- a/cmake/opencv_config.cmake +++ b/cmake/opencv_config.cmake @@ -138,7 +138,10 @@ set(OPENCV_LIBRARY_DIR "${OPENCV_INSTALL_DIR}/${OPENCV_INSTALL_BINARIES_PREFIX}${CMAKE_INSTALL_LIBDIR}") set(OPENCV_RUNTIME_DIR "${OPENCV_INSTALL_DIR}/${OPENCV_INSTALL_BINARIES_PREFIX}${CMAKE_INSTALL_BINDIR}") -set(OPENCV_INCLUDE_DIR "${OPENCV_INSTALL_DIR}/include/opencv4") +set(OPENCV_INCLUDE_DIRS + "${OPENCV_INSTALL_DIR}/include" + "${OPENCV_INSTALL_DIR}/include/opencv4" +) if(WIN32) set(OPENCV_WORLD_IMPLIB @@ -173,7 +176,7 @@ add_library(opencv_world_external SHARED IMPORTED GLOBAL) add_dependencies(opencv_world_external opencv_external) set_target_properties(opencv_world_external PROPERTIES IMPORTED_LOCATION "${OPENCV_WORLD_RUNTIME}" - INTERFACE_INCLUDE_DIRECTORIES "${OPENCV_INCLUDE_DIR}" + INTERFACE_INCLUDE_DIRECTORIES "${OPENCV_INCLUDE_DIRS}" ) if(WIN32) @@ -184,7 +187,7 @@ endif() add_library(OpenCV_unified INTERFACE) add_dependencies(OpenCV_unified opencv_external) -target_include_directories(OpenCV_unified INTERFACE "${OPENCV_INCLUDE_DIR}") +target_include_directories(OpenCV_unified INTERFACE ${OPENCV_INCLUDE_DIRS}) target_link_libraries(OpenCV_unified INTERFACE opencv_world_external) if(CMAKE_BUILD_RPATH) From f014ced6e54458ec4413f05130d62b9a0a53eaf3 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 18 Mar 2026 20:04:08 +0100 Subject: [PATCH 050/104] Disable OpenMP in external OpenCV build --- cmake/opencv_config.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/opencv_config.cmake b/cmake/opencv_config.cmake index 97c8b0207..1fbae736a 100644 --- a/cmake/opencv_config.cmake +++ b/cmake/opencv_config.cmake @@ -63,6 +63,7 @@ set(OPENCV_CMAKE_ARGS -DBUILD_opencv_python3=OFF -DBUILD_JAVA=OFF -DBUILD_opencv_world=ON + -DWITH_OPENMP=OFF -DWITH_FFMPEG=OFF -DWITH_EIGEN=OFF ) From 3bc43bcca561b1b8ed8cd776b5edacf9f2be8e31 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 18 Mar 2026 20:08:47 +0100 Subject: [PATCH 051/104] Convert CI helper scripts to Python --- .github/workflows/ci.yml | 2 +- .github/workflows/sycl-ci.yml | 8 +- scripts/ci/clang-format-check.sh | 24 ---- scripts/ci/clang_format_check.py | 61 ++++++++ scripts/ci/common.py | 89 ++++++++++++ scripts/ci/sycl-configure.sh | 35 ----- scripts/ci/sycl-macos-setup.sh | 25 ---- scripts/ci/sycl-x86-setup.sh | 172 ---------------------- scripts/ci/sycl_configure.py | 62 ++++++++ scripts/ci/sycl_macos_setup.py | 28 ++++ scripts/ci/sycl_x86_setup.py | 237 +++++++++++++++++++++++++++++++ 11 files changed, 482 insertions(+), 261 deletions(-) delete mode 100755 scripts/ci/clang-format-check.sh create mode 100644 scripts/ci/clang_format_check.py create mode 100644 scripts/ci/common.py delete mode 100755 scripts/ci/sycl-configure.sh delete mode 100755 scripts/ci/sycl-macos-setup.sh delete mode 100755 scripts/ci/sycl-x86-setup.sh create mode 100644 scripts/ci/sycl_configure.py create mode 100644 scripts/ci/sycl_macos_setup.py create mode 100644 scripts/ci/sycl_x86_setup.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d6be9c68..7fb9092d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: env: BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} - run: ./scripts/ci/clang-format-check.sh "${BASE_SHA}" "${HEAD_SHA}" + run: python3 ./scripts/ci/clang_format_check.py "${BASE_SHA}" "${HEAD_SHA}" build-linux: strategy: matrix: diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 5fb04d436..5eea32f95 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -57,10 +57,10 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 - name: Prepare platform settings - run: ./scripts/ci/sycl-x86-setup.sh "${{ matrix.platform }}" + run: python3 ./scripts/ci/sycl_x86_setup.py "${{ matrix.platform }}" - name: Configure - run: ./scripts/ci/sycl-configure.sh "${{ matrix.build_type }}" "${SYCL_TARGETS}" "${ITLABAI_ENABLE_OPENCV_APPS}" + run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${SYCL_TARGETS}" "${ITLABAI_ENABLE_OPENCV_APPS}" - name: Build run: cmake --build build --parallel @@ -98,10 +98,10 @@ jobs: max-size: 2G - name: Install macOS prerequisites - run: ./scripts/ci/sycl-macos-setup.sh + run: python3 ./scripts/ci/sycl_macos_setup.py - name: Configure - run: ./scripts/ci/sycl-configure.sh "${{ matrix.build_type }}" "${SYCL_TARGETS}" "${ITLABAI_ENABLE_OPENCV_APPS}" + run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${SYCL_TARGETS}" "${ITLABAI_ENABLE_OPENCV_APPS}" - name: Build run: cmake --build build --parallel diff --git a/scripts/ci/clang-format-check.sh b/scripts/ci/clang-format-check.sh deleted file mode 100755 index 019b4cd1c..000000000 --- a/scripts/ci/clang-format-check.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -base_ref="${1:-}" -head_ref="${2:-HEAD}" - -if [[ -z "${base_ref}" || "${base_ref}" =~ ^0+$ ]]; then - base_ref="$(git rev-parse "${head_ref}^")" -fi - -mapfile -t files < <( - git diff --name-only --diff-filter=ACMR "${base_ref}" "${head_ref}" -- app include src test \ - | grep -E '\.(c|h|C|H|cpp|hpp|cc|hh|c\+\+|h\+\+|cxx|hxx)$' \ - || true -) - -if [[ "${#files[@]}" -eq 0 ]]; then - echo "No source files changed." - exit 0 -fi - -clang_format_bin="${CLANG_FORMAT_BIN:-clang-format-18}" - -"${clang_format_bin}" --dry-run -Werror "${files[@]}" diff --git a/scripts/ci/clang_format_check.py b/scripts/ci/clang_format_check.py new file mode 100644 index 000000000..0d6e3a9d0 --- /dev/null +++ b/scripts/ci/clang_format_check.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +import os +import subprocess +import sys + +from common import capture, main_error, run + + +def main() -> None: + base_ref = sys.argv[1] if len(sys.argv) > 1 else "" + head_ref = sys.argv[2] if len(sys.argv) > 2 else "HEAD" + + if not base_ref or set(base_ref) == {"0"}: + base_ref = capture(["git", "rev-parse", f"{head_ref}^"]) + + diff_output = subprocess.check_output( + [ + "git", + "diff", + "--name-only", + "--diff-filter=ACMR", + base_ref, + head_ref, + "--", + "app", + "include", + "src", + "test", + ], + text=True, + ) + + valid_suffixes = { + ".c", + ".h", + ".C", + ".H", + ".cpp", + ".hpp", + ".cc", + ".hh", + ".c++", + ".h++", + ".cxx", + ".hxx", + } + files = [line for line in diff_output.splitlines() if any(line.endswith(suffix) for suffix in valid_suffixes)] + + if not files: + print("No source files changed.") + return + + clang_format_bin = os.environ.get("CLANG_FORMAT_BIN", "clang-format-18") + run([clang_format_bin, "--dry-run", "-Werror", *files]) + + +if __name__ == "__main__": + main() diff --git a/scripts/ci/common.py b/scripts/ci/common.py new file mode 100644 index 000000000..86b4a4c56 --- /dev/null +++ b/scripts/ci/common.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +import os +import shutil +import subprocess +import sys +import tarfile +import urllib.request +from pathlib import Path + + +def run(command: list[str], *, input_text: str | None = None) -> None: + print("+", " ".join(command), flush=True) + subprocess.run(command, check=True, text=True, input=input_text) + + +def capture(command: list[str]) -> str: + return subprocess.check_output(command, text=True).strip() + + +def require_env(name: str) -> str: + value = os.environ.get(name) + if not value: + raise SystemExit(f"Missing required environment variable: {name}") + return value + + +def write_env(name: str, value: str) -> None: + github_env = os.environ.get("GITHUB_ENV") + if github_env: + with open(github_env, "a", encoding="utf-8") as handle: + handle.write(f"{name}={value}\n") + os.environ[name] = value + + +def append_path(value: str) -> None: + github_path = os.environ.get("GITHUB_PATH") + if github_path: + with open(github_path, "a", encoding="utf-8") as handle: + handle.write(f"{value}\n") + + +def prepend_env_path(name: str, value: str) -> None: + current = os.environ.get(name, "") + write_env(name, f"{value}:{current}" if current else value) + + +def download(url: str, destination: Path) -> None: + destination.parent.mkdir(parents=True, exist_ok=True) + with urllib.request.urlopen(url) as response, open(destination, "wb") as handle: + shutil.copyfileobj(response, handle) + + +def extract_tarball(archive: Path, destination: Path) -> None: + destination.mkdir(parents=True, exist_ok=True) + with tarfile.open(archive, "r:gz") as tar_handle: + tar_handle.extractall(destination) + + +def cygpath(mode: str, path: str | Path) -> str: + return capture(["cygpath", f"-{mode}", str(path)]) + + +def find_first_existing(paths: list[Path]) -> Path: + for path in paths: + if path.exists(): + return path + raise SystemExit(f"Unable to locate any of: {', '.join(str(path) for path in paths)}") + + +def find_file(root_candidates: list[Path], filename: str) -> Path | None: + for root in root_candidates: + if not root.exists(): + continue + for current_root, _, files in os.walk(root): + if filename in files: + return Path(current_root) / filename + return None + + +def repo_root() -> Path: + return Path(__file__).resolve().parents[2] + + +def main_error(message: str) -> None: + print(message, file=sys.stderr) + raise SystemExit(1) diff --git a/scripts/ci/sycl-configure.sh b/scripts/ci/sycl-configure.sh deleted file mode 100755 index 6b093648a..000000000 --- a/scripts/ci/sycl-configure.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -build_type="${1:?build type is required}" -sycl_targets="${2:?sycl targets are required}" -opencv_apps="${3:?opencv apps toggle is required}" - -cmake_args=() -if [[ "${RUNNER_OS}" != "Windows" ]]; then - cmake_args+=( - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - ) -fi - -if [[ -n "${ITLABAI_OPENMP_FLAGS:-}" ]]; then - cmake_args+=(-DOpenMP_CXX_FLAGS="${ITLABAI_OPENMP_FLAGS}") -fi -if [[ -n "${ITLABAI_OPENMP_LIBRARY:-}" ]]; then - cmake_args+=( - -DOpenMP_CXX_LIB_NAMES=iomp5 - -DOpenMP_iomp5_LIBRARY="${ITLABAI_OPENMP_LIBRARY}" - ) -fi - -cmake -S . -B build -G Ninja \ - "${cmake_args[@]}" \ - -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ - -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ - -DCMAKE_BUILD_TYPE="${build_type}" \ - -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ - -DITLABAI_ENABLE_OPENCV_APPS="${opencv_apps}" \ - -DITLABAI_BUILD_TESTS=ON \ - -DITLABAI_ENABLE_SYCL=ON \ - -DITLABAI_SYCL_TARGETS="${sycl_targets}" diff --git a/scripts/ci/sycl-macos-setup.sh b/scripts/ci/sycl-macos-setup.sh deleted file mode 100755 index 21c4eebda..000000000 --- a/scripts/ci/sycl-macos-setup.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -write_env() { - local key="$1" - local value="$2" - echo "${key}=${value}" >> "${GITHUB_ENV}" - export "${key}=${value}" -} - -append_path() { - echo "$1" >> "${GITHUB_PATH}" -} - -brew install adaptivecpp - -adaptivecpp_prefix="$(brew --prefix adaptivecpp)" - -write_env ITLABAI_CC "$(xcrun --find clang)" -write_env ITLABAI_CXX "$(command -v acpp)" -write_env ITLABAI_CMAKE_PREFIX_PATH "${adaptivecpp_prefix}" -write_env ITLABAI_ENABLE_OPENCV_APPS ON -write_env SYCL_TARGETS omp - -append_path "${adaptivecpp_prefix}/bin" diff --git a/scripts/ci/sycl-x86-setup.sh b/scripts/ci/sycl-x86-setup.sh deleted file mode 100755 index 02534a439..000000000 --- a/scripts/ci/sycl-x86-setup.sh +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -platform="${1:?platform is required}" - -write_env() { - local key="$1" - local value="$2" - echo "${key}=${value}" >> "${GITHUB_ENV}" - export "${key}=${value}" -} - -append_path() { - echo "$1" >> "${GITHUB_PATH}" -} - -case "${platform}" in - linux-x86_64) - write_env TOOLCHAIN_ASSET sycl_linux.tar.gz - write_env SYCL_TARGETS spir64 - write_env DEVICE_SELECTOR opencl:cpu - write_env ITLABAI_ENABLE_OPENCV_APPS ON - ;; - windows-x86_64) - write_env TOOLCHAIN_ASSET sycl_windows.tar.gz - write_env SYCL_TARGETS spir64 - write_env DEVICE_SELECTOR opencl:cpu - write_env ITLABAI_ENABLE_OPENCV_APPS ON - ;; - *) - echo "Unsupported platform: ${platform}" >&2 - exit 1 - ;; -esac - -if [[ "${RUNNER_OS}" == "Linux" ]]; then - sudo apt-get update - sudo apt-get install -y \ - build-essential \ - cmake \ - git \ - libomp-dev \ - ocl-icd-opencl-dev \ - opencl-headers \ - python3 \ - zstd - - wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ - | gpg --dearmor \ - | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null - echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ - | sudo tee /etc/apt/sources.list.d/oneAPI.list - sudo apt-get update - sudo apt-get install -y intel-oneapi-runtime-opencl - - intel_icd_dir="${RUNNER_TEMP}/intel-opencl-icd" - intel_icd_file="$(grep -il 'intel' /etc/OpenCL/vendors/*.icd | head -n 1 || true)" - if [[ -z "${intel_icd_file}" ]]; then - echo "Unable to locate Intel OpenCL ICD file under /etc/OpenCL/vendors" >&2 - ls -la /etc/OpenCL/vendors >&2 - exit 1 - fi - - mkdir -p "${intel_icd_dir}" - cp "${intel_icd_file}" "${intel_icd_dir}/" - write_env OCL_ICD_VENDORS "${intel_icd_dir}" -fi - -if [[ "${RUNNER_OS}" == "Windows" ]]; then - runner_temp_dir="$(cygpath -u "${RUNNER_TEMP}")" -else - runner_temp_dir="${RUNNER_TEMP}" -fi - -mkdir -p "${runner_temp_dir}/intel-sycl" -curl -fsSL \ - "https://github.com/intel/llvm/releases/download/${INTEL_LLVM_TAG}/${TOOLCHAIN_ASSET}" \ - -o "${runner_temp_dir}/${TOOLCHAIN_ASSET}" -tar -xzf "${runner_temp_dir}/${TOOLCHAIN_ASSET}" \ - -C "${runner_temp_dir}/intel-sycl" - -sycl_root="${runner_temp_dir}/intel-sycl" -if [[ -d "${sycl_root}/sycl_windows/bin" ]]; then - sycl_root="${sycl_root}/sycl_windows" -elif [[ -d "${sycl_root}/sycl_linux/bin" ]]; then - sycl_root="${sycl_root}/sycl_linux" -fi -write_env SYCL_ROOT "${sycl_root}" - -if [[ "${RUNNER_OS}" == "Windows" ]]; then - runtime_archive="${runner_temp_dir}/intel-opencl-runtime.exe" - runtime_extract_dir="${runner_temp_dir}/intel-opencl-runtime" - runtime_msi="${runtime_extract_dir}/w_opencl_runtime_p_2025.3.1.762.msi" - - curl -fsSL "${INTEL_OPENCL_CPU_RUNTIME_URL}" -o "${runtime_archive}" - 7z x -y "-o${runtime_extract_dir}" "${runtime_archive}" - powershell -NoProfile -Command \ - "Start-Process msiexec.exe -Wait -ArgumentList '/i', '$(cygpath -w "${runtime_msi}")', '/qn', '/norestart'" - - if [[ -x "${SYCL_ROOT}/bin/icx.exe" ]]; then - cc_path="${SYCL_ROOT}/bin/icx.exe" - elif [[ -x "${SYCL_ROOT}/bin/icx-cl.exe" ]]; then - cc_path="${SYCL_ROOT}/bin/icx-cl.exe" - elif [[ -x "${SYCL_ROOT}/bin/clang-cl.exe" ]]; then - cc_path="${SYCL_ROOT}/bin/clang-cl.exe" - elif [[ -x "${SYCL_ROOT}/bin/clang.exe" ]]; then - cc_path="${SYCL_ROOT}/bin/clang.exe" - else - echo "Unable to locate a C compiler in ${SYCL_ROOT}/bin" >&2 - exit 1 - fi - - if [[ -x "${SYCL_ROOT}/bin/icpx.exe" ]]; then - cxx_path="${SYCL_ROOT}/bin/icpx.exe" - elif [[ -x "${SYCL_ROOT}/bin/icx-cl.exe" ]]; then - cxx_path="${SYCL_ROOT}/bin/icx-cl.exe" - elif [[ -x "${SYCL_ROOT}/bin/clang-cl.exe" ]]; then - cxx_path="${SYCL_ROOT}/bin/clang-cl.exe" - elif [[ -x "${SYCL_ROOT}/bin/clang++.exe" ]]; then - cxx_path="${SYCL_ROOT}/bin/clang++.exe" - else - echo "Unable to locate a C++ compiler in ${SYCL_ROOT}/bin" >&2 - exit 1 - fi - - write_env ITLABAI_CC "$(cygpath -m "${cc_path}")" - write_env ITLABAI_CXX "$(cygpath -m "${cxx_path}")" - write_env ITLABAI_CMAKE_PREFIX_PATH "$(cygpath -m "${SYCL_ROOT}")" - append_path "$(cygpath -m "${SYCL_ROOT}/bin")" -else - if [[ -x "${SYCL_ROOT}/bin/icx" ]]; then - write_env ITLABAI_CC "${SYCL_ROOT}/bin/icx" - elif [[ -x "${SYCL_ROOT}/bin/clang" ]]; then - write_env ITLABAI_CC "${SYCL_ROOT}/bin/clang" - else - echo "Unable to locate a C compiler in ${SYCL_ROOT}/bin" >&2 - exit 1 - fi - - if [[ -x "${SYCL_ROOT}/bin/icpx" ]]; then - write_env ITLABAI_CXX "${SYCL_ROOT}/bin/icpx" - elif [[ -x "${SYCL_ROOT}/bin/clang++" ]]; then - write_env ITLABAI_CXX "${SYCL_ROOT}/bin/clang++" - else - echo "Unable to locate a C++ compiler in ${SYCL_ROOT}/bin" >&2 - exit 1 - fi - - write_env ITLABAI_CMAKE_PREFIX_PATH "${SYCL_ROOT}" - append_path "${SYCL_ROOT}/bin" - - if [[ "${RUNNER_OS}" == "Linux" ]]; then - openmp_library="$(find "${SYCL_ROOT}" /opt/intel/oneapi -name 'libiomp5.so' -print -quit 2>/dev/null || true)" - if [[ -z "${openmp_library}" ]]; then - echo "Unable to locate libiomp5.so for the SYCL toolchain" >&2 - exit 1 - fi - - write_env ITLABAI_OPENMP_FLAGS -fopenmp - write_env ITLABAI_OPENMP_LIBRARY "${openmp_library}" - fi - - if [[ -d "${SYCL_ROOT}/lib" ]]; then - write_env LD_LIBRARY_PATH "${SYCL_ROOT}/lib:${LD_LIBRARY_PATH:-}" - write_env DYLD_LIBRARY_PATH "${SYCL_ROOT}/lib:${DYLD_LIBRARY_PATH:-}" - fi - - if [[ -d "${SYCL_ROOT}/lib64" ]]; then - write_env LD_LIBRARY_PATH "${SYCL_ROOT}/lib64:${LD_LIBRARY_PATH:-}" - write_env DYLD_LIBRARY_PATH "${SYCL_ROOT}/lib64:${DYLD_LIBRARY_PATH:-}" - fi -fi diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py new file mode 100644 index 000000000..9013ecc0c --- /dev/null +++ b/scripts/ci/sycl_configure.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +import os +import sys + +from common import main_error, require_env, run + + +def main() -> None: + if len(sys.argv) != 4: + main_error("Usage: sycl_configure.py ") + + build_type, sycl_targets, opencv_apps = sys.argv[1:] + + cmake_args = [] + if require_env("RUNNER_OS") != "Windows": + cmake_args.extend( + [ + "-DCMAKE_C_COMPILER_LAUNCHER=ccache", + "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache", + ] + ) + + openmp_flags = os.environ.get("ITLABAI_OPENMP_FLAGS", "") + if openmp_flags: + cmake_args.append(f"-DOpenMP_CXX_FLAGS={openmp_flags}") + + openmp_library = os.environ.get("ITLABAI_OPENMP_LIBRARY", "") + if openmp_library: + cmake_args.extend( + [ + "-DOpenMP_CXX_LIB_NAMES=iomp5", + f"-DOpenMP_iomp5_LIBRARY={openmp_library}", + ] + ) + + run( + [ + "cmake", + "-S", + ".", + "-B", + "build", + "-G", + "Ninja", + *cmake_args, + f"-DCMAKE_C_COMPILER={require_env('ITLABAI_CC')}", + f"-DCMAKE_CXX_COMPILER={require_env('ITLABAI_CXX')}", + f"-DCMAKE_BUILD_TYPE={build_type}", + f"-DCMAKE_PREFIX_PATH={require_env('ITLABAI_CMAKE_PREFIX_PATH')}", + f"-DITLABAI_ENABLE_OPENCV_APPS={opencv_apps}", + "-DITLABAI_BUILD_TESTS=ON", + "-DITLABAI_ENABLE_SYCL=ON", + f"-DITLABAI_SYCL_TARGETS={sycl_targets}", + ] + ) + + +if __name__ == "__main__": + main() diff --git a/scripts/ci/sycl_macos_setup.py b/scripts/ci/sycl_macos_setup.py new file mode 100644 index 000000000..e9cc41cee --- /dev/null +++ b/scripts/ci/sycl_macos_setup.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +import shutil + +from common import append_path, capture, main_error, run, write_env + + +def main() -> None: + run(["brew", "install", "adaptivecpp"]) + + adaptivecpp_prefix = capture(["brew", "--prefix", "adaptivecpp"]) + acpp_path = shutil.which("acpp") + if not acpp_path: + main_error("Unable to locate acpp in PATH after brew install adaptivecpp") + + write_env("ITLABAI_CC", capture(["xcrun", "--find", "clang"])) + write_env("ITLABAI_CXX", acpp_path) + write_env("ITLABAI_CMAKE_PREFIX_PATH", adaptivecpp_prefix) + write_env("ITLABAI_ENABLE_OPENCV_APPS", "ON") + write_env("SYCL_TARGETS", "omp") + + append_path(f"{adaptivecpp_prefix}/bin") + + +if __name__ == "__main__": + main() diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py new file mode 100644 index 000000000..c6effdb67 --- /dev/null +++ b/scripts/ci/sycl_x86_setup.py @@ -0,0 +1,237 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +import os +import sys +from pathlib import Path + +from common import ( + append_path, + capture, + cygpath, + download, + extract_tarball, + find_file, + find_first_existing, + main_error, + require_env, + run, + write_env, +) + + +def configure_platform(platform: str) -> None: + settings = { + "linux-x86_64": { + "toolchain_asset": "sycl_linux.tar.gz", + "sycl_targets": "spir64", + "device_selector": "opencl:cpu", + "opencv_apps": "ON", + }, + "windows-x86_64": { + "toolchain_asset": "sycl_windows.tar.gz", + "sycl_targets": "spir64", + "device_selector": "opencl:cpu", + "opencv_apps": "ON", + }, + }.get(platform) + + if settings is None: + main_error(f"Unsupported platform: {platform}") + + write_env("TOOLCHAIN_ASSET", settings["toolchain_asset"]) + write_env("SYCL_TARGETS", settings["sycl_targets"]) + write_env("DEVICE_SELECTOR", settings["device_selector"]) + write_env("ITLABAI_ENABLE_OPENCV_APPS", settings["opencv_apps"]) + + +def setup_linux_runtime() -> None: + run(["sudo", "apt-get", "update"]) + run( + [ + "sudo", + "apt-get", + "install", + "-y", + "build-essential", + "cmake", + "git", + "libomp-dev", + "ocl-icd-opencl-dev", + "opencl-headers", + "python3", + "zstd", + ] + ) + + key_url = "https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" + key_path = Path(require_env("RUNNER_TEMP")) / "oneapi-intel-key.pub" + armored_key_path = Path(require_env("RUNNER_TEMP")) / "oneapi-archive-keyring.gpg" + download(key_url, key_path) + run( + [ + "gpg", + "--dearmor", + "--output", + str(armored_key_path), + str(key_path), + ] + ) + run( + [ + "sudo", + "cp", + str(armored_key_path), + "/usr/share/keyrings/oneapi-archive-keyring.gpg", + ] + ) + run( + ["sudo", "tee", "/etc/apt/sources.list.d/oneAPI.list"], + input_text=( + "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] " + "https://apt.repos.intel.com/oneapi all main\n" + ), + ) + run(["sudo", "apt-get", "update"]) + run(["sudo", "apt-get", "install", "-y", "intel-oneapi-runtime-opencl"]) + + icd_dir = Path(require_env("RUNNER_TEMP")) / "intel-opencl-icd" + icd_dir.mkdir(parents=True, exist_ok=True) + + icd_file = None + for candidate in Path("/etc/OpenCL/vendors").glob("*.icd"): + try: + if "intel" in candidate.read_text(encoding="utf-8").lower(): + icd_file = candidate + break + except OSError: + continue + + if icd_file is None: + main_error("Unable to locate Intel OpenCL ICD file under /etc/OpenCL/vendors") + + run(["cp", str(icd_file), str(icd_dir / icd_file.name)]) + write_env("OCL_ICD_VENDORS", str(icd_dir)) + + +def prepare_sycl_toolchain() -> Path: + runner_os = require_env("RUNNER_OS") + runner_temp = require_env("RUNNER_TEMP") + runner_temp_dir = Path(cygpath("u", runner_temp) if runner_os == "Windows" else runner_temp) + toolchain_asset = require_env("TOOLCHAIN_ASSET") + llvm_tag = require_env("INTEL_LLVM_TAG") + + sycl_extract_root = runner_temp_dir / "intel-sycl" + archive_path = runner_temp_dir / toolchain_asset + download( + f"https://github.com/intel/llvm/releases/download/{llvm_tag}/{toolchain_asset}", + archive_path, + ) + extract_tarball(archive_path, sycl_extract_root) + + sycl_root = sycl_extract_root + if (sycl_root / "sycl_windows" / "bin").is_dir(): + sycl_root = sycl_root / "sycl_windows" + elif (sycl_root / "sycl_linux" / "bin").is_dir(): + sycl_root = sycl_root / "sycl_linux" + + write_env("SYCL_ROOT", str(sycl_root)) + return sycl_root + + +def setup_windows_compilers(sycl_root: Path) -> None: + runner_temp_dir = Path(cygpath("u", require_env("RUNNER_TEMP"))) + runtime_archive = runner_temp_dir / "intel-opencl-runtime.exe" + runtime_extract_dir = runner_temp_dir / "intel-opencl-runtime" + runtime_msi = runtime_extract_dir / "w_opencl_runtime_p_2025.3.1.762.msi" + + download(require_env("INTEL_OPENCL_CPU_RUNTIME_URL"), runtime_archive) + run(["7z", "x", "-y", f"-o{runtime_extract_dir}", str(runtime_archive)]) + run( + [ + "powershell", + "-NoProfile", + "-Command", + ( + "Start-Process msiexec.exe -Wait -ArgumentList " + f"'/i', '{cygpath('w', runtime_msi)}', '/qn', '/norestart'" + ), + ] + ) + + cc_path = find_first_existing( + [ + sycl_root / "bin" / "icx.exe", + sycl_root / "bin" / "icx-cl.exe", + sycl_root / "bin" / "clang-cl.exe", + sycl_root / "bin" / "clang.exe", + ] + ) + cxx_path = find_first_existing( + [ + sycl_root / "bin" / "icpx.exe", + sycl_root / "bin" / "icx-cl.exe", + sycl_root / "bin" / "clang-cl.exe", + sycl_root / "bin" / "clang++.exe", + ] + ) + + write_env("ITLABAI_CC", cygpath("m", cc_path)) + write_env("ITLABAI_CXX", cygpath("m", cxx_path)) + write_env("ITLABAI_CMAKE_PREFIX_PATH", cygpath("m", sycl_root)) + append_path(cygpath("m", sycl_root / "bin")) + + +def setup_unix_compilers(sycl_root: Path) -> None: + cc_path = find_first_existing([sycl_root / "bin" / "icx", sycl_root / "bin" / "clang"]) + cxx_path = find_first_existing([sycl_root / "bin" / "icpx", sycl_root / "bin" / "clang++"]) + + write_env("ITLABAI_CC", str(cc_path)) + write_env("ITLABAI_CXX", str(cxx_path)) + write_env("ITLABAI_CMAKE_PREFIX_PATH", str(sycl_root)) + append_path(str(sycl_root / "bin")) + + if require_env("RUNNER_OS") == "Linux": + openmp_library = find_file([sycl_root, Path("/opt/intel/oneapi")], "libiomp5.so") + if openmp_library is None: + main_error("Unable to locate libiomp5.so for the SYCL toolchain") + + write_env("ITLABAI_OPENMP_FLAGS", "-fopenmp") + write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) + + for library_dir_name in ("lib", "lib64"): + library_dir = sycl_root / library_dir_name + if library_dir.is_dir(): + current = os.environ.get("LD_LIBRARY_PATH", "") + write_env( + "LD_LIBRARY_PATH", + f"{library_dir}:{current}" if current else str(library_dir), + ) + current = os.environ.get("DYLD_LIBRARY_PATH", "") + write_env( + "DYLD_LIBRARY_PATH", + f"{library_dir}:{current}" if current else str(library_dir), + ) + + +def main() -> None: + if len(sys.argv) != 2: + main_error("Usage: sycl_x86_setup.py ") + + platform = sys.argv[1] + configure_platform(platform) + + if require_env("RUNNER_OS") == "Linux": + setup_linux_runtime() + + sycl_root = prepare_sycl_toolchain() + + if require_env("RUNNER_OS") == "Windows": + setup_windows_compilers(sycl_root) + else: + setup_unix_compilers(sycl_root) + + +if __name__ == "__main__": + main() From b9f30a00fd4ae06f20b81bad8437c92b281e355c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Wed, 18 Mar 2026 20:28:40 +0100 Subject: [PATCH 052/104] Use libiomp5 for Linux SYCL OpenMP --- scripts/ci/sycl_x86_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index c6effdb67..6f512e5fe 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -197,7 +197,7 @@ def setup_unix_compilers(sycl_root: Path) -> None: if openmp_library is None: main_error("Unable to locate libiomp5.so for the SYCL toolchain") - write_env("ITLABAI_OPENMP_FLAGS", "-fopenmp") + write_env("ITLABAI_OPENMP_FLAGS", "-fopenmp=libiomp5") write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) for library_dir_name in ("lib", "lib64"): From 037ccad8b09e216a2f3028484f9b53e34f06a0e4 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 01:06:43 +0100 Subject: [PATCH 053/104] Pass OpenMP include dir to Linux SYCL builds --- scripts/ci/sycl_configure.py | 4 ++++ scripts/ci/sycl_x86_setup.py | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py index 9013ecc0c..4a6306cd9 100644 --- a/scripts/ci/sycl_configure.py +++ b/scripts/ci/sycl_configure.py @@ -36,6 +36,10 @@ def main() -> None: ] ) + openmp_include_dir = os.environ.get("ITLABAI_OPENMP_INCLUDE_DIR", "") + if openmp_include_dir: + cmake_args.append(f"-DOpenMP_CXX_INCLUDE_DIR={openmp_include_dir}") + run( [ "cmake", diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 6f512e5fe..5fe432d8c 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -197,8 +197,15 @@ def setup_unix_compilers(sycl_root: Path) -> None: if openmp_library is None: main_error("Unable to locate libiomp5.so for the SYCL toolchain") + search_roots = [Path(capture([str(cxx_path), "-print-resource-dir"])), sycl_root, Path("/opt/intel/oneapi")] + search_roots.extend(Path("/usr/lib").glob("llvm-*")) + openmp_header = find_file(search_roots, "omp.h") + if openmp_header is None: + main_error("Unable to locate omp.h for the SYCL toolchain") + write_env("ITLABAI_OPENMP_FLAGS", "-fopenmp=libiomp5") write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) + write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent)) for library_dir_name in ("lib", "lib64"): library_dir = sycl_root / library_dir_name From 9b8897fa4f43ddcdfaa9b9e9b97e71d91b69534d Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 01:15:35 +0100 Subject: [PATCH 054/104] Scope OpenMP to consuming targets --- CMakeLists.txt | 9 ++++++++- scripts/ci/sycl_configure.py | 2 +- scripts/ci/sycl_x86_setup.py | 6 +++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a574c8581..c5acdc1f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,11 +34,18 @@ find_package(OpenMP REQUIRED COMPONENTS CXX) if(OpenMP_FOUND) message(STATUS "OpenMP found - enabling parallel support") - link_libraries(OpenMP::OpenMP_CXX) else() message(STATUS "OpenMP not found - parallel features disabled") endif() +set(ITLABAI_OPENMP_INCLUDE_DIR "" CACHE PATH + "Optional extra include directory for the OpenMP runtime headers") +if(ITLABAI_OPENMP_INCLUDE_DIR AND TARGET OpenMP::OpenMP_CXX) + set_property(TARGET OpenMP::OpenMP_CXX APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES "${ITLABAI_OPENMP_INCLUDE_DIR}" + ) +endif() + add_library(itlabai_sycl INTERFACE) if(ITLABAI_ENABLE_SYCL) diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py index 4a6306cd9..b9ff26fe4 100644 --- a/scripts/ci/sycl_configure.py +++ b/scripts/ci/sycl_configure.py @@ -38,7 +38,7 @@ def main() -> None: openmp_include_dir = os.environ.get("ITLABAI_OPENMP_INCLUDE_DIR", "") if openmp_include_dir: - cmake_args.append(f"-DOpenMP_CXX_INCLUDE_DIR={openmp_include_dir}") + cmake_args.append(f"-DITLABAI_OPENMP_INCLUDE_DIR={openmp_include_dir}") run( [ diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 5fe432d8c..7deab4f77 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -197,7 +197,11 @@ def setup_unix_compilers(sycl_root: Path) -> None: if openmp_library is None: main_error("Unable to locate libiomp5.so for the SYCL toolchain") - search_roots = [Path(capture([str(cxx_path), "-print-resource-dir"])), sycl_root, Path("/opt/intel/oneapi")] + search_roots = [ + Path(capture([str(cxx_path), "-print-resource-dir"])), + sycl_root, + Path("/opt/intel/oneapi"), + ] search_roots.extend(Path("/usr/lib").glob("llvm-*")) openmp_header = find_file(search_roots, "omp.h") if openmp_header is None: From 804e8e4d8ee8e9a1629868d5f4eda2587efd0be3 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 01:44:07 +0100 Subject: [PATCH 055/104] Use package-based SYCL integration --- .github/workflows/sycl-ci.yml | 4 +- CMakeLists.txt | 88 ++++++++-------------------------- app/SYCL/CMakeLists.txt | 10 ++-- app/SYCL/sycl_example.cpp | 12 +---- app/SYCL/sycl_kernel.cpp | 11 +---- scripts/ci/sycl_configure.py | 12 +++-- scripts/ci/sycl_macos_setup.py | 16 +++---- scripts/ci/sycl_x86_setup.py | 4 +- 8 files changed, 43 insertions(+), 114 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 5eea32f95..ccaddf72d 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -60,7 +60,7 @@ jobs: run: python3 ./scripts/ci/sycl_x86_setup.py "${{ matrix.platform }}" - name: Configure - run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${SYCL_TARGETS}" "${ITLABAI_ENABLE_OPENCV_APPS}" + run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" - name: Build run: cmake --build build --parallel @@ -101,7 +101,7 @@ jobs: run: python3 ./scripts/ci/sycl_macos_setup.py - name: Configure - run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${SYCL_TARGETS}" "${ITLABAI_ENABLE_OPENCV_APPS}" + run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" - name: Build run: cmake --build build --parallel diff --git a/CMakeLists.txt b/CMakeLists.txt index c5acdc1f1..0d66485b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,12 @@ set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) option(ITLABAI_ENABLE_SYCL "Build SYCL example and helper targets" OFF) option(ITLABAI_ENABLE_OPENCV_APPS "Build OpenCV-dependent apps" ON) option(ITLABAI_BUILD_TESTS "Build unit tests" ON) +set(ITLABAI_SYCL_IMPLEMENTATION "" CACHE STRING + "SYCL implementation package to use: IntelSYCL or AdaptiveCpp") +set_property(CACHE ITLABAI_SYCL_IMPLEMENTATION PROPERTY STRINGS + IntelSYCL AdaptiveCpp) set(ITLABAI_SYCL_TARGETS "" CACHE STRING - "Optional SYCL targets passed to -fsycl-targets") + "Optional SYCL targets; forwarded to AdaptiveCpp as ACPP_TARGETS") option(ENABLE_STATISTIC_TENSORS "Enable statistic tensors" OFF) @@ -46,80 +50,26 @@ if(ITLABAI_OPENMP_INCLUDE_DIR AND TARGET OpenMP::OpenMP_CXX) ) endif() -add_library(itlabai_sycl INTERFACE) - if(ITLABAI_ENABLE_SYCL) - get_filename_component(ITLABAI_SYCL_COMPILER_NAME - "${CMAKE_CXX_COMPILER}" NAME) - get_filename_component(ITLABAI_SYCL_COMPILER_DIR - "${CMAKE_CXX_COMPILER}" DIRECTORY) - string(TOLOWER "${ITLABAI_SYCL_COMPILER_NAME}" - ITLABAI_SYCL_COMPILER_NAME_LOWER) - - include(CheckCXXCompilerFlag) - if(ITLABAI_SYCL_COMPILER_NAME_LOWER STREQUAL "acpp" - OR ITLABAI_SYCL_COMPILER_NAME_LOWER STREQUAL "syclcc") - set(ITLABAI_COMPILER_SUPPORTS_FSYCL ON) - set(ITLABAI_SYCL_USES_WRAPPER ON) - else() - check_cxx_compiler_flag("-fsycl" ITLABAI_COMPILER_SUPPORTS_FSYCL) - set(ITLABAI_SYCL_USES_WRAPPER OFF) - endif() - - if(NOT ITLABAI_COMPILER_SUPPORTS_FSYCL) + if(NOT ITLABAI_SYCL_IMPLEMENTATION) message(FATAL_ERROR - "ITLABAI_ENABLE_SYCL=ON requires a compiler with -fsycl support") - endif() - - set(ITLABAI_SYCL_INCLUDE_DIR "") - set(ITLABAI_SYCL_INCLUDE_CANDIDATES - "${ITLABAI_SYCL_COMPILER_DIR}/../include" - ) - foreach(ITLABAI_SYCL_PREFIX IN LISTS CMAKE_PREFIX_PATH) - list(APPEND ITLABAI_SYCL_INCLUDE_CANDIDATES - "${ITLABAI_SYCL_PREFIX}/include" - ) - endforeach() - foreach(ITLABAI_SYCL_INCLUDE_CANDIDATE - IN LISTS ITLABAI_SYCL_INCLUDE_CANDIDATES) - if(EXISTS "${ITLABAI_SYCL_INCLUDE_CANDIDATE}/sycl/sycl.hpp") - set(ITLABAI_SYCL_INCLUDE_DIR - "${ITLABAI_SYCL_INCLUDE_CANDIDATE}") - break() - endif() - endforeach() - if(ITLABAI_SYCL_INCLUDE_DIR) - target_include_directories(itlabai_sycl INTERFACE - "${ITLABAI_SYCL_INCLUDE_DIR}" - ) + "ITLABAI_ENABLE_SYCL=ON requires ITLABAI_SYCL_IMPLEMENTATION " + "to be set to IntelSYCL or AdaptiveCpp") endif() - if(NOT ITLABAI_SYCL_USES_WRAPPER) - target_compile_options(itlabai_sycl INTERFACE - $<$:-fsycl> - ) - target_link_options(itlabai_sycl INTERFACE -fsycl) - endif() - target_compile_definitions(itlabai_sycl INTERFACE ITLABAI_HAS_SYCL=1) - - if(ITLABAI_SYCL_TARGETS) - if(ITLABAI_SYCL_USES_WRAPPER) - target_compile_options(itlabai_sycl INTERFACE - $<$:--acpp-targets=${ITLABAI_SYCL_TARGETS}> - ) - target_link_options(itlabai_sycl INTERFACE - --acpp-targets=${ITLABAI_SYCL_TARGETS} - ) - else() - target_compile_options(itlabai_sycl INTERFACE - $<$:-fsycl-targets=${ITLABAI_SYCL_TARGETS}> - ) - target_link_options(itlabai_sycl INTERFACE - -fsycl-targets=${ITLABAI_SYCL_TARGETS} - ) + if(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "AdaptiveCpp") + if(ITLABAI_SYCL_TARGETS) + set(ACPP_TARGETS "${ITLABAI_SYCL_TARGETS}" CACHE STRING + "AdaptiveCpp targets" FORCE) endif() + find_package(AdaptiveCpp CONFIG REQUIRED) + elseif(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelSYCL") + find_package(IntelSYCL CONFIG REQUIRED) + else() + message(FATAL_ERROR + "Unsupported ITLABAI_SYCL_IMPLEMENTATION=" + "${ITLABAI_SYCL_IMPLEMENTATION}") endif() - endif() include_directories("include") diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 002209f58..d267f428b 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -2,13 +2,11 @@ add_executable(SYCL_Example sycl_example.cpp sycl_kernel.cpp ) -target_link_libraries(SYCL_Example PRIVATE layers_lib itlabai_sycl) -target_compile_options(SYCL_Example PRIVATE - $<$:-Wno-error> - $<$:-Wno-unused-parameter> - $<$:-Wno-deprecated-declarations> +target_link_libraries(SYCL_Example PRIVATE layers_lib) +add_sycl_to_target(TARGET SYCL_Example SOURCES + sycl_example.cpp + sycl_kernel.cpp ) -target_compile_definitions(SYCL_Example PRIVATE SYCL_DISABLE_FSYCL_SYCLHPP_WARNING=1) add_test(NAME SYCL.Example COMMAND SYCL_Example) set_tests_properties(SYCL.Example PROPERTIES diff --git a/app/SYCL/sycl_example.cpp b/app/SYCL/sycl_example.cpp index 703969b65..4967360ca 100644 --- a/app/SYCL/sycl_example.cpp +++ b/app/SYCL/sycl_example.cpp @@ -1,18 +1,13 @@ #include #include #include +#include #include -#if __has_include() -# include -# define ITLABAI_HAS_SYCL_HEADERS 1 -#endif - #include "graph/runtime_options.hpp" #include "layers/EWLayer.hpp" #include "layers/Tensor.hpp" -#if defined(ITLABAI_HAS_SYCL_HEADERS) namespace { bool almost_equal(float lhs, float rhs) { @@ -23,12 +18,8 @@ bool almost_equal(float lhs, float rhs) { void run_sycl_kernel(sycl::queue& queue, const float* input, float* output, std::size_t count); -#endif int main() { -#if !defined(ITLABAI_HAS_SYCL_HEADERS) - return 0; -#else try { using namespace it_lab_ai; @@ -72,5 +63,4 @@ int main() { std::cerr << "Error: " << exception.what() << '\n'; return 1; } -#endif } diff --git a/app/SYCL/sycl_kernel.cpp b/app/SYCL/sycl_kernel.cpp index 089cd1620..93ac6e239 100644 --- a/app/SYCL/sycl_kernel.cpp +++ b/app/SYCL/sycl_kernel.cpp @@ -1,11 +1,5 @@ #include - -#if __has_include() -# include -# define ITLABAI_HAS_SYCL_HEADERS 1 -#endif - -#if defined(ITLABAI_HAS_SYCL_HEADERS) +#include class SyclExampleTransformKernel; void run_sycl_kernel(sycl::queue& queue, const float* input, float* output, @@ -24,6 +18,3 @@ void run_sycl_kernel(sycl::queue& queue, const float* input, float* output, }); queue.wait_and_throw(); } -#else -void run_sycl_kernel(...) {} -#endif diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py index b9ff26fe4..def893d16 100644 --- a/scripts/ci/sycl_configure.py +++ b/scripts/ci/sycl_configure.py @@ -9,10 +9,10 @@ def main() -> None: - if len(sys.argv) != 4: - main_error("Usage: sycl_configure.py ") + if len(sys.argv) != 3: + main_error("Usage: sycl_configure.py ") - build_type, sycl_targets, opencv_apps = sys.argv[1:] + build_type, opencv_apps = sys.argv[1:] cmake_args = [] if require_env("RUNNER_OS") != "Windows": @@ -40,6 +40,10 @@ def main() -> None: if openmp_include_dir: cmake_args.append(f"-DITLABAI_OPENMP_INCLUDE_DIR={openmp_include_dir}") + acpp_targets = os.environ.get("ACPP_TARGETS", "") + if acpp_targets: + cmake_args.append(f"-DACPP_TARGETS={acpp_targets}") + run( [ "cmake", @@ -57,7 +61,7 @@ def main() -> None: f"-DITLABAI_ENABLE_OPENCV_APPS={opencv_apps}", "-DITLABAI_BUILD_TESTS=ON", "-DITLABAI_ENABLE_SYCL=ON", - f"-DITLABAI_SYCL_TARGETS={sycl_targets}", + f"-DITLABAI_SYCL_IMPLEMENTATION={require_env('ITLABAI_SYCL_IMPLEMENTATION')}", ] ) diff --git a/scripts/ci/sycl_macos_setup.py b/scripts/ci/sycl_macos_setup.py index e9cc41cee..2ed7e3f21 100644 --- a/scripts/ci/sycl_macos_setup.py +++ b/scripts/ci/sycl_macos_setup.py @@ -2,24 +2,22 @@ from __future__ import annotations -import shutil - -from common import append_path, capture, main_error, run, write_env +from common import append_path, capture, run, write_env def main() -> None: run(["brew", "install", "adaptivecpp"]) adaptivecpp_prefix = capture(["brew", "--prefix", "adaptivecpp"]) - acpp_path = shutil.which("acpp") - if not acpp_path: - main_error("Unable to locate acpp in PATH after brew install adaptivecpp") + clang_path = capture(["xcrun", "--find", "clang"]) + clangxx_path = capture(["xcrun", "--find", "clang++"]) - write_env("ITLABAI_CC", capture(["xcrun", "--find", "clang"])) - write_env("ITLABAI_CXX", acpp_path) + write_env("ITLABAI_CC", clang_path) + write_env("ITLABAI_CXX", clangxx_path) write_env("ITLABAI_CMAKE_PREFIX_PATH", adaptivecpp_prefix) + write_env("ITLABAI_SYCL_IMPLEMENTATION", "AdaptiveCpp") write_env("ITLABAI_ENABLE_OPENCV_APPS", "ON") - write_env("SYCL_TARGETS", "omp") + write_env("ACPP_TARGETS", "omp") append_path(f"{adaptivecpp_prefix}/bin") diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 7deab4f77..3fe0dccf1 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -25,13 +25,11 @@ def configure_platform(platform: str) -> None: settings = { "linux-x86_64": { "toolchain_asset": "sycl_linux.tar.gz", - "sycl_targets": "spir64", "device_selector": "opencl:cpu", "opencv_apps": "ON", }, "windows-x86_64": { "toolchain_asset": "sycl_windows.tar.gz", - "sycl_targets": "spir64", "device_selector": "opencl:cpu", "opencv_apps": "ON", }, @@ -41,9 +39,9 @@ def configure_platform(platform: str) -> None: main_error(f"Unsupported platform: {platform}") write_env("TOOLCHAIN_ASSET", settings["toolchain_asset"]) - write_env("SYCL_TARGETS", settings["sycl_targets"]) write_env("DEVICE_SELECTOR", settings["device_selector"]) write_env("ITLABAI_ENABLE_OPENCV_APPS", settings["opencv_apps"]) + write_env("ITLABAI_SYCL_IMPLEMENTATION", "IntelSYCL") def setup_linux_runtime() -> None: From 349d964e08ce39919af01e8d498411cadd3bb371 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 01:50:14 +0100 Subject: [PATCH 056/104] Restore clang-format action --- .github/workflows/ci.yml | 18 ++-------- scripts/ci/clang_format_check.py | 61 -------------------------------- 2 files changed, 2 insertions(+), 77 deletions(-) delete mode 100644 scripts/ci/clang_format_check.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fb9092d2..578a07702 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,23 +16,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: DoozyX/clang-format-lint-action@v0.15 with: - fetch-depth: 0 - - name: Install clang-format - run: sudo apt-get update && sudo apt-get install -y clang-format-18 - - name: Fetch diff refs - env: - BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} - HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} - run: | - if [[ -n "${BASE_SHA}" ]]; then - git fetch --no-tags origin "${BASE_SHA}" "${HEAD_SHA}" - fi - - name: Run clang-format - env: - BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} - HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} - run: python3 ./scripts/ci/clang_format_check.py "${BASE_SHA}" "${HEAD_SHA}" + source: './app ./include ./src ./test' build-linux: strategy: matrix: diff --git a/scripts/ci/clang_format_check.py b/scripts/ci/clang_format_check.py deleted file mode 100644 index 0d6e3a9d0..000000000 --- a/scripts/ci/clang_format_check.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python3 - -from __future__ import annotations - -import os -import subprocess -import sys - -from common import capture, main_error, run - - -def main() -> None: - base_ref = sys.argv[1] if len(sys.argv) > 1 else "" - head_ref = sys.argv[2] if len(sys.argv) > 2 else "HEAD" - - if not base_ref or set(base_ref) == {"0"}: - base_ref = capture(["git", "rev-parse", f"{head_ref}^"]) - - diff_output = subprocess.check_output( - [ - "git", - "diff", - "--name-only", - "--diff-filter=ACMR", - base_ref, - head_ref, - "--", - "app", - "include", - "src", - "test", - ], - text=True, - ) - - valid_suffixes = { - ".c", - ".h", - ".C", - ".H", - ".cpp", - ".hpp", - ".cc", - ".hh", - ".c++", - ".h++", - ".cxx", - ".hxx", - } - files = [line for line in diff_output.splitlines() if any(line.endswith(suffix) for suffix in valid_suffixes)] - - if not files: - print("No source files changed.") - return - - clang_format_bin = os.environ.get("CLANG_FORMAT_BIN", "clang-format-18") - run([clang_format_bin, "--dry-run", "-Werror", *files]) - - -if __name__ == "__main__": - main() From 2980a812c9d0942647c5aa6d3924f3bcbed0750a Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 01:57:56 +0100 Subject: [PATCH 057/104] Add AdaptiveCpp Linux arm SYCL job --- .github/workflows/sycl-ci.yml | 16 ++-- scripts/ci/sycl_adaptivecpp_setup.py | 107 +++++++++++++++++++++++++++ scripts/ci/sycl_macos_setup.py | 26 ------- 3 files changed, 117 insertions(+), 32 deletions(-) create mode 100644 scripts/ci/sycl_adaptivecpp_setup.py delete mode 100644 scripts/ci/sycl_macos_setup.py diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index ccaddf72d..f82283182 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -11,6 +11,7 @@ concurrency: env: INTEL_LLVM_TAG: nightly-2026-03-17 INTEL_OPENCL_CPU_RUNTIME_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/ad824c04-01c8-4ae5-b5e8-164a04f67609/w_opencl_runtime_p_2025.3.1.762.exe + ADAPTIVECPP_TAG: v25.10.0 jobs: build-sycl-x86: @@ -68,13 +69,16 @@ jobs: - name: Test run: ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" ctest --test-dir build --output-on-failure --parallel - build-sycl-macos-arm64: - name: macos-arm64 / ${{ matrix.build_type }} - runs-on: macos-15 + build-sycl-adaptivecpp-arm64: + name: ${{ matrix.platform }} / ${{ matrix.build_type }} + runs-on: ${{ matrix.platform == 'linux-arm64' && 'ubuntu-24.04-arm' || 'macos-15' }} timeout-minutes: 360 strategy: fail-fast: true matrix: + platform: + - linux-arm64 + - macos-arm64 build_type: - Debug - Release @@ -94,11 +98,11 @@ jobs: - name: Setup ccache uses: hendrikmuhs/ccache-action@v1.2 with: - key: ccache-${{ github.job }}-${{ matrix.build_type }} + key: ccache-${{ github.job }}-${{ matrix.platform }}-${{ matrix.build_type }} max-size: 2G - - name: Install macOS prerequisites - run: python3 ./scripts/ci/sycl_macos_setup.py + - name: Install AdaptiveCpp prerequisites + run: python3 ./scripts/ci/sycl_adaptivecpp_setup.py - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" diff --git a/scripts/ci/sycl_adaptivecpp_setup.py b/scripts/ci/sycl_adaptivecpp_setup.py new file mode 100644 index 000000000..112036b64 --- /dev/null +++ b/scripts/ci/sycl_adaptivecpp_setup.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +from pathlib import Path + +from common import append_path, capture, prepend_env_path, require_env, run, write_env + + +def set_common_env(prefix: str, clang_path: str, clangxx_path: str) -> None: + write_env("ITLABAI_CC", clang_path) + write_env("ITLABAI_CXX", clangxx_path) + write_env("ITLABAI_CMAKE_PREFIX_PATH", prefix) + write_env("ITLABAI_SYCL_IMPLEMENTATION", "AdaptiveCpp") + write_env("ITLABAI_ENABLE_OPENCV_APPS", "ON") + write_env("ACPP_TARGETS", "omp.library-only") + append_path(f"{prefix}/bin") + + +def setup_macos() -> None: + run(["brew", "install", "adaptivecpp"]) + + adaptivecpp_prefix = capture(["brew", "--prefix", "adaptivecpp"]) + clang_path = capture(["xcrun", "--find", "clang"]) + clangxx_path = capture(["xcrun", "--find", "clang++"]) + + set_common_env(adaptivecpp_prefix, clang_path, clangxx_path) + + +def setup_linux() -> None: + run(["sudo", "apt-get", "update"]) + run( + [ + "sudo", + "apt-get", + "install", + "-y", + "build-essential", + "clang-18", + "cmake", + "git", + "libboost-context-dev", + "libboost-fiber-dev", + "libboost-filesystem-dev", + "libboost-system-dev", + "libboost-test-dev", + "libclang-18-dev", + "libomp-18-dev", + "llvm-18-dev", + "python3", + ] + ) + + runner_temp = Path(require_env("RUNNER_TEMP")) + source_dir = runner_temp / "AdaptiveCpp" + build_dir = runner_temp / "AdaptiveCpp-build" + install_dir = runner_temp / "adaptivecpp-install" + tag = require_env("ADAPTIVECPP_TAG") + + run( + [ + "git", + "clone", + "--branch", + tag, + "--depth", + "1", + "https://github.com/AdaptiveCpp/AdaptiveCpp.git", + str(source_dir), + ] + ) + run( + [ + "cmake", + "-S", + str(source_dir), + "-B", + str(build_dir), + "-G", + "Ninja", + "-DCMAKE_BUILD_TYPE=Release", + f"-DCMAKE_INSTALL_PREFIX={install_dir}", + "-DCMAKE_C_COMPILER=clang-18", + "-DCMAKE_CXX_COMPILER=clang++-18", + "-DLLVM_DIR=/usr/lib/llvm-18/lib/cmake/llvm", + "-DClang_DIR=/usr/lib/llvm-18/lib/cmake/clang", + ] + ) + run(["cmake", "--build", str(build_dir), "--target", "install", "--parallel"]) + + set_common_env(str(install_dir), "/usr/bin/clang-18", "/usr/bin/clang++-18") + prepend_env_path("LD_LIBRARY_PATH", f"{install_dir}/lib") + prepend_env_path("LD_LIBRARY_PATH", "/usr/lib/llvm-18/lib") + + +def main() -> None: + runner_os = require_env("RUNNER_OS") + if runner_os == "macOS": + setup_macos() + elif runner_os == "Linux": + setup_linux() + else: + raise SystemExit(f"Unsupported RUNNER_OS for AdaptiveCpp setup: {runner_os}") + + +if __name__ == "__main__": + main() diff --git a/scripts/ci/sycl_macos_setup.py b/scripts/ci/sycl_macos_setup.py deleted file mode 100644 index 2ed7e3f21..000000000 --- a/scripts/ci/sycl_macos_setup.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 - -from __future__ import annotations - -from common import append_path, capture, run, write_env - - -def main() -> None: - run(["brew", "install", "adaptivecpp"]) - - adaptivecpp_prefix = capture(["brew", "--prefix", "adaptivecpp"]) - clang_path = capture(["xcrun", "--find", "clang"]) - clangxx_path = capture(["xcrun", "--find", "clang++"]) - - write_env("ITLABAI_CC", clang_path) - write_env("ITLABAI_CXX", clangxx_path) - write_env("ITLABAI_CMAKE_PREFIX_PATH", adaptivecpp_prefix) - write_env("ITLABAI_SYCL_IMPLEMENTATION", "AdaptiveCpp") - write_env("ITLABAI_ENABLE_OPENCV_APPS", "ON") - write_env("ACPP_TARGETS", "omp") - - append_path(f"{adaptivecpp_prefix}/bin") - - -if __name__ == "__main__": - main() From bfb79bf2d4e9526bc5e2ab50254d9debd74c7ca4 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 02:03:35 +0100 Subject: [PATCH 058/104] Use compiler-driven Intel SYCL flow --- CMakeLists.txt | 43 +++++++++++++++++++++++++++++++----- app/SYCL/CMakeLists.txt | 2 +- scripts/ci/sycl_configure.py | 4 ++++ scripts/ci/sycl_x86_setup.py | 3 ++- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d66485b5..10cd00a32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,11 +7,11 @@ option(ITLABAI_ENABLE_SYCL "Build SYCL example and helper targets" OFF) option(ITLABAI_ENABLE_OPENCV_APPS "Build OpenCV-dependent apps" ON) option(ITLABAI_BUILD_TESTS "Build unit tests" ON) set(ITLABAI_SYCL_IMPLEMENTATION "" CACHE STRING - "SYCL implementation package to use: IntelSYCL or AdaptiveCpp") + "SYCL implementation to use: IntelLLVM or AdaptiveCpp") set_property(CACHE ITLABAI_SYCL_IMPLEMENTATION PROPERTY STRINGS - IntelSYCL AdaptiveCpp) + IntelLLVM AdaptiveCpp) set(ITLABAI_SYCL_TARGETS "" CACHE STRING - "Optional SYCL targets; forwarded to AdaptiveCpp as ACPP_TARGETS") + "Optional SYCL targets; forwarded to AdaptiveCpp as ACPP_TARGETS or IntelLLVM as -fsycl-targets") option(ENABLE_STATISTIC_TENSORS "Enable statistic tensors" OFF) @@ -54,7 +54,7 @@ if(ITLABAI_ENABLE_SYCL) if(NOT ITLABAI_SYCL_IMPLEMENTATION) message(FATAL_ERROR "ITLABAI_ENABLE_SYCL=ON requires ITLABAI_SYCL_IMPLEMENTATION " - "to be set to IntelSYCL or AdaptiveCpp") + "to be set to IntelLLVM or AdaptiveCpp") endif() if(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "AdaptiveCpp") @@ -63,8 +63,39 @@ if(ITLABAI_ENABLE_SYCL) "AdaptiveCpp targets" FORCE) endif() find_package(AdaptiveCpp CONFIG REQUIRED) - elseif(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelSYCL") - find_package(IntelSYCL CONFIG REQUIRED) + function(itlabai_add_sycl_to_target) + add_sycl_to_target(${ARGN}) + endfunction() + elseif(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") + function(itlabai_add_sycl_to_target) + set(options) + set(one_value_keywords TARGET) + set(multi_value_keywords SOURCES) + cmake_parse_arguments(ITLABAI_SYCL + "${options}" + "${one_value_keywords}" + "${multi_value_keywords}" + ${ARGN} + ) + + if(NOT ITLABAI_SYCL_TARGET) + message(FATAL_ERROR "itlabai_add_sycl_to_target requires TARGET") + endif() + + target_compile_options(${ITLABAI_SYCL_TARGET} PRIVATE + $<$:-fsycl> + ) + target_link_options(${ITLABAI_SYCL_TARGET} PRIVATE -fsycl) + + if(ITLABAI_SYCL_TARGETS) + target_compile_options(${ITLABAI_SYCL_TARGET} PRIVATE + $<$:-fsycl-targets=${ITLABAI_SYCL_TARGETS}> + ) + target_link_options(${ITLABAI_SYCL_TARGET} PRIVATE + -fsycl-targets=${ITLABAI_SYCL_TARGETS} + ) + endif() + endfunction() else() message(FATAL_ERROR "Unsupported ITLABAI_SYCL_IMPLEMENTATION=" diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index d267f428b..a2a4a5791 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -3,7 +3,7 @@ add_executable(SYCL_Example sycl_kernel.cpp ) target_link_libraries(SYCL_Example PRIVATE layers_lib) -add_sycl_to_target(TARGET SYCL_Example SOURCES +itlabai_add_sycl_to_target(TARGET SYCL_Example SOURCES sycl_example.cpp sycl_kernel.cpp ) diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py index def893d16..f145e8e1d 100644 --- a/scripts/ci/sycl_configure.py +++ b/scripts/ci/sycl_configure.py @@ -44,6 +44,10 @@ def main() -> None: if acpp_targets: cmake_args.append(f"-DACPP_TARGETS={acpp_targets}") + itlabai_sycl_targets = os.environ.get("ITLABAI_SYCL_TARGETS", "") + if itlabai_sycl_targets: + cmake_args.append(f"-DITLABAI_SYCL_TARGETS={itlabai_sycl_targets}") + run( [ "cmake", diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 3fe0dccf1..83b4f58a6 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -41,7 +41,8 @@ def configure_platform(platform: str) -> None: write_env("TOOLCHAIN_ASSET", settings["toolchain_asset"]) write_env("DEVICE_SELECTOR", settings["device_selector"]) write_env("ITLABAI_ENABLE_OPENCV_APPS", settings["opencv_apps"]) - write_env("ITLABAI_SYCL_IMPLEMENTATION", "IntelSYCL") + write_env("ITLABAI_SYCL_IMPLEMENTATION", "IntelLLVM") + write_env("ITLABAI_SYCL_TARGETS", "spir64") def setup_linux_runtime() -> None: From a30f6bbd4f70f515dd3927e451c89fda23ee6b9c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 02:24:17 +0100 Subject: [PATCH 059/104] Fix macOS AdaptiveCpp OpenMP detection --- scripts/ci/sycl_adaptivecpp_setup.py | 15 +++++++++------ scripts/ci/sycl_configure.py | 4 ++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/ci/sycl_adaptivecpp_setup.py b/scripts/ci/sycl_adaptivecpp_setup.py index 112036b64..3778cf1e8 100644 --- a/scripts/ci/sycl_adaptivecpp_setup.py +++ b/scripts/ci/sycl_adaptivecpp_setup.py @@ -7,24 +7,27 @@ from common import append_path, capture, prepend_env_path, require_env, run, write_env -def set_common_env(prefix: str, clang_path: str, clangxx_path: str) -> None: +def set_common_env(prefixes: list[str], clang_path: str, clangxx_path: str) -> None: + prefix_path = ";".join(prefixes) write_env("ITLABAI_CC", clang_path) write_env("ITLABAI_CXX", clangxx_path) - write_env("ITLABAI_CMAKE_PREFIX_PATH", prefix) + write_env("ITLABAI_CMAKE_PREFIX_PATH", prefix_path) write_env("ITLABAI_SYCL_IMPLEMENTATION", "AdaptiveCpp") write_env("ITLABAI_ENABLE_OPENCV_APPS", "ON") write_env("ACPP_TARGETS", "omp.library-only") - append_path(f"{prefix}/bin") + append_path(f"{prefixes[0]}/bin") def setup_macos() -> None: - run(["brew", "install", "adaptivecpp"]) + run(["brew", "install", "adaptivecpp", "libomp"]) adaptivecpp_prefix = capture(["brew", "--prefix", "adaptivecpp"]) + libomp_prefix = capture(["brew", "--prefix", "libomp"]) clang_path = capture(["xcrun", "--find", "clang"]) clangxx_path = capture(["xcrun", "--find", "clang++"]) - set_common_env(adaptivecpp_prefix, clang_path, clangxx_path) + write_env("ITLABAI_OPENMP_ROOT", libomp_prefix) + set_common_env([adaptivecpp_prefix, libomp_prefix], clang_path, clangxx_path) def setup_linux() -> None: @@ -88,7 +91,7 @@ def setup_linux() -> None: ) run(["cmake", "--build", str(build_dir), "--target", "install", "--parallel"]) - set_common_env(str(install_dir), "/usr/bin/clang-18", "/usr/bin/clang++-18") + set_common_env([str(install_dir)], "/usr/bin/clang-18", "/usr/bin/clang++-18") prepend_env_path("LD_LIBRARY_PATH", f"{install_dir}/lib") prepend_env_path("LD_LIBRARY_PATH", "/usr/lib/llvm-18/lib") diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py index f145e8e1d..1367747cf 100644 --- a/scripts/ci/sycl_configure.py +++ b/scripts/ci/sycl_configure.py @@ -40,6 +40,10 @@ def main() -> None: if openmp_include_dir: cmake_args.append(f"-DITLABAI_OPENMP_INCLUDE_DIR={openmp_include_dir}") + openmp_root = os.environ.get("ITLABAI_OPENMP_ROOT", "") + if openmp_root: + cmake_args.append(f"-DOpenMP_ROOT={openmp_root}") + acpp_targets = os.environ.get("ACPP_TARGETS", "") if acpp_targets: cmake_args.append(f"-DACPP_TARGETS={acpp_targets}") From 6fed73a765c4742b803609d0c44fad5b80986181 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 02:56:00 +0100 Subject: [PATCH 060/104] Pin Linux SYCL builds to GCC 13 --- scripts/ci/sycl_x86_setup.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 83b4f58a6..562022b3f 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -55,6 +55,8 @@ def setup_linux_runtime() -> None: "-y", "build-essential", "cmake", + "g++-13", + "gcc-13", "git", "libomp-dev", "ocl-icd-opencl-dev", @@ -95,6 +97,22 @@ def setup_linux_runtime() -> None: run(["sudo", "apt-get", "update"]) run(["sudo", "apt-get", "install", "-y", "intel-oneapi-runtime-opencl"]) + gcc_shim_dir = Path(require_env("RUNNER_TEMP")) / "gcc-13-shim" + gcc_shim_dir.mkdir(parents=True, exist_ok=True) + for link_name, target in ( + ("gcc", "/usr/bin/gcc-13"), + ("g++", "/usr/bin/g++-13"), + ("cc", "/usr/bin/gcc-13"), + ("c++", "/usr/bin/g++-13"), + ): + link_path = gcc_shim_dir / link_name + if link_path.exists() or link_path.is_symlink(): + link_path.unlink() + link_path.symlink_to(target) + + current_path = os.environ.get("PATH", "") + write_env("PATH", f"{gcc_shim_dir}:{current_path}" if current_path else str(gcc_shim_dir)) + icd_dir = Path(require_env("RUNNER_TEMP")) / "intel-opencl-icd" icd_dir.mkdir(parents=True, exist_ok=True) From 3a17b135f96cf2df734b766b5a4a734c6bbfee67 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 03:02:21 +0100 Subject: [PATCH 061/104] Use explicit GCC install dir for Intel SYCL --- scripts/ci/sycl_configure.py | 13 +++++++++++++ scripts/ci/sycl_x86_setup.py | 16 +--------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py index 1367747cf..7002bcb18 100644 --- a/scripts/ci/sycl_configure.py +++ b/scripts/ci/sycl_configure.py @@ -52,6 +52,19 @@ def main() -> None: if itlabai_sycl_targets: cmake_args.append(f"-DITLABAI_SYCL_TARGETS={itlabai_sycl_targets}") + c_flags = os.environ.get("ITLABAI_C_FLAGS", "") + cxx_flags = os.environ.get("ITLABAI_CXX_FLAGS", "") + gcc_install_dir = os.environ.get("ITLABAI_GCC_INSTALL_DIR", "") + if gcc_install_dir: + gcc_toolchain_flag = f"--gcc-install-dir={gcc_install_dir}" + cmake_args.append(f"-DCMAKE_C_FLAGS={gcc_toolchain_flag} {c_flags}".strip()) + cmake_args.append(f"-DCMAKE_CXX_FLAGS={gcc_toolchain_flag} {cxx_flags}".strip()) + else: + if c_flags: + cmake_args.append(f"-DCMAKE_C_FLAGS={c_flags}") + if cxx_flags: + cmake_args.append(f"-DCMAKE_CXX_FLAGS={cxx_flags}") + run( [ "cmake", diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 562022b3f..7d6511de5 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -97,21 +97,7 @@ def setup_linux_runtime() -> None: run(["sudo", "apt-get", "update"]) run(["sudo", "apt-get", "install", "-y", "intel-oneapi-runtime-opencl"]) - gcc_shim_dir = Path(require_env("RUNNER_TEMP")) / "gcc-13-shim" - gcc_shim_dir.mkdir(parents=True, exist_ok=True) - for link_name, target in ( - ("gcc", "/usr/bin/gcc-13"), - ("g++", "/usr/bin/g++-13"), - ("cc", "/usr/bin/gcc-13"), - ("c++", "/usr/bin/g++-13"), - ): - link_path = gcc_shim_dir / link_name - if link_path.exists() or link_path.is_symlink(): - link_path.unlink() - link_path.symlink_to(target) - - current_path = os.environ.get("PATH", "") - write_env("PATH", f"{gcc_shim_dir}:{current_path}" if current_path else str(gcc_shim_dir)) + write_env("ITLABAI_GCC_INSTALL_DIR", "/usr/lib/gcc/x86_64-linux-gnu/13") icd_dir = Path(require_env("RUNNER_TEMP")) / "intel-opencl-icd" icd_dir.mkdir(parents=True, exist_ok=True) From 2d3b237830d23822c8c6e806ddd7ec93524b61b8 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 03:46:53 +0100 Subject: [PATCH 062/104] Fix SYCL review issues and Linux PSTL build --- cmake/opencv_config.cmake | 6 ++++++ include/layers/Layer.hpp | 1 - test/CMakeLists.txt | 26 +++++++++++++++++--------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/cmake/opencv_config.cmake b/cmake/opencv_config.cmake index 1fbae736a..3d6264fc9 100644 --- a/cmake/opencv_config.cmake +++ b/cmake/opencv_config.cmake @@ -44,12 +44,18 @@ file(APPEND "${OPENCV_INITIAL_CACHE}" "set(CMAKE_C_COMPILER \"${OPENCV_C_COMPILER}\" CACHE FILEPATH \"\" FORCE)\n") file(APPEND "${OPENCV_INITIAL_CACHE}" "set(CMAKE_CXX_COMPILER \"${OPENCV_CXX_COMPILER}\" CACHE FILEPATH \"\" FORCE)\n") +file(APPEND "${OPENCV_INITIAL_CACHE}" + "set(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS}\" CACHE STRING \"\" FORCE)\n") +file(APPEND "${OPENCV_INITIAL_CACHE}" + "set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS}\" CACHE STRING \"\" FORCE)\n") set(OPENCV_CMAKE_ARGS -C "${OPENCV_INITIAL_CACHE}" -G "${CMAKE_GENERATOR}" -DCMAKE_C_COMPILER:FILEPATH=${OPENCV_C_COMPILER} -DCMAKE_CXX_COMPILER:FILEPATH=${OPENCV_CXX_COMPILER} + -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} + -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${OPENCV_INSTALL_DIR} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} diff --git a/include/layers/Layer.hpp b/include/layers/Layer.hpp index e6e453797..e1b6ab5b7 100644 --- a/include/layers/Layer.hpp +++ b/include/layers/Layer.hpp @@ -1,6 +1,5 @@ #pragma once #include -#include #include #include #include diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 142773ef3..e4d5294aa 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,18 +1,24 @@ file(GLOB_RECURSE TEST_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +if(NOT ITLABAI_ENABLE_OPENCV_APPS) + list(REMOVE_ITEM TEST_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/test_read/test_read.cpp") +endif() + add_executable(run_test ${TEST_SRC_FILES}) target_link_libraries(run_test PUBLIC OpenMP::OpenMP_CXX) target_link_libraries(run_test PUBLIC perf_lib layers_lib layers_oneDNN_lib layers_fused_lib) target_link_libraries(run_test PUBLIC gtest) -target_link_libraries(run_test PUBLIC ReadLib) target_link_libraries(run_test PUBLIC reader_lib) target_link_libraries(run_test PUBLIC graph_lib) target_link_libraries(run_test PUBLIC graphT_lib) +if(ITLABAI_ENABLE_OPENCV_APPS) + target_link_libraries(run_test PUBLIC ReadLib) + target_include_directories(run_test PRIVATE "${CMAKE_SOURCE_DIR}/app/ReaderImage") +endif() target_include_directories(run_test PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") -target_include_directories(run_test PRIVATE "${CMAKE_SOURCE_DIR}/app/ReaderImage") if (WIN32) add_custom_command(TARGET run_test POST_BUILD @@ -24,13 +30,15 @@ endif() add_test(UnitTests ${CMAKE_BINARY_DIR}/bin/run_test) -file(DOWNLOAD - "https://raw.githubusercontent.com/opencv/opencv/4.x/samples/data/lena.jpg" - "${CMAKE_CURRENT_BINARY_DIR}/image.jpg" - SHOW_PROGRESS - STATUS status_code - LOG log_file -) +if(ITLABAI_ENABLE_OPENCV_APPS) + file(DOWNLOAD + "https://raw.githubusercontent.com/opencv/opencv/4.x/samples/data/lena.jpg" + "${CMAKE_CURRENT_BINARY_DIR}/image.jpg" + SHOW_PROGRESS + STATUS status_code + LOG log_file + ) +endif() file(DOWNLOAD "https://raw.githubusercontent.com/bpinaya/AlexNetRT/master/data/alexnet/imagenet-labels.txt" From 413b0c69d2a81bdf16dafb4e884921e853c2797c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 03:51:53 +0100 Subject: [PATCH 063/104] Avoid cstdint in Intel SYCL headers --- include/graph/runtime_options.hpp | 2 +- include/layers/ConcatLayer.hpp | 2 +- include/layers/InputLayer.hpp | 2 +- include/layers/ReduceLayer.hpp | 2 +- include/layers/Tensor.hpp | 2 +- include/layers_oneDNN/ReduceLayer.hpp | 2 +- include/parallel/backends.hpp | 4 ++-- test/single_layer/test_batchnormalizationlayer.cpp | 2 +- test/single_layer/test_matmullayer.cpp | 2 +- test/single_layer/test_tensor.cpp | 2 +- test/single_layer/test_transposelayer.cpp | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/graph/runtime_options.hpp b/include/graph/runtime_options.hpp index be05344e6..80ebb99d0 100644 --- a/include/graph/runtime_options.hpp +++ b/include/graph/runtime_options.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include #include "parallel/parallel.hpp" diff --git a/include/layers/ConcatLayer.hpp b/include/layers/ConcatLayer.hpp index a648fb0db..a012f2932 100644 --- a/include/layers/ConcatLayer.hpp +++ b/include/layers/ConcatLayer.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include #include diff --git a/include/layers/InputLayer.hpp b/include/layers/InputLayer.hpp index e0de8e6e0..833de2467 100644 --- a/include/layers/InputLayer.hpp +++ b/include/layers/InputLayer.hpp @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include #include "layers/Layer.hpp" diff --git a/include/layers/ReduceLayer.hpp b/include/layers/ReduceLayer.hpp index 9d13d7668..e31b25257 100644 --- a/include/layers/ReduceLayer.hpp +++ b/include/layers/ReduceLayer.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include diff --git a/include/layers/Tensor.hpp b/include/layers/Tensor.hpp index 464236c00..837885bc8 100644 --- a/include/layers/Tensor.hpp +++ b/include/layers/Tensor.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include diff --git a/include/layers_oneDNN/ReduceLayer.hpp b/include/layers_oneDNN/ReduceLayer.hpp index 7b53099d4..9ab657188 100644 --- a/include/layers_oneDNN/ReduceLayer.hpp +++ b/include/layers_oneDNN/ReduceLayer.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include #include diff --git a/include/parallel/backends.hpp b/include/parallel/backends.hpp index 163e361bb..fa7511ded 100644 --- a/include/parallel/backends.hpp +++ b/include/parallel/backends.hpp @@ -6,7 +6,7 @@ // NOLINTNEXTLINE(misc-header-include-cycle) #include #include -#include +#include #include #include #include @@ -15,7 +15,7 @@ namespace it_lab_ai { namespace parallel { -enum class Backend : std::uint8_t { +enum class Backend : uint8_t { kSeq = 0, kThreads = 1, kTbb = 2, diff --git a/test/single_layer/test_batchnormalizationlayer.cpp b/test/single_layer/test_batchnormalizationlayer.cpp index 17370b539..fead6d67a 100644 --- a/test/single_layer/test_batchnormalizationlayer.cpp +++ b/test/single_layer/test_batchnormalizationlayer.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/test/single_layer/test_matmullayer.cpp b/test/single_layer/test_matmullayer.cpp index f31c59ef1..cb017108b 100644 --- a/test/single_layer/test_matmullayer.cpp +++ b/test/single_layer/test_matmullayer.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/test/single_layer/test_tensor.cpp b/test/single_layer/test_tensor.cpp index 5054e460e..98636969e 100644 --- a/test/single_layer/test_tensor.cpp +++ b/test/single_layer/test_tensor.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/test/single_layer/test_transposelayer.cpp b/test/single_layer/test_transposelayer.cpp index c538a1303..5afa50496 100644 --- a/test/single_layer/test_transposelayer.cpp +++ b/test/single_layer/test_transposelayer.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include From 5c4e997b465a240dbc4109cd58aa228bbb51ae04 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 04:04:11 +0100 Subject: [PATCH 064/104] Format integer-header changes and fix OpenMP include order --- include/layers/ConcatLayer.hpp | 1 + include/layers/InputLayer.hpp | 3 ++- include/layers/ReduceLayer.hpp | 1 + include/layers/Tensor.hpp | 1 + include/layers_oneDNN/ReduceLayer.hpp | 1 + include/parallel/backends.hpp | 3 ++- include/perf/benchmarking.hpp | 1 + test/single_layer/test_batchnormalizationlayer.cpp | 5 +++-- test/single_layer/test_matmullayer.cpp | 1 + test/single_layer/test_tensor.cpp | 1 + test/single_layer/test_transposelayer.cpp | 1 + 11 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/layers/ConcatLayer.hpp b/include/layers/ConcatLayer.hpp index a012f2932..ee665beab 100644 --- a/include/layers/ConcatLayer.hpp +++ b/include/layers/ConcatLayer.hpp @@ -1,5 +1,6 @@ #pragma once #include + #include #include #include diff --git a/include/layers/InputLayer.hpp b/include/layers/InputLayer.hpp index 833de2467..54d8904ad 100644 --- a/include/layers/InputLayer.hpp +++ b/include/layers/InputLayer.hpp @@ -1,7 +1,8 @@ #pragma once +#include + #include #include -#include #include "layers/Layer.hpp" diff --git a/include/layers/ReduceLayer.hpp b/include/layers/ReduceLayer.hpp index e31b25257..384081267 100644 --- a/include/layers/ReduceLayer.hpp +++ b/include/layers/ReduceLayer.hpp @@ -1,5 +1,6 @@ #pragma once #include + #include #include diff --git a/include/layers/Tensor.hpp b/include/layers/Tensor.hpp index 837885bc8..f587a2f5b 100644 --- a/include/layers/Tensor.hpp +++ b/include/layers/Tensor.hpp @@ -1,6 +1,7 @@ #pragma once #include + #include #include #include diff --git a/include/layers_oneDNN/ReduceLayer.hpp b/include/layers_oneDNN/ReduceLayer.hpp index 9ab657188..def294888 100644 --- a/include/layers_oneDNN/ReduceLayer.hpp +++ b/include/layers_oneDNN/ReduceLayer.hpp @@ -1,5 +1,6 @@ #pragma once #include + #include #include #include diff --git a/include/parallel/backends.hpp b/include/parallel/backends.hpp index fa7511ded..94d4038dd 100644 --- a/include/parallel/backends.hpp +++ b/include/parallel/backends.hpp @@ -4,9 +4,10 @@ #include // NOLINTNEXTLINE(misc-header-include-cycle) +#include + #include #include -#include #include #include #include diff --git a/include/perf/benchmarking.hpp b/include/perf/benchmarking.hpp index e63b57c6e..3a54cf8c8 100644 --- a/include/perf/benchmarking.hpp +++ b/include/perf/benchmarking.hpp @@ -2,6 +2,7 @@ #pragma once #include +#include #include #include diff --git a/test/single_layer/test_batchnormalizationlayer.cpp b/test/single_layer/test_batchnormalizationlayer.cpp index fead6d67a..7190569fb 100644 --- a/test/single_layer/test_batchnormalizationlayer.cpp +++ b/test/single_layer/test_batchnormalizationlayer.cpp @@ -1,5 +1,6 @@ -#include -#include +#include + +#include #include #include diff --git a/test/single_layer/test_matmullayer.cpp b/test/single_layer/test_matmullayer.cpp index cb017108b..889731304 100644 --- a/test/single_layer/test_matmullayer.cpp +++ b/test/single_layer/test_matmullayer.cpp @@ -1,4 +1,5 @@ #include + #include #include diff --git a/test/single_layer/test_tensor.cpp b/test/single_layer/test_tensor.cpp index 98636969e..549f75a6e 100644 --- a/test/single_layer/test_tensor.cpp +++ b/test/single_layer/test_tensor.cpp @@ -1,4 +1,5 @@ #include + #include #include diff --git a/test/single_layer/test_transposelayer.cpp b/test/single_layer/test_transposelayer.cpp index 5afa50496..be0b9cf39 100644 --- a/test/single_layer/test_transposelayer.cpp +++ b/test/single_layer/test_transposelayer.cpp @@ -1,4 +1,5 @@ #include + #include #include From 17cd8f3f5398d22e6403da98e8a97c81db5279b0 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 04:30:54 +0100 Subject: [PATCH 065/104] Fix integer include order before TBB --- include/parallel/backends.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/parallel/backends.hpp b/include/parallel/backends.hpp index 94d4038dd..04fed1a99 100644 --- a/include/parallel/backends.hpp +++ b/include/parallel/backends.hpp @@ -2,10 +2,9 @@ #include #include #include - -// NOLINTNEXTLINE(misc-header-include-cycle) #include +// NOLINTNEXTLINE(misc-header-include-cycle) #include #include #include From 600c5de4c492b074a2199b487f38bd40a0a09482 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 14:13:10 +0100 Subject: [PATCH 066/104] Preserve integer includes before OpenMP and TBB --- include/parallel/backends.hpp | 4 +++- include/perf/benchmarking.hpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/parallel/backends.hpp b/include/parallel/backends.hpp index 04fed1a99..963639602 100644 --- a/include/parallel/backends.hpp +++ b/include/parallel/backends.hpp @@ -1,8 +1,10 @@ #pragma once +// clang-format off +#include #include #include #include -#include +// clang-format on // NOLINTNEXTLINE(misc-header-include-cycle) #include diff --git a/include/perf/benchmarking.hpp b/include/perf/benchmarking.hpp index 3a54cf8c8..c8dafac46 100644 --- a/include/perf/benchmarking.hpp +++ b/include/perf/benchmarking.hpp @@ -1,8 +1,10 @@ // Using chrono for good measurements and parallelism support #pragma once -#include +// clang-format off #include +#include +// clang-format on #include #include From 3322b4fa972a4504f036110d93ef98f7616acb9f Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 14:21:05 +0100 Subject: [PATCH 067/104] Use compiler OpenMP headers in SYCL CI --- scripts/ci/sycl_x86_setup.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 7d6511de5..d08ec7301 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -58,7 +58,6 @@ def setup_linux_runtime() -> None: "g++-13", "gcc-13", "git", - "libomp-dev", "ocl-icd-opencl-dev", "opencl-headers", "python3", @@ -200,15 +199,13 @@ def setup_unix_compilers(sycl_root: Path) -> None: if openmp_library is None: main_error("Unable to locate libiomp5.so for the SYCL toolchain") - search_roots = [ - Path(capture([str(cxx_path), "-print-resource-dir"])), - sycl_root, - Path("/opt/intel/oneapi"), - ] - search_roots.extend(Path("/usr/lib").glob("llvm-*")) - openmp_header = find_file(search_roots, "omp.h") - if openmp_header is None: - main_error("Unable to locate omp.h for the SYCL toolchain") + resource_dir = Path(capture([str(cxx_path), "-print-resource-dir"])) + openmp_header = resource_dir / "include" / "omp.h" + if not openmp_header.is_file(): + main_error( + "Unable to locate compiler-provided omp.h under " + f"{resource_dir / 'include'}" + ) write_env("ITLABAI_OPENMP_FLAGS", "-fopenmp=libiomp5") write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) From 1dbf531cc9c9934fdc7bb0b06cf7417a15f3352f Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 14:26:23 +0100 Subject: [PATCH 068/104] Use Intel OpenMP headers in SYCL CI --- scripts/ci/sycl_x86_setup.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index d08ec7301..7ca49f395 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -200,11 +200,17 @@ def setup_unix_compilers(sycl_root: Path) -> None: main_error("Unable to locate libiomp5.so for the SYCL toolchain") resource_dir = Path(capture([str(cxx_path), "-print-resource-dir"])) - openmp_header = resource_dir / "include" / "omp.h" - if not openmp_header.is_file(): + openmp_header = find_file( + [ + resource_dir / "include", + sycl_root, + Path("/opt/intel/oneapi"), + ], + "omp.h", + ) + if openmp_header is None: main_error( - "Unable to locate compiler-provided omp.h under " - f"{resource_dir / 'include'}" + "Unable to locate Intel-provided omp.h under the SYCL toolchain" ) write_env("ITLABAI_OPENMP_FLAGS", "-fopenmp=libiomp5") From 8ea46d12c473d17e9d99c0026e169a71af054bed Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 14:59:48 +0100 Subject: [PATCH 069/104] Use oneAPI compiler for Linux SYCL CI --- scripts/ci/sycl_x86_setup.py | 39 ++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 7ca49f395..7727fa447 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -94,7 +94,16 @@ def setup_linux_runtime() -> None: ), ) run(["sudo", "apt-get", "update"]) - run(["sudo", "apt-get", "install", "-y", "intel-oneapi-runtime-opencl"]) + run( + [ + "sudo", + "apt-get", + "install", + "-y", + "intel-oneapi-compiler-dpcpp-cpp", + "intel-oneapi-runtime-opencl", + ] + ) write_env("ITLABAI_GCC_INSTALL_DIR", "/usr/lib/gcc/x86_64-linux-gnu/13") @@ -186,12 +195,34 @@ def setup_windows_compilers(sycl_root: Path) -> None: def setup_unix_compilers(sycl_root: Path) -> None: - cc_path = find_first_existing([sycl_root / "bin" / "icx", sycl_root / "bin" / "clang"]) - cxx_path = find_first_existing([sycl_root / "bin" / "icpx", sycl_root / "bin" / "clang++"]) + cc_candidates = [sycl_root / "bin" / "icx", sycl_root / "bin" / "clang"] + cxx_candidates = [sycl_root / "bin" / "icpx", sycl_root / "bin" / "clang++"] + prefix_paths = [sycl_root] + + if require_env("RUNNER_OS") == "Linux": + compiler_root = Path("/opt/intel/oneapi/compiler/latest") + cc_candidates = [ + compiler_root / "bin" / "compiler" / "icx", + compiler_root / "bin" / "compiler" / "clang", + *cc_candidates, + ] + cxx_candidates = [ + compiler_root / "bin" / "compiler" / "icpx", + compiler_root / "bin" / "compiler" / "clang++", + *cxx_candidates, + ] + prefix_paths = [compiler_root, sycl_root] + + cc_path = find_first_existing(cc_candidates) + cxx_path = find_first_existing(cxx_candidates) write_env("ITLABAI_CC", str(cc_path)) write_env("ITLABAI_CXX", str(cxx_path)) - write_env("ITLABAI_CMAKE_PREFIX_PATH", str(sycl_root)) + write_env( + "ITLABAI_CMAKE_PREFIX_PATH", + ":".join(str(path) for path in prefix_paths if path.exists()), + ) + append_path(str(cc_path.parent)) append_path(str(sycl_root / "bin")) if require_env("RUNNER_OS") == "Linux": From 365432d4abf3be5009e673c2d894885c6a057b99 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 15:55:42 +0100 Subject: [PATCH 070/104] Treat Kokkos headers as system includes --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10cd00a32..242e6b1c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,12 +114,12 @@ if(ITLABAI_ENABLE_OPENCV_APPS) endif() include(cmake/kokkos_config.cmake) -include_directories("${KOKKOS_INSTALL_DIR}/include") +include_directories(SYSTEM "${KOKKOS_INSTALL_DIR}/include") add_library(Kokkos_imported INTERFACE) add_dependencies(Kokkos_imported kokkos_external) -target_include_directories(Kokkos_imported INTERFACE +target_include_directories(Kokkos_imported SYSTEM INTERFACE "${KOKKOS_INSTALL_DIR}/include" ) target_link_directories(Kokkos_imported INTERFACE From ca552f81ce60d502b3ba7f9189a35beca3bcb1e7 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 16:10:52 +0100 Subject: [PATCH 071/104] Expose Intel SYCL runtime in Linux CI --- scripts/ci/sycl_x86_setup.py | 43 +++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 7727fa447..1cbf39771 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -198,6 +198,8 @@ def setup_unix_compilers(sycl_root: Path) -> None: cc_candidates = [sycl_root / "bin" / "icx", sycl_root / "bin" / "clang"] cxx_candidates = [sycl_root / "bin" / "icpx", sycl_root / "bin" / "clang++"] prefix_paths = [sycl_root] + library_roots = [sycl_root] + sycl_runtime_dirs: list[Path] = [] if require_env("RUNNER_OS") == "Linux": compiler_root = Path("/opt/intel/oneapi/compiler/latest") @@ -212,6 +214,7 @@ def setup_unix_compilers(sycl_root: Path) -> None: *cxx_candidates, ] prefix_paths = [compiler_root, sycl_root] + library_roots = [compiler_root, sycl_root] cc_path = find_first_existing(cc_candidates) cxx_path = find_first_existing(cxx_candidates) @@ -248,19 +251,33 @@ def setup_unix_compilers(sycl_root: Path) -> None: write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent)) - for library_dir_name in ("lib", "lib64"): - library_dir = sycl_root / library_dir_name - if library_dir.is_dir(): - current = os.environ.get("LD_LIBRARY_PATH", "") - write_env( - "LD_LIBRARY_PATH", - f"{library_dir}:{current}" if current else str(library_dir), - ) - current = os.environ.get("DYLD_LIBRARY_PATH", "") - write_env( - "DYLD_LIBRARY_PATH", - f"{library_dir}:{current}" if current else str(library_dir), - ) + libsycl = find_file(library_roots, "libsycl.so.8") + if libsycl is None: + libsycl = find_file(library_roots, "libsycl.so") + if libsycl is not None: + sycl_runtime_dirs.append(libsycl.parent) + + for root in library_roots: + for library_dir_name in ("lib", "lib64"): + library_dir = root / library_dir_name + if library_dir.is_dir(): + current = os.environ.get("LD_LIBRARY_PATH", "") + write_env( + "LD_LIBRARY_PATH", + f"{library_dir}:{current}" if current else str(library_dir), + ) + current = os.environ.get("DYLD_LIBRARY_PATH", "") + write_env( + "DYLD_LIBRARY_PATH", + f"{library_dir}:{current}" if current else str(library_dir), + ) + + for runtime_dir in sycl_runtime_dirs: + current = os.environ.get("LD_LIBRARY_PATH", "") + write_env( + "LD_LIBRARY_PATH", + f"{runtime_dir}:{current}" if current else str(runtime_dir), + ) def main() -> None: From 9ebb92553f7f9e733223edfb3cb389362664d129 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 16:21:58 +0100 Subject: [PATCH 072/104] Use native CPU backend for Linux SYCL CI --- scripts/ci/sycl_x86_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 1cbf39771..0d71d8d41 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -25,7 +25,7 @@ def configure_platform(platform: str) -> None: settings = { "linux-x86_64": { "toolchain_asset": "sycl_linux.tar.gz", - "device_selector": "opencl:cpu", + "device_selector": "native_cpu:cpu", "opencv_apps": "ON", }, "windows-x86_64": { From 7be71bf66bd58abc7a35eb454f1a47b5d445683c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 16:34:27 +0100 Subject: [PATCH 073/104] Let Linux SYCL CI use default device selection --- scripts/ci/sycl_x86_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 0d71d8d41..2280de641 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -25,7 +25,7 @@ def configure_platform(platform: str) -> None: settings = { "linux-x86_64": { "toolchain_asset": "sycl_linux.tar.gz", - "device_selector": "native_cpu:cpu", + "device_selector": "", "opencv_apps": "ON", }, "windows-x86_64": { From fb25aeeb4e2d433eb0cf6703ba9d1e617d2e0c7f Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 16:39:54 +0100 Subject: [PATCH 074/104] Skip empty SYCL device selector in CI --- .github/workflows/sycl-ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index f82283182..8200c6e9d 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -67,7 +67,12 @@ jobs: run: cmake --build build --parallel - name: Test - run: ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" ctest --test-dir build --output-on-failure --parallel + run: | + if [ -n "${DEVICE_SELECTOR}" ]; then + ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" ctest --test-dir build --output-on-failure --parallel + else + ctest --test-dir build --output-on-failure --parallel + fi build-sycl-adaptivecpp-arm64: name: ${{ matrix.platform }} / ${{ matrix.build_type }} From a9368353bfa7e0c0c215b7e582deba6ad1fed2d9 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 17:38:18 +0100 Subject: [PATCH 075/104] Align Linux Intel SYCL target and device --- scripts/ci/sycl_x86_setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 2280de641..5b606f385 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -25,13 +25,15 @@ def configure_platform(platform: str) -> None: settings = { "linux-x86_64": { "toolchain_asset": "sycl_linux.tar.gz", - "device_selector": "", + "device_selector": "native_cpu:cpu", "opencv_apps": "ON", + "sycl_targets": "native_cpu", }, "windows-x86_64": { "toolchain_asset": "sycl_windows.tar.gz", "device_selector": "opencl:cpu", "opencv_apps": "ON", + "sycl_targets": "spir64", }, }.get(platform) @@ -42,7 +44,7 @@ def configure_platform(platform: str) -> None: write_env("DEVICE_SELECTOR", settings["device_selector"]) write_env("ITLABAI_ENABLE_OPENCV_APPS", settings["opencv_apps"]) write_env("ITLABAI_SYCL_IMPLEMENTATION", "IntelLLVM") - write_env("ITLABAI_SYCL_TARGETS", "spir64") + write_env("ITLABAI_SYCL_TARGETS", settings["sycl_targets"]) def setup_linux_runtime() -> None: From 5ad553c8ab0ecc5986560db98d775c6d430ae0c4 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 17:43:40 +0100 Subject: [PATCH 076/104] Disable libspirv for native CPU SYCL --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 242e6b1c2..c4f01fe71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,15 @@ if(ITLABAI_ENABLE_SYCL) target_link_options(${ITLABAI_SYCL_TARGET} PRIVATE -fsycl-targets=${ITLABAI_SYCL_TARGETS} ) + + if(ITLABAI_SYCL_TARGETS MATCHES "(^|,)native_cpu(,|$)") + target_compile_options(${ITLABAI_SYCL_TARGET} PRIVATE + $<$:-fno-sycl-libspirv> + ) + target_link_options(${ITLABAI_SYCL_TARGET} PRIVATE + -fno-sycl-libspirv + ) + endif() endif() endfunction() else() From 67b9aa21ab89b0e650dcf53ec61a891b53135461 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 17:49:15 +0100 Subject: [PATCH 077/104] Use PoCL for Linux Intel SYCL CI --- CMakeLists.txt | 9 --------- scripts/ci/sycl_x86_setup.py | 10 +++++----- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4f01fe71..242e6b1c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,15 +94,6 @@ if(ITLABAI_ENABLE_SYCL) target_link_options(${ITLABAI_SYCL_TARGET} PRIVATE -fsycl-targets=${ITLABAI_SYCL_TARGETS} ) - - if(ITLABAI_SYCL_TARGETS MATCHES "(^|,)native_cpu(,|$)") - target_compile_options(${ITLABAI_SYCL_TARGET} PRIVATE - $<$:-fno-sycl-libspirv> - ) - target_link_options(${ITLABAI_SYCL_TARGET} PRIVATE - -fno-sycl-libspirv - ) - endif() endif() endfunction() else() diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 5b606f385..c7fb283c3 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -25,9 +25,9 @@ def configure_platform(platform: str) -> None: settings = { "linux-x86_64": { "toolchain_asset": "sycl_linux.tar.gz", - "device_selector": "native_cpu:cpu", + "device_selector": "opencl:cpu", "opencv_apps": "ON", - "sycl_targets": "native_cpu", + "sycl_targets": "spir64", }, "windows-x86_64": { "toolchain_asset": "sycl_windows.tar.gz", @@ -62,6 +62,7 @@ def setup_linux_runtime() -> None: "git", "ocl-icd-opencl-dev", "opencl-headers", + "pocl-opencl-icd", "python3", "zstd", ] @@ -103,7 +104,6 @@ def setup_linux_runtime() -> None: "install", "-y", "intel-oneapi-compiler-dpcpp-cpp", - "intel-oneapi-runtime-opencl", ] ) @@ -115,14 +115,14 @@ def setup_linux_runtime() -> None: icd_file = None for candidate in Path("/etc/OpenCL/vendors").glob("*.icd"): try: - if "intel" in candidate.read_text(encoding="utf-8").lower(): + if "pocl" in candidate.read_text(encoding="utf-8").lower(): icd_file = candidate break except OSError: continue if icd_file is None: - main_error("Unable to locate Intel OpenCL ICD file under /etc/OpenCL/vendors") + main_error("Unable to locate PoCL OpenCL ICD file under /etc/OpenCL/vendors") run(["cp", str(icd_file), str(icd_dir / icd_file.name)]) write_env("OCL_ICD_VENDORS", str(icd_dir)) From c3cdc22c7924954a419a6c4983a9ee1202add25c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 17:55:39 +0100 Subject: [PATCH 078/104] Restore Intel OpenCL runtime for Linux SYCL --- scripts/ci/sycl_x86_setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index c7fb283c3..83288b065 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -104,6 +104,7 @@ def setup_linux_runtime() -> None: "install", "-y", "intel-oneapi-compiler-dpcpp-cpp", + "intel-oneapi-runtime-opencl", ] ) From cd8e24e0d0b12b51ba585e6b01e6db7aed19f646 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 18:25:15 +0100 Subject: [PATCH 079/104] Broaden Linux OpenCL SYCL selector --- scripts/ci/sycl_x86_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 83288b065..e0eb21a55 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -25,7 +25,7 @@ def configure_platform(platform: str) -> None: settings = { "linux-x86_64": { "toolchain_asset": "sycl_linux.tar.gz", - "device_selector": "opencl:cpu", + "device_selector": "opencl:*", "opencv_apps": "ON", "sycl_targets": "spir64", }, From 2e21875b6027836577b9190f8e336d8bd11482fc Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 18:34:28 +0100 Subject: [PATCH 080/104] Use Intel OpenCL ICD for Linux SYCL --- scripts/ci/sycl_x86_setup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index e0eb21a55..6b7cf6f4c 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -25,7 +25,7 @@ def configure_platform(platform: str) -> None: settings = { "linux-x86_64": { "toolchain_asset": "sycl_linux.tar.gz", - "device_selector": "opencl:*", + "device_selector": "opencl:cpu", "opencv_apps": "ON", "sycl_targets": "spir64", }, @@ -62,7 +62,6 @@ def setup_linux_runtime() -> None: "git", "ocl-icd-opencl-dev", "opencl-headers", - "pocl-opencl-icd", "python3", "zstd", ] @@ -116,14 +115,14 @@ def setup_linux_runtime() -> None: icd_file = None for candidate in Path("/etc/OpenCL/vendors").glob("*.icd"): try: - if "pocl" in candidate.read_text(encoding="utf-8").lower(): + if "intel" in candidate.read_text(encoding="utf-8").lower(): icd_file = candidate break except OSError: continue if icd_file is None: - main_error("Unable to locate PoCL OpenCL ICD file under /etc/OpenCL/vendors") + main_error("Unable to locate Intel OpenCL ICD file under /etc/OpenCL/vendors") run(["cp", str(icd_file), str(icd_dir / icd_file.name)]) write_env("OCL_ICD_VENDORS", str(icd_dir)) From 17e57cf1d0cfc06a6a048f4b0e6f4e812f5fba43 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 18:43:15 +0100 Subject: [PATCH 081/104] Skip unsupported Linux SYCL example device --- .github/workflows/sycl-ci.yml | 17 +++++---- scripts/ci/sycl_test.py | 72 +++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 scripts/ci/sycl_test.py diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 8200c6e9d..d8d2866d8 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -59,6 +59,8 @@ jobs: - name: Prepare platform settings run: python3 ./scripts/ci/sycl_x86_setup.py "${{ matrix.platform }}" + env: + ITLABAI_CI_PLATFORM: ${{ matrix.platform }} - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" @@ -67,12 +69,9 @@ jobs: run: cmake --build build --parallel - name: Test - run: | - if [ -n "${DEVICE_SELECTOR}" ]; then - ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" ctest --test-dir build --output-on-failure --parallel - else - ctest --test-dir build --output-on-failure --parallel - fi + run: python3 ./scripts/ci/sycl_test.py + env: + ITLABAI_CI_PLATFORM: ${{ matrix.platform }} build-sycl-adaptivecpp-arm64: name: ${{ matrix.platform }} / ${{ matrix.build_type }} @@ -108,6 +107,8 @@ jobs: - name: Install AdaptiveCpp prerequisites run: python3 ./scripts/ci/sycl_adaptivecpp_setup.py + env: + ITLABAI_CI_PLATFORM: ${{ matrix.platform }} - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" @@ -116,4 +117,6 @@ jobs: run: cmake --build build --parallel - name: Test - run: ctest --test-dir build --output-on-failure --parallel + run: python3 ./scripts/ci/sycl_test.py + env: + ITLABAI_CI_PLATFORM: ${{ matrix.platform }} diff --git a/scripts/ci/sycl_test.py b/scripts/ci/sycl_test.py new file mode 100644 index 000000000..ae443e4a5 --- /dev/null +++ b/scripts/ci/sycl_test.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +import os +import subprocess +import sys +from pathlib import Path + +from common import main_error, repo_root, require_env, run + + +def run_capture(command: list[str], *, env: dict[str, str] | None = None) -> subprocess.CompletedProcess[str]: + print("+", " ".join(command), flush=True) + return subprocess.run( + command, + check=False, + text=True, + capture_output=True, + env=env, + ) + + +def main() -> None: + platform = require_env("ITLABAI_CI_PLATFORM") + + base_env = os.environ.copy() + device_selector = os.environ.get("DEVICE_SELECTOR", "") + if device_selector: + base_env["ONEAPI_DEVICE_SELECTOR"] = device_selector + os.environ["ONEAPI_DEVICE_SELECTOR"] = device_selector + + if platform != "linux-x86_64": + run(["ctest", "--test-dir", "build", "--output-on-failure", "--parallel"]) + return + + run( + [ + "ctest", + "--test-dir", + "build", + "--output-on-failure", + "--parallel", + "-E", + "^SYCL\\.Example$", + ] + ) + + example_path = repo_root() / "build" / "bin" / "SYCL_Example" + result = run_capture([str(example_path)], env=base_env) + + if result.returncode == 0: + if result.stdout: + print(result.stdout, end="") + if result.stderr: + print(result.stderr, end="", file=sys.stderr) + return + + combined_output = f"{result.stdout}{result.stderr}" + if "No device of requested type available" in combined_output: + print("Skipping SYCL.Example on linux-x86_64: no supported SYCL device on this runner.") + return + + if result.stdout: + print(result.stdout, end="") + if result.stderr: + print(result.stderr, end="", file=sys.stderr) + raise SystemExit(result.returncode) + + +if __name__ == "__main__": + main() From 55a85b00a6bc40587caca56ebc11cde5dc55b7eb Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 18:54:40 +0100 Subject: [PATCH 082/104] Restore mandatory SYCL test execution --- .github/workflows/sycl-ci.yml | 17 ++++----- scripts/ci/sycl_test.py | 72 ----------------------------------- 2 files changed, 7 insertions(+), 82 deletions(-) delete mode 100644 scripts/ci/sycl_test.py diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index d8d2866d8..8200c6e9d 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -59,8 +59,6 @@ jobs: - name: Prepare platform settings run: python3 ./scripts/ci/sycl_x86_setup.py "${{ matrix.platform }}" - env: - ITLABAI_CI_PLATFORM: ${{ matrix.platform }} - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" @@ -69,9 +67,12 @@ jobs: run: cmake --build build --parallel - name: Test - run: python3 ./scripts/ci/sycl_test.py - env: - ITLABAI_CI_PLATFORM: ${{ matrix.platform }} + run: | + if [ -n "${DEVICE_SELECTOR}" ]; then + ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" ctest --test-dir build --output-on-failure --parallel + else + ctest --test-dir build --output-on-failure --parallel + fi build-sycl-adaptivecpp-arm64: name: ${{ matrix.platform }} / ${{ matrix.build_type }} @@ -107,8 +108,6 @@ jobs: - name: Install AdaptiveCpp prerequisites run: python3 ./scripts/ci/sycl_adaptivecpp_setup.py - env: - ITLABAI_CI_PLATFORM: ${{ matrix.platform }} - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" @@ -117,6 +116,4 @@ jobs: run: cmake --build build --parallel - name: Test - run: python3 ./scripts/ci/sycl_test.py - env: - ITLABAI_CI_PLATFORM: ${{ matrix.platform }} + run: ctest --test-dir build --output-on-failure --parallel diff --git a/scripts/ci/sycl_test.py b/scripts/ci/sycl_test.py deleted file mode 100644 index ae443e4a5..000000000 --- a/scripts/ci/sycl_test.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python3 - -from __future__ import annotations - -import os -import subprocess -import sys -from pathlib import Path - -from common import main_error, repo_root, require_env, run - - -def run_capture(command: list[str], *, env: dict[str, str] | None = None) -> subprocess.CompletedProcess[str]: - print("+", " ".join(command), flush=True) - return subprocess.run( - command, - check=False, - text=True, - capture_output=True, - env=env, - ) - - -def main() -> None: - platform = require_env("ITLABAI_CI_PLATFORM") - - base_env = os.environ.copy() - device_selector = os.environ.get("DEVICE_SELECTOR", "") - if device_selector: - base_env["ONEAPI_DEVICE_SELECTOR"] = device_selector - os.environ["ONEAPI_DEVICE_SELECTOR"] = device_selector - - if platform != "linux-x86_64": - run(["ctest", "--test-dir", "build", "--output-on-failure", "--parallel"]) - return - - run( - [ - "ctest", - "--test-dir", - "build", - "--output-on-failure", - "--parallel", - "-E", - "^SYCL\\.Example$", - ] - ) - - example_path = repo_root() / "build" / "bin" / "SYCL_Example" - result = run_capture([str(example_path)], env=base_env) - - if result.returncode == 0: - if result.stdout: - print(result.stdout, end="") - if result.stderr: - print(result.stderr, end="", file=sys.stderr) - return - - combined_output = f"{result.stdout}{result.stderr}" - if "No device of requested type available" in combined_output: - print("Skipping SYCL.Example on linux-x86_64: no supported SYCL device on this runner.") - return - - if result.stdout: - print(result.stdout, end="") - if result.stderr: - print(result.stderr, end="", file=sys.stderr) - raise SystemExit(result.returncode) - - -if __name__ == "__main__": - main() From e7741bcc2d12c2f9eff9ff7e705b1aa639d34eec Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 19:13:50 +0100 Subject: [PATCH 083/104] Use Intel native CPU container for Linux SYCL --- .github/workflows/sycl-ci.yml | 59 +++++++++++++++---- scripts/ci/sycl_x86_setup.py | 103 +++++++++++----------------------- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 8200c6e9d..b982eea5d 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -14,16 +14,16 @@ env: ADAPTIVECPP_TAG: v25.10.0 jobs: - build-sycl-x86: - name: ${{ matrix.platform }} / ${{ matrix.build_type }} - runs-on: ${{ matrix.platform == 'linux-x86_64' && 'ubuntu-latest' || 'windows-2025' }} + build-sycl-linux-x86: + name: linux-x86_64 / ${{ matrix.build_type }} + runs-on: ubuntu-latest + container: + image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest + options: -u 0:0 timeout-minutes: 360 strategy: fail-fast: true matrix: - platform: - - linux-x86_64 - - windows-x86_64 build_type: - Debug - Release @@ -41,24 +41,61 @@ jobs: uses: seanmiddleditch/gha-setup-ninja@v6 - name: Setup ccache - if: runner.os != 'Windows' uses: hendrikmuhs/ccache-action@v1.2 with: - key: ccache-${{ github.job }}-${{ matrix.platform }}-${{ matrix.build_type }} + key: ccache-${{ github.job }}-${{ matrix.build_type }} max-size: 2G + - name: Prepare platform settings + run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64 + + - name: Configure + run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" + + - name: Build + run: cmake --build build --parallel + + - name: Test + run: | + if [ -n "${DEVICE_SELECTOR}" ]; then + ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" ctest --test-dir build --output-on-failure --parallel + else + ctest --test-dir build --output-on-failure --parallel + fi + + build-sycl-windows-x86: + name: windows-x86_64 / ${{ matrix.build_type }} + runs-on: windows-2025 + timeout-minutes: 360 + strategy: + fail-fast: true + matrix: + build_type: + - Debug + - Release + + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@v6 + - name: Setup ccache - if: runner.os == 'Windows' uses: Chocobo1/setup-ccache-action@v1 with: windows_compile_environment: msvc - name: Setup MSVC environment - if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 - name: Prepare platform settings - run: python3 ./scripts/ci/sycl_x86_setup.py "${{ matrix.platform }}" + run: python3 ./scripts/ci/sycl_x86_setup.py windows-x86_64 - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 6b7cf6f4c..02313a928 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -24,10 +24,10 @@ def configure_platform(platform: str) -> None: settings = { "linux-x86_64": { - "toolchain_asset": "sycl_linux.tar.gz", - "device_selector": "opencl:cpu", + "toolchain_asset": "", + "device_selector": "native_cpu:cpu", "opencv_apps": "ON", - "sycl_targets": "spir64", + "sycl_targets": "native_cpu", }, "windows-x86_64": { "toolchain_asset": "sycl_windows.tar.gz", @@ -48,87 +48,46 @@ def configure_platform(platform: str) -> None: def setup_linux_runtime() -> None: - run(["sudo", "apt-get", "update"]) + command_prefix = [] if os.geteuid() == 0 else ["sudo"] + run([*command_prefix, "apt-get", "update"]) run( [ - "sudo", + *command_prefix, "apt-get", "install", "-y", "build-essential", + "ccache", "cmake", "g++-13", "gcc-13", "git", - "ocl-icd-opencl-dev", - "opencl-headers", "python3", "zstd", ] ) - - key_url = "https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" - key_path = Path(require_env("RUNNER_TEMP")) / "oneapi-intel-key.pub" - armored_key_path = Path(require_env("RUNNER_TEMP")) / "oneapi-archive-keyring.gpg" - download(key_url, key_path) - run( - [ - "gpg", - "--dearmor", - "--output", - str(armored_key_path), - str(key_path), - ] - ) - run( - [ - "sudo", - "cp", - str(armored_key_path), - "/usr/share/keyrings/oneapi-archive-keyring.gpg", - ] - ) - run( - ["sudo", "tee", "/etc/apt/sources.list.d/oneAPI.list"], - input_text=( - "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] " - "https://apt.repos.intel.com/oneapi all main\n" + clang_path = Path(capture(["bash", "-lc", "readlink -f \"$(command -v clang++)\""])) + candidate_roots = [ + clang_path.parent.parent, + clang_path.parent.parent.parent, + ] + sycl_root = next( + ( + root + for root in candidate_roots + if (root / "bin").is_dir() or (root / "bin" / "compiler").is_dir() ), + None, ) - run(["sudo", "apt-get", "update"]) - run( - [ - "sudo", - "apt-get", - "install", - "-y", - "intel-oneapi-compiler-dpcpp-cpp", - "intel-oneapi-runtime-opencl", - ] - ) - - write_env("ITLABAI_GCC_INSTALL_DIR", "/usr/lib/gcc/x86_64-linux-gnu/13") - - icd_dir = Path(require_env("RUNNER_TEMP")) / "intel-opencl-icd" - icd_dir.mkdir(parents=True, exist_ok=True) - - icd_file = None - for candidate in Path("/etc/OpenCL/vendors").glob("*.icd"): - try: - if "intel" in candidate.read_text(encoding="utf-8").lower(): - icd_file = candidate - break - except OSError: - continue - - if icd_file is None: - main_error("Unable to locate Intel OpenCL ICD file under /etc/OpenCL/vendors") - - run(["cp", str(icd_file), str(icd_dir / icd_file.name)]) - write_env("OCL_ICD_VENDORS", str(icd_dir)) + if sycl_root is None: + main_error(f"Unable to infer SYCL_ROOT from compiler path: {clang_path}") + write_env("SYCL_ROOT", str(sycl_root)) def prepare_sycl_toolchain() -> Path: + if require_env("RUNNER_OS") == "Linux" and not os.environ.get("TOOLCHAIN_ASSET"): + return Path(require_env("SYCL_ROOT")) + runner_os = require_env("RUNNER_OS") runner_temp = require_env("RUNNER_TEMP") runner_temp_dir = Path(cygpath("u", runner_temp) if runner_os == "Windows" else runner_temp) @@ -204,19 +163,23 @@ def setup_unix_compilers(sycl_root: Path) -> None: sycl_runtime_dirs: list[Path] = [] if require_env("RUNNER_OS") == "Linux": - compiler_root = Path("/opt/intel/oneapi/compiler/latest") + compiler_root = Path(require_env("SYCL_ROOT")) cc_candidates = [ + compiler_root / "bin" / "icx", + compiler_root / "bin" / "clang", compiler_root / "bin" / "compiler" / "icx", compiler_root / "bin" / "compiler" / "clang", *cc_candidates, ] cxx_candidates = [ + compiler_root / "bin" / "icpx", + compiler_root / "bin" / "clang++", compiler_root / "bin" / "compiler" / "icpx", compiler_root / "bin" / "compiler" / "clang++", *cxx_candidates, ] - prefix_paths = [compiler_root, sycl_root] - library_roots = [compiler_root, sycl_root] + prefix_paths = [compiler_root] + library_roots = [compiler_root] cc_path = find_first_existing(cc_candidates) cxx_path = find_first_existing(cxx_candidates) @@ -253,9 +216,9 @@ def setup_unix_compilers(sycl_root: Path) -> None: write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent)) - libsycl = find_file(library_roots, "libsycl.so.8") + libsycl = find_file(library_roots + [sycl_root], "libsycl.so.8") if libsycl is None: - libsycl = find_file(library_roots, "libsycl.so") + libsycl = find_file(library_roots + [sycl_root], "libsycl.so") if libsycl is not None: sycl_runtime_dirs.append(libsycl.parent) From c9f83fe36d101b6553afcadddcf8c2d084e3dcdb Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 19:18:46 +0100 Subject: [PATCH 084/104] Use oneAPI compiler for Linux native CPU CI --- .github/workflows/sycl-ci.yml | 3 -- scripts/ci/sycl_x86_setup.py | 53 ++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index b982eea5d..05e0c49a4 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -17,9 +17,6 @@ jobs: build-sycl-linux-x86: name: linux-x86_64 / ${{ matrix.build_type }} runs-on: ubuntu-latest - container: - image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest - options: -u 0:0 timeout-minutes: 360 strategy: fail-fast: true diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 02313a928..47eba9045 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -66,22 +66,47 @@ def setup_linux_runtime() -> None: "zstd", ] ) - clang_path = Path(capture(["bash", "-lc", "readlink -f \"$(command -v clang++)\""])) - candidate_roots = [ - clang_path.parent.parent, - clang_path.parent.parent.parent, - ] - sycl_root = next( - ( - root - for root in candidate_roots - if (root / "bin").is_dir() or (root / "bin" / "compiler").is_dir() + key_url = "https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" + key_path = Path(require_env("RUNNER_TEMP")) / "oneapi-intel-key.pub" + armored_key_path = Path(require_env("RUNNER_TEMP")) / "oneapi-archive-keyring.gpg" + download(key_url, key_path) + run( + [ + "gpg", + "--dearmor", + "--output", + str(armored_key_path), + str(key_path), + ] + ) + run( + [ + *command_prefix, + "cp", + str(armored_key_path), + "/usr/share/keyrings/oneapi-archive-keyring.gpg", + ] + ) + run( + [*command_prefix, "tee", "/etc/apt/sources.list.d/oneAPI.list"], + input_text=( + "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] " + "https://apt.repos.intel.com/oneapi all main\n" ), - None, ) - if sycl_root is None: - main_error(f"Unable to infer SYCL_ROOT from compiler path: {clang_path}") - write_env("SYCL_ROOT", str(sycl_root)) + run([*command_prefix, "apt-get", "update"]) + run( + [ + *command_prefix, + "apt-get", + "install", + "-y", + "intel-oneapi-compiler-dpcpp-cpp", + ] + ) + + write_env("ITLABAI_GCC_INSTALL_DIR", "/usr/lib/gcc/x86_64-linux-gnu/13") + write_env("SYCL_ROOT", "/opt/intel/oneapi/compiler/latest") def prepare_sycl_toolchain() -> Path: From abff6a6285f91ba168be6a318d471bb1115fedb9 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 20:04:16 +0100 Subject: [PATCH 085/104] Build cached Intel native CPU toolchain in CI --- .github/workflows/sycl-ci.yml | 37 ++++++++++ scripts/ci/sycl_x86_setup.py | 132 +++++++++++++++++++++++----------- 2 files changed, 128 insertions(+), 41 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 05e0c49a4..6291999db 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -14,9 +14,40 @@ env: ADAPTIVECPP_TAG: v25.10.0 jobs: + prepare-sycl-linux-x86-toolchain: + name: prepare-linux-x86_64-toolchain + runs-on: ubuntu-latest + timeout-minutes: 360 + + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v4 + + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@v6 + + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ccache-${{ github.job }}-${{ env.INTEL_LLVM_TAG }} + max-size: 8G + + - name: Restore Intel toolchain cache + uses: actions/cache@v4 + with: + path: ${{ runner.temp }}/intel-nativecpu-toolchain/install + key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v1 + + - name: Prepare Intel native_cpu toolchain + run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64 + build-sycl-linux-x86: name: linux-x86_64 / ${{ matrix.build_type }} runs-on: ubuntu-latest + needs: prepare-sycl-linux-x86-toolchain timeout-minutes: 360 strategy: fail-fast: true @@ -43,6 +74,12 @@ jobs: key: ccache-${{ github.job }}-${{ matrix.build_type }} max-size: 2G + - name: Restore Intel toolchain cache + uses: actions/cache@v4 + with: + path: ${{ runner.temp }}/intel-nativecpu-toolchain/install + key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v1 + - name: Prepare platform settings run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64 diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 47eba9045..d7bb5a3b2 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -21,6 +21,26 @@ ) +def linux_native_cpu_toolchain_root() -> Path: + return Path(require_env("RUNNER_TEMP")) / "intel-nativecpu-toolchain" / "install" + + +def linux_native_cpu_toolchain_ready(toolchain_root: Path) -> bool: + if not toolchain_root.exists(): + return False + compiler_candidates = [ + toolchain_root / "bin" / "clang++", + toolchain_root / "bin" / "compiler" / "clang++", + ] + has_compiler = any(path.exists() for path in compiler_candidates) + has_runtime = find_file([toolchain_root], "libsycl.so") is not None + has_native_cpu_libspirv = ( + find_file([toolchain_root], "remangled-l64-signed_char.libspirv-native_cpu.bc") + is not None + ) + return has_compiler and has_runtime and has_native_cpu_libspirv + + def configure_platform(platform: str) -> None: settings = { "linux-x86_64": { @@ -62,56 +82,86 @@ def setup_linux_runtime() -> None: "g++-13", "gcc-13", "git", + "libzstd-dev", + "ninja-build", "python3", "zstd", ] ) - key_url = "https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" - key_path = Path(require_env("RUNNER_TEMP")) / "oneapi-intel-key.pub" - armored_key_path = Path(require_env("RUNNER_TEMP")) / "oneapi-archive-keyring.gpg" - download(key_url, key_path) - run( - [ - "gpg", - "--dearmor", - "--output", - str(armored_key_path), - str(key_path), - ] - ) - run( - [ - *command_prefix, - "cp", - str(armored_key_path), - "/usr/share/keyrings/oneapi-archive-keyring.gpg", - ] - ) - run( - [*command_prefix, "tee", "/etc/apt/sources.list.d/oneAPI.list"], - input_text=( - "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] " - "https://apt.repos.intel.com/oneapi all main\n" - ), - ) - run([*command_prefix, "apt-get", "update"]) - run( - [ - *command_prefix, - "apt-get", - "install", - "-y", - "intel-oneapi-compiler-dpcpp-cpp", - ] - ) - write_env("ITLABAI_GCC_INSTALL_DIR", "/usr/lib/gcc/x86_64-linux-gnu/13") - write_env("SYCL_ROOT", "/opt/intel/oneapi/compiler/latest") + + +def build_linux_native_cpu_toolchain() -> Path: + toolchain_root = linux_native_cpu_toolchain_root() + if linux_native_cpu_toolchain_ready(toolchain_root): + write_env("SYCL_ROOT", str(toolchain_root)) + return toolchain_root + + toolchain_base = toolchain_root.parent + source_dir = toolchain_base / "src" + build_dir = toolchain_base / "build" + llvm_tag = require_env("INTEL_LLVM_TAG") + + toolchain_base.mkdir(parents=True, exist_ok=True) + if not (source_dir / ".git").exists(): + run( + [ + "git", + "clone", + "--depth", + "1", + "--branch", + llvm_tag, + "https://github.com/intel/llvm.git", + str(source_dir), + ] + ) + + configure_stamp = build_dir / "CMakeCache.txt" + if not configure_stamp.exists(): + build_dir.mkdir(parents=True, exist_ok=True) + run( + [ + "python3", + str(source_dir / "buildbot" / "configure.py"), + "-w", + str(toolchain_base), + "-s", + str(source_dir), + "-o", + str(build_dir), + "-t", + "Release", + "--native_cpu", + "--cmake-gen", + "Ninja", + "--use-zstd", + "-DCMAKE_C_COMPILER=gcc-13", + "-DCMAKE_CXX_COMPILER=g++-13", + "-DCMAKE_C_COMPILER_LAUNCHER=ccache", + "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache", + f"-DCMAKE_INSTALL_PREFIX={toolchain_root}", + "-DSYCL_ENABLE_BACKENDS=native_cpu", + "-DSYCL_INCLUDE_TESTS=OFF", + "-DLLVM_INSTALL_UTILS=ON", + ] + ) + + run(["cmake", "--build", str(build_dir), "--target", "sycl-toolchain", "--parallel"]) + + if not linux_native_cpu_toolchain_ready(toolchain_root): + main_error( + "Intel SYCL native_cpu toolchain build completed, but required files " + "were not installed" + ) + + write_env("SYCL_ROOT", str(toolchain_root)) + return toolchain_root def prepare_sycl_toolchain() -> Path: if require_env("RUNNER_OS") == "Linux" and not os.environ.get("TOOLCHAIN_ASSET"): - return Path(require_env("SYCL_ROOT")) + return build_linux_native_cpu_toolchain() runner_os = require_env("RUNNER_OS") runner_temp = require_env("RUNNER_TEMP") From e41e34ffdc11d2cc5aa7b67a20d0d52418e2a8cf Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 21:51:12 +0100 Subject: [PATCH 086/104] Fix Intel native CPU cache and Windows SYCL sources --- CMakeLists.txt | 26 +++++++++++++++++++++----- app/SYCL/CMakeLists.txt | 1 - scripts/ci/sycl_x86_setup.py | 8 ++++++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 242e6b1c2..2f2f80749 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,15 +82,31 @@ if(ITLABAI_ENABLE_SYCL) message(FATAL_ERROR "itlabai_add_sycl_to_target requires TARGET") endif() - target_compile_options(${ITLABAI_SYCL_TARGET} PRIVATE - $<$:-fsycl> - ) target_link_options(${ITLABAI_SYCL_TARGET} PRIVATE -fsycl) - if(ITLABAI_SYCL_TARGETS) + if(ITLABAI_SYCL_SOURCES) + foreach(ITLABAI_SYCL_SOURCE IN LISTS ITLABAI_SYCL_SOURCES) + set_property(SOURCE ${ITLABAI_SYCL_SOURCE} APPEND PROPERTY + COMPILE_OPTIONS -fsycl + ) + if(ITLABAI_SYCL_TARGETS) + set_property(SOURCE ${ITLABAI_SYCL_SOURCE} APPEND PROPERTY + COMPILE_OPTIONS -fsycl-targets=${ITLABAI_SYCL_TARGETS} + ) + endif() + endforeach() + else() target_compile_options(${ITLABAI_SYCL_TARGET} PRIVATE - $<$:-fsycl-targets=${ITLABAI_SYCL_TARGETS}> + $<$:-fsycl> ) + if(ITLABAI_SYCL_TARGETS) + target_compile_options(${ITLABAI_SYCL_TARGET} PRIVATE + $<$:-fsycl-targets=${ITLABAI_SYCL_TARGETS}> + ) + endif() + endif() + + if(ITLABAI_SYCL_TARGETS) target_link_options(${ITLABAI_SYCL_TARGET} PRIVATE -fsycl-targets=${ITLABAI_SYCL_TARGETS} ) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index a2a4a5791..557fcf351 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -4,7 +4,6 @@ add_executable(SYCL_Example ) target_link_libraries(SYCL_Example PRIVATE layers_lib) itlabai_add_sycl_to_target(TARGET SYCL_Example SOURCES - sycl_example.cpp sycl_kernel.cpp ) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index d7bb5a3b2..56d13116b 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -33,9 +33,12 @@ def linux_native_cpu_toolchain_ready(toolchain_root: Path) -> bool: toolchain_root / "bin" / "compiler" / "clang++", ] has_compiler = any(path.exists() for path in compiler_candidates) - has_runtime = find_file([toolchain_root], "libsycl.so") is not None + has_runtime = ( + find_file([toolchain_root], "libsycl.so") is not None + or find_file([toolchain_root], "libsycl.so.9") is not None + ) has_native_cpu_libspirv = ( - find_file([toolchain_root], "remangled-l64-signed_char.libspirv-native_cpu.bc") + find_file([toolchain_root], "remangled-l64-signed_char.libspirv.bc") is not None ) return has_compiler and has_runtime and has_native_cpu_libspirv @@ -148,6 +151,7 @@ def build_linux_native_cpu_toolchain() -> Path: ) run(["cmake", "--build", str(build_dir), "--target", "sycl-toolchain", "--parallel"]) + run(["cmake", "--install", str(build_dir)]) if not linux_native_cpu_toolchain_ready(toolchain_root): main_error( From 466c3c1b5c2b5c2a5c67ab26e10b3dcd38167fcf Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 22:05:13 +0100 Subject: [PATCH 087/104] Use build tree for cached Intel SYCL toolchain --- .github/workflows/sycl-ci.yml | 8 ++++---- scripts/ci/sycl_x86_setup.py | 8 +++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 6291999db..c3b662f16 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -38,8 +38,8 @@ jobs: - name: Restore Intel toolchain cache uses: actions/cache@v4 with: - path: ${{ runner.temp }}/intel-nativecpu-toolchain/install - key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v1 + path: ${{ runner.temp }}/intel-nativecpu-toolchain/build + key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v2 - name: Prepare Intel native_cpu toolchain run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64 @@ -77,8 +77,8 @@ jobs: - name: Restore Intel toolchain cache uses: actions/cache@v4 with: - path: ${{ runner.temp }}/intel-nativecpu-toolchain/install - key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v1 + path: ${{ runner.temp }}/intel-nativecpu-toolchain/build + key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v2 - name: Prepare platform settings run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64 diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 56d13116b..f8ec1e02c 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -22,7 +22,7 @@ def linux_native_cpu_toolchain_root() -> Path: - return Path(require_env("RUNNER_TEMP")) / "intel-nativecpu-toolchain" / "install" + return Path(require_env("RUNNER_TEMP")) / "intel-nativecpu-toolchain" / "build" def linux_native_cpu_toolchain_ready(toolchain_root: Path) -> bool: @@ -102,7 +102,7 @@ def build_linux_native_cpu_toolchain() -> Path: toolchain_base = toolchain_root.parent source_dir = toolchain_base / "src" - build_dir = toolchain_base / "build" + build_dir = toolchain_root llvm_tag = require_env("INTEL_LLVM_TAG") toolchain_base.mkdir(parents=True, exist_ok=True) @@ -143,7 +143,6 @@ def build_linux_native_cpu_toolchain() -> Path: "-DCMAKE_CXX_COMPILER=g++-13", "-DCMAKE_C_COMPILER_LAUNCHER=ccache", "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache", - f"-DCMAKE_INSTALL_PREFIX={toolchain_root}", "-DSYCL_ENABLE_BACKENDS=native_cpu", "-DSYCL_INCLUDE_TESTS=OFF", "-DLLVM_INSTALL_UTILS=ON", @@ -151,12 +150,11 @@ def build_linux_native_cpu_toolchain() -> Path: ) run(["cmake", "--build", str(build_dir), "--target", "sycl-toolchain", "--parallel"]) - run(["cmake", "--install", str(build_dir)]) if not linux_native_cpu_toolchain_ready(toolchain_root): main_error( "Intel SYCL native_cpu toolchain build completed, but required files " - "were not installed" + "were not produced in the build tree" ) write_env("SYCL_ROOT", str(toolchain_root)) From 338d0dbabdbd8282b9ea7f9daddc72bb4d50030c Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 22:14:11 +0100 Subject: [PATCH 088/104] Detect OpenMP runtime from Intel SYCL toolchain --- scripts/ci/sycl_configure.py | 7 +++++-- scripts/ci/sycl_x86_setup.py | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py index 7002bcb18..772d05deb 100644 --- a/scripts/ci/sycl_configure.py +++ b/scripts/ci/sycl_configure.py @@ -27,12 +27,15 @@ def main() -> None: if openmp_flags: cmake_args.append(f"-DOpenMP_CXX_FLAGS={openmp_flags}") + openmp_library_name = os.environ.get("ITLABAI_OPENMP_LIBRARY_NAME", "") openmp_library = os.environ.get("ITLABAI_OPENMP_LIBRARY", "") if openmp_library: + if not openmp_library_name: + main_error("ITLABAI_OPENMP_LIBRARY is set without ITLABAI_OPENMP_LIBRARY_NAME") cmake_args.extend( [ - "-DOpenMP_CXX_LIB_NAMES=iomp5", - f"-DOpenMP_iomp5_LIBRARY={openmp_library}", + f"-DOpenMP_CXX_LIB_NAMES={openmp_library_name}", + f"-DOpenMP_{openmp_library_name}_LIBRARY={openmp_library}", ] ) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index f8ec1e02c..dc4d40cfb 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -272,8 +272,14 @@ def setup_unix_compilers(sycl_root: Path) -> None: if require_env("RUNNER_OS") == "Linux": openmp_library = find_file([sycl_root, Path("/opt/intel/oneapi")], "libiomp5.so") + openmp_library_name = "iomp5" + openmp_flags = "-fopenmp=libiomp5" if openmp_library is None: - main_error("Unable to locate libiomp5.so for the SYCL toolchain") + openmp_library = find_file([sycl_root, Path("/opt/intel/oneapi")], "libomp.so") + openmp_library_name = "omp" + openmp_flags = "-fopenmp" + if openmp_library is None: + main_error("Unable to locate an Intel toolchain OpenMP runtime library") resource_dir = Path(capture([str(cxx_path), "-print-resource-dir"])) openmp_header = find_file( @@ -289,7 +295,8 @@ def setup_unix_compilers(sycl_root: Path) -> None: "Unable to locate Intel-provided omp.h under the SYCL toolchain" ) - write_env("ITLABAI_OPENMP_FLAGS", "-fopenmp=libiomp5") + write_env("ITLABAI_OPENMP_FLAGS", openmp_flags) + write_env("ITLABAI_OPENMP_LIBRARY_NAME", openmp_library_name) write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent)) From 94eb6fb917535043b492872a437b6212e6afdffb Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 22:23:15 +0100 Subject: [PATCH 089/104] Align Linux SYCL toolchain build with intel llvm --- .github/workflows/sycl-ci.yml | 8 ++++---- scripts/ci/sycl_x86_setup.py | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index c3b662f16..6e9925ebc 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -38,8 +38,8 @@ jobs: - name: Restore Intel toolchain cache uses: actions/cache@v4 with: - path: ${{ runner.temp }}/intel-nativecpu-toolchain/build - key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v2 + path: ${{ runner.temp }}/intel-nativecpu-toolchain/toolchain + key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v3 - name: Prepare Intel native_cpu toolchain run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64 @@ -77,8 +77,8 @@ jobs: - name: Restore Intel toolchain cache uses: actions/cache@v4 with: - path: ${{ runner.temp }}/intel-nativecpu-toolchain/build - key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v2 + path: ${{ runner.temp }}/intel-nativecpu-toolchain/toolchain + key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v3 - name: Prepare platform settings run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64 diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index dc4d40cfb..dc0f91e2d 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -22,21 +22,17 @@ def linux_native_cpu_toolchain_root() -> Path: - return Path(require_env("RUNNER_TEMP")) / "intel-nativecpu-toolchain" / "build" + return Path(require_env("RUNNER_TEMP")) / "intel-nativecpu-toolchain" / "toolchain" def linux_native_cpu_toolchain_ready(toolchain_root: Path) -> bool: if not toolchain_root.exists(): return False - compiler_candidates = [ - toolchain_root / "bin" / "clang++", - toolchain_root / "bin" / "compiler" / "clang++", - ] + compiler_candidates = [toolchain_root / "bin" / "clang++"] has_compiler = any(path.exists() for path in compiler_candidates) - has_runtime = ( - find_file([toolchain_root], "libsycl.so") is not None - or find_file([toolchain_root], "libsycl.so.9") is not None - ) + has_runtime = find_file([toolchain_root], "libsycl.so") is not None or find_file( + [toolchain_root], "libsycl.so.9" + ) is not None has_native_cpu_libspirv = ( find_file([toolchain_root], "remangled-l64-signed_char.libspirv.bc") is not None @@ -102,7 +98,7 @@ def build_linux_native_cpu_toolchain() -> Path: toolchain_base = toolchain_root.parent source_dir = toolchain_base / "src" - build_dir = toolchain_root + build_dir = toolchain_base / "build" llvm_tag = require_env("INTEL_LLVM_TAG") toolchain_base.mkdir(parents=True, exist_ok=True) @@ -135,6 +131,7 @@ def build_linux_native_cpu_toolchain() -> Path: str(build_dir), "-t", "Release", + "--ci-defaults", "--native_cpu", "--cmake-gen", "Ninja", @@ -143,18 +140,21 @@ def build_linux_native_cpu_toolchain() -> Path: "-DCMAKE_CXX_COMPILER=g++-13", "-DCMAKE_C_COMPILER_LAUNCHER=ccache", "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache", + f"-DCMAKE_INSTALL_PREFIX={toolchain_root}", "-DSYCL_ENABLE_BACKENDS=native_cpu", "-DSYCL_INCLUDE_TESTS=OFF", "-DLLVM_INSTALL_UTILS=ON", + "-DSYCL_UR_FORCE_FETCH_LEVEL_ZERO=ON", ] ) run(["cmake", "--build", str(build_dir), "--target", "sycl-toolchain", "--parallel"]) + run(["cmake", "--build", str(build_dir), "--target", "deploy-sycl-toolchain", "--parallel"]) if not linux_native_cpu_toolchain_ready(toolchain_root): main_error( "Intel SYCL native_cpu toolchain build completed, but required files " - "were not produced in the build tree" + "were not deployed into the toolchain directory" ) write_env("SYCL_ROOT", str(toolchain_root)) From 107e543c9060eb0cc96b044af48f7aaa75e4aacd Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 19 Mar 2026 22:38:34 +0100 Subject: [PATCH 090/104] Build OpenMP runtime into Intel SYCL toolchain --- scripts/ci/sycl_x86_setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index dc0f91e2d..4cfa7c4f9 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -136,6 +136,7 @@ def build_linux_native_cpu_toolchain() -> Path: "--cmake-gen", "Ninja", "--use-zstd", + "--cmake-opt=-DLLVM_ENABLE_RUNTIMES=compiler-rt;openmp", "-DCMAKE_C_COMPILER=gcc-13", "-DCMAKE_CXX_COMPILER=g++-13", "-DCMAKE_C_COMPILER_LAUNCHER=ccache", @@ -149,6 +150,7 @@ def build_linux_native_cpu_toolchain() -> Path: ) run(["cmake", "--build", str(build_dir), "--target", "sycl-toolchain", "--parallel"]) + run(["cmake", "--build", str(build_dir), "--target", "install-openmp", "--parallel"]) run(["cmake", "--build", str(build_dir), "--target", "deploy-sycl-toolchain", "--parallel"]) if not linux_native_cpu_toolchain_ready(toolchain_root): From 4c8d7be48c79e7b97e0444d6ba4e32e43b8ed6d2 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Fri, 20 Mar 2026 14:40:59 +0100 Subject: [PATCH 091/104] Install OpenMP from LLVM runtimes build --- scripts/ci/sycl_x86_setup.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 4cfa7c4f9..3c3415aeb 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -37,7 +37,18 @@ def linux_native_cpu_toolchain_ready(toolchain_root: Path) -> bool: find_file([toolchain_root], "remangled-l64-signed_char.libspirv.bc") is not None ) - return has_compiler and has_runtime and has_native_cpu_libspirv + has_openmp_runtime = ( + find_file([toolchain_root], "libiomp5.so") is not None + or find_file([toolchain_root], "libomp.so") is not None + ) + has_openmp_header = find_file([toolchain_root], "omp.h") is not None + return ( + has_compiler + and has_runtime + and has_native_cpu_libspirv + and has_openmp_runtime + and has_openmp_header + ) def configure_platform(platform: str) -> None: @@ -150,7 +161,16 @@ def build_linux_native_cpu_toolchain() -> Path: ) run(["cmake", "--build", str(build_dir), "--target", "sycl-toolchain", "--parallel"]) - run(["cmake", "--build", str(build_dir), "--target", "install-openmp", "--parallel"]) + run( + [ + "cmake", + "--build", + str(build_dir / "runtimes" / "runtimes-bins"), + "--target", + "install", + "--parallel", + ] + ) run(["cmake", "--build", str(build_dir), "--target", "deploy-sycl-toolchain", "--parallel"]) if not linux_native_cpu_toolchain_ready(toolchain_root): From e3591f6b929cb8cab6acb0caa828897bb86100e7 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Fri, 20 Mar 2026 14:52:33 +0100 Subject: [PATCH 092/104] Install LLVM runtimes with cmake install --- scripts/ci/sycl_x86_setup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 3c3415aeb..52bd45595 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -164,11 +164,10 @@ def build_linux_native_cpu_toolchain() -> Path: run( [ "cmake", - "--build", + "--install", str(build_dir / "runtimes" / "runtimes-bins"), - "--target", - "install", - "--parallel", + "--prefix", + str(toolchain_root), ] ) run(["cmake", "--build", str(build_dir), "--target", "deploy-sycl-toolchain", "--parallel"]) From 71dcbb65402e071785c57256725aad65f7a40f80 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Fri, 20 Mar 2026 15:06:58 +0100 Subject: [PATCH 093/104] Use Intel SYCL build tree directly in CI --- .github/workflows/sycl-ci.yml | 8 ++++---- scripts/ci/sycl_x86_setup.py | 22 +++++++--------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 6e9925ebc..0b3241d11 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -38,8 +38,8 @@ jobs: - name: Restore Intel toolchain cache uses: actions/cache@v4 with: - path: ${{ runner.temp }}/intel-nativecpu-toolchain/toolchain - key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v3 + path: ${{ runner.temp }}/intel-nativecpu-toolchain/build + key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v4 - name: Prepare Intel native_cpu toolchain run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64 @@ -77,8 +77,8 @@ jobs: - name: Restore Intel toolchain cache uses: actions/cache@v4 with: - path: ${{ runner.temp }}/intel-nativecpu-toolchain/toolchain - key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v3 + path: ${{ runner.temp }}/intel-nativecpu-toolchain/build + key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v4 - name: Prepare platform settings run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64 diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 52bd45595..8b825e783 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -22,13 +22,16 @@ def linux_native_cpu_toolchain_root() -> Path: - return Path(require_env("RUNNER_TEMP")) / "intel-nativecpu-toolchain" / "toolchain" + return Path(require_env("RUNNER_TEMP")) / "intel-nativecpu-toolchain" / "build" def linux_native_cpu_toolchain_ready(toolchain_root: Path) -> bool: if not toolchain_root.exists(): return False - compiler_candidates = [toolchain_root / "bin" / "clang++"] + compiler_candidates = [ + toolchain_root / "bin" / "clang++", + toolchain_root / "bin" / "compiler" / "clang++", + ] has_compiler = any(path.exists() for path in compiler_candidates) has_runtime = find_file([toolchain_root], "libsycl.so") is not None or find_file( [toolchain_root], "libsycl.so.9" @@ -109,7 +112,7 @@ def build_linux_native_cpu_toolchain() -> Path: toolchain_base = toolchain_root.parent source_dir = toolchain_base / "src" - build_dir = toolchain_base / "build" + build_dir = toolchain_root llvm_tag = require_env("INTEL_LLVM_TAG") toolchain_base.mkdir(parents=True, exist_ok=True) @@ -152,7 +155,6 @@ def build_linux_native_cpu_toolchain() -> Path: "-DCMAKE_CXX_COMPILER=g++-13", "-DCMAKE_C_COMPILER_LAUNCHER=ccache", "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache", - f"-DCMAKE_INSTALL_PREFIX={toolchain_root}", "-DSYCL_ENABLE_BACKENDS=native_cpu", "-DSYCL_INCLUDE_TESTS=OFF", "-DLLVM_INSTALL_UTILS=ON", @@ -161,21 +163,11 @@ def build_linux_native_cpu_toolchain() -> Path: ) run(["cmake", "--build", str(build_dir), "--target", "sycl-toolchain", "--parallel"]) - run( - [ - "cmake", - "--install", - str(build_dir / "runtimes" / "runtimes-bins"), - "--prefix", - str(toolchain_root), - ] - ) - run(["cmake", "--build", str(build_dir), "--target", "deploy-sycl-toolchain", "--parallel"]) if not linux_native_cpu_toolchain_ready(toolchain_root): main_error( "Intel SYCL native_cpu toolchain build completed, but required files " - "were not deployed into the toolchain directory" + "were not produced in the build tree" ) write_env("SYCL_ROOT", str(toolchain_root)) From 3e207f0f6325a7862816d162f903bdc9bfebf06a Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Fri, 20 Mar 2026 15:36:52 +0100 Subject: [PATCH 094/104] Relax Intel build-tree OpenMP assumptions --- scripts/ci/sycl_x86_setup.py | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 8b825e783..da08c75ae 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -40,18 +40,7 @@ def linux_native_cpu_toolchain_ready(toolchain_root: Path) -> bool: find_file([toolchain_root], "remangled-l64-signed_char.libspirv.bc") is not None ) - has_openmp_runtime = ( - find_file([toolchain_root], "libiomp5.so") is not None - or find_file([toolchain_root], "libomp.so") is not None - ) - has_openmp_header = find_file([toolchain_root], "omp.h") is not None - return ( - has_compiler - and has_runtime - and has_native_cpu_libspirv - and has_openmp_runtime - and has_openmp_header - ) + return has_compiler and has_runtime and has_native_cpu_libspirv def configure_platform(platform: str) -> None: @@ -252,8 +241,10 @@ def setup_unix_compilers(sycl_root: Path) -> None: library_roots = [sycl_root] sycl_runtime_dirs: list[Path] = [] + source_built_linux_toolchain = False if require_env("RUNNER_OS") == "Linux": compiler_root = Path(require_env("SYCL_ROOT")) + source_built_linux_toolchain = not os.environ.get("TOOLCHAIN_ASSET") cc_candidates = [ compiler_root / "bin" / "icx", compiler_root / "bin" / "clang", @@ -291,7 +282,7 @@ def setup_unix_compilers(sycl_root: Path) -> None: openmp_library = find_file([sycl_root, Path("/opt/intel/oneapi")], "libomp.so") openmp_library_name = "omp" openmp_flags = "-fopenmp" - if openmp_library is None: + if openmp_library is None and not source_built_linux_toolchain: main_error("Unable to locate an Intel toolchain OpenMP runtime library") resource_dir = Path(capture([str(cxx_path), "-print-resource-dir"])) @@ -303,15 +294,16 @@ def setup_unix_compilers(sycl_root: Path) -> None: ], "omp.h", ) - if openmp_header is None: + if openmp_header is None and not source_built_linux_toolchain: main_error( "Unable to locate Intel-provided omp.h under the SYCL toolchain" ) - write_env("ITLABAI_OPENMP_FLAGS", openmp_flags) - write_env("ITLABAI_OPENMP_LIBRARY_NAME", openmp_library_name) - write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) - write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent)) + if openmp_library is not None and openmp_header is not None: + write_env("ITLABAI_OPENMP_FLAGS", openmp_flags) + write_env("ITLABAI_OPENMP_LIBRARY_NAME", openmp_library_name) + write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) + write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent)) libsycl = find_file(library_roots + [sycl_root], "libsycl.so.8") if libsycl is None: From 2bd0e06909bbd4957421aa9f42667c583cdf483b Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Fri, 20 Mar 2026 15:54:16 +0100 Subject: [PATCH 095/104] Use GCC OpenMP with source-built Intel SYCL --- scripts/ci/sycl_x86_setup.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index da08c75ae..daa0ee26c 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -282,6 +282,15 @@ def setup_unix_compilers(sycl_root: Path) -> None: openmp_library = find_file([sycl_root, Path("/opt/intel/oneapi")], "libomp.so") openmp_library_name = "omp" openmp_flags = "-fopenmp" + if openmp_library is None and source_built_linux_toolchain: + gcc_root = Path(require_env("ITLABAI_GCC_INSTALL_DIR")) + gcc_include_root = gcc_root / "include" + gcc_openmp_header = find_file([gcc_include_root], "omp.h") + gcc_openmp_library = Path(capture(["gcc-13", "-print-file-name=libgomp.so"])) + if gcc_openmp_header is not None and gcc_openmp_library.exists(): + openmp_library = gcc_openmp_library + openmp_library_name = "gomp" + openmp_flags = "-fopenmp" if openmp_library is None and not source_built_linux_toolchain: main_error("Unable to locate an Intel toolchain OpenMP runtime library") @@ -294,6 +303,9 @@ def setup_unix_compilers(sycl_root: Path) -> None: ], "omp.h", ) + if openmp_header is None and source_built_linux_toolchain: + gcc_root = Path(require_env("ITLABAI_GCC_INSTALL_DIR")) + openmp_header = find_file([gcc_root / "include"], "omp.h") if openmp_header is None and not source_built_linux_toolchain: main_error( "Unable to locate Intel-provided omp.h under the SYCL toolchain" From f188dde17ee791a5bf45b11f9be475b78c10cb26 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Fri, 20 Mar 2026 17:47:04 +0100 Subject: [PATCH 096/104] Fix Intel SYCL CI toolchain wiring --- CMakeLists.txt | 12 ++++++++++++ scripts/ci/sycl_configure.py | 4 ++++ scripts/ci/sycl_x86_setup.py | 6 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f2f80749..9cd2fa3e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,8 @@ set_property(CACHE ITLABAI_SYCL_IMPLEMENTATION PROPERTY STRINGS IntelLLVM AdaptiveCpp) set(ITLABAI_SYCL_TARGETS "" CACHE STRING "Optional SYCL targets; forwarded to AdaptiveCpp as ACPP_TARGETS or IntelLLVM as -fsycl-targets") +set(ITLABAI_SYCL_ROOT "" CACHE PATH + "Optional root directory of the SYCL toolchain; used to expose SYCL headers to host-only sources") option(ENABLE_STATISTIC_TENSORS "Enable statistic tensors" OFF) @@ -67,6 +69,10 @@ if(ITLABAI_ENABLE_SYCL) add_sycl_to_target(${ARGN}) endfunction() elseif(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") + set(ITLABAI_INTEL_SYCL_INCLUDE_DIRS "") + if(ITLABAI_SYCL_ROOT AND EXISTS "${ITLABAI_SYCL_ROOT}/include") + list(APPEND ITLABAI_INTEL_SYCL_INCLUDE_DIRS "${ITLABAI_SYCL_ROOT}/include") + endif() function(itlabai_add_sycl_to_target) set(options) set(one_value_keywords TARGET) @@ -82,6 +88,12 @@ if(ITLABAI_ENABLE_SYCL) message(FATAL_ERROR "itlabai_add_sycl_to_target requires TARGET") endif() + if(ITLABAI_INTEL_SYCL_INCLUDE_DIRS) + target_include_directories(${ITLABAI_SYCL_TARGET} PRIVATE + ${ITLABAI_INTEL_SYCL_INCLUDE_DIRS} + ) + endif() + target_link_options(${ITLABAI_SYCL_TARGET} PRIVATE -fsycl) if(ITLABAI_SYCL_SOURCES) diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py index 772d05deb..4f2d34c3f 100644 --- a/scripts/ci/sycl_configure.py +++ b/scripts/ci/sycl_configure.py @@ -55,6 +55,10 @@ def main() -> None: if itlabai_sycl_targets: cmake_args.append(f"-DITLABAI_SYCL_TARGETS={itlabai_sycl_targets}") + itlabai_sycl_root = os.environ.get("SYCL_ROOT", "") + if itlabai_sycl_root: + cmake_args.append(f"-DITLABAI_SYCL_ROOT={itlabai_sycl_root}") + c_flags = os.environ.get("ITLABAI_C_FLAGS", "") cxx_flags = os.environ.get("ITLABAI_CXX_FLAGS", "") gcc_install_dir = os.environ.get("ITLABAI_GCC_INSTALL_DIR", "") diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index daa0ee26c..aa606f88c 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -214,17 +214,17 @@ def setup_windows_compilers(sycl_root: Path) -> None: cc_path = find_first_existing( [ sycl_root / "bin" / "icx.exe", + sycl_root / "bin" / "clang.exe", sycl_root / "bin" / "icx-cl.exe", sycl_root / "bin" / "clang-cl.exe", - sycl_root / "bin" / "clang.exe", ] ) cxx_path = find_first_existing( [ sycl_root / "bin" / "icpx.exe", + sycl_root / "bin" / "clang++.exe", sycl_root / "bin" / "icx-cl.exe", sycl_root / "bin" / "clang-cl.exe", - sycl_root / "bin" / "clang++.exe", ] ) @@ -290,7 +290,7 @@ def setup_unix_compilers(sycl_root: Path) -> None: if gcc_openmp_header is not None and gcc_openmp_library.exists(): openmp_library = gcc_openmp_library openmp_library_name = "gomp" - openmp_flags = "-fopenmp" + openmp_flags = "-fopenmp=libgomp" if openmp_library is None and not source_built_linux_toolchain: main_error("Unable to locate an Intel toolchain OpenMP runtime library") From 335cc4ca81b14c770bb40d0a5a400a23ae23337e Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 22 Mar 2026 15:20:57 +0100 Subject: [PATCH 097/104] Align x86 SYCL CI targets and OpenMP headers --- scripts/ci/sycl_x86_setup.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index aa606f88c..a6df9db70 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -55,7 +55,7 @@ def configure_platform(platform: str) -> None: "toolchain_asset": "sycl_windows.tar.gz", "device_selector": "opencl:cpu", "opencv_apps": "ON", - "sycl_targets": "spir64", + "sycl_targets": "spir64_x86_64", }, }.get(platform) @@ -214,17 +214,17 @@ def setup_windows_compilers(sycl_root: Path) -> None: cc_path = find_first_existing( [ sycl_root / "bin" / "icx.exe", - sycl_root / "bin" / "clang.exe", sycl_root / "bin" / "icx-cl.exe", sycl_root / "bin" / "clang-cl.exe", + sycl_root / "bin" / "clang.exe", ] ) cxx_path = find_first_existing( [ sycl_root / "bin" / "icpx.exe", - sycl_root / "bin" / "clang++.exe", sycl_root / "bin" / "icx-cl.exe", sycl_root / "bin" / "clang-cl.exe", + sycl_root / "bin" / "clang++.exe", ] ) @@ -275,6 +275,7 @@ def setup_unix_compilers(sycl_root: Path) -> None: append_path(str(sycl_root / "bin")) if require_env("RUNNER_OS") == "Linux": + export_openmp_include_dir = True openmp_library = find_file([sycl_root, Path("/opt/intel/oneapi")], "libiomp5.so") openmp_library_name = "iomp5" openmp_flags = "-fopenmp=libiomp5" @@ -291,6 +292,7 @@ def setup_unix_compilers(sycl_root: Path) -> None: openmp_library = gcc_openmp_library openmp_library_name = "gomp" openmp_flags = "-fopenmp=libgomp" + export_openmp_include_dir = False if openmp_library is None and not source_built_linux_toolchain: main_error("Unable to locate an Intel toolchain OpenMP runtime library") @@ -306,16 +308,18 @@ def setup_unix_compilers(sycl_root: Path) -> None: if openmp_header is None and source_built_linux_toolchain: gcc_root = Path(require_env("ITLABAI_GCC_INSTALL_DIR")) openmp_header = find_file([gcc_root / "include"], "omp.h") + export_openmp_include_dir = False if openmp_header is None and not source_built_linux_toolchain: main_error( "Unable to locate Intel-provided omp.h under the SYCL toolchain" ) - if openmp_library is not None and openmp_header is not None: + if openmp_library is not None: write_env("ITLABAI_OPENMP_FLAGS", openmp_flags) write_env("ITLABAI_OPENMP_LIBRARY_NAME", openmp_library_name) write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library)) - write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent)) + if openmp_header is not None and export_openmp_include_dir: + write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent)) libsycl = find_file(library_roots + [sycl_root], "libsycl.so.8") if libsycl is None: From c1a326e63abfc6eda242f9454b1e6a0e6364d947 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 22 Mar 2026 19:42:32 +0100 Subject: [PATCH 098/104] Fix Intel SYCL example builds on x86 CI --- app/SYCL/CMakeLists.txt | 57 ++++++++++++++++++++++++++++++++++-- scripts/ci/sycl_x86_setup.py | 30 +++++++++++-------- 2 files changed, 72 insertions(+), 15 deletions(-) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 557fcf351..dd3258e0f 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -1,12 +1,63 @@ add_executable(SYCL_Example sycl_example.cpp - sycl_kernel.cpp ) target_link_libraries(SYCL_Example PRIVATE layers_lib) -itlabai_add_sycl_to_target(TARGET SYCL_Example SOURCES - sycl_kernel.cpp + +set_source_files_properties(sycl_example.cpp PROPERTIES + COMPILE_DEFINITIONS "SYCL_DISABLE_FSYCL_SYCLHPP_WARNING=1" + COMPILE_OPTIONS "-Wno-deprecated-declarations" ) +if(WIN32 AND ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") + if(NOT ITLABAI_SYCL_ROOT OR NOT EXISTS "${ITLABAI_SYCL_ROOT}/bin/clang++.exe") + message(FATAL_ERROR + "Windows IntelLLVM SYCL build requires clang++.exe under ITLABAI_SYCL_ROOT") + endif() + + set(SYCL_EXAMPLE_KERNEL_OBJECT + "${CMAKE_CURRENT_BINARY_DIR}/SYCL_Example.sycl_kernel.obj") + set(SYCL_KERNEL_COMPILE_COMMAND + "${ITLABAI_SYCL_ROOT}/bin/clang++.exe" + -std=c++20 + -fsycl + -I"${CMAKE_SOURCE_DIR}/include" + -I"${ITLABAI_SYCL_ROOT}/include" + -c + "${CMAKE_CURRENT_SOURCE_DIR}/sycl_kernel.cpp" + -o + "${SYCL_EXAMPLE_KERNEL_OBJECT}" + ) + if(ITLABAI_SYCL_TARGETS) + list(APPEND SYCL_KERNEL_COMPILE_COMMAND + "-fsycl-targets=${ITLABAI_SYCL_TARGETS}" + ) + endif() + + add_custom_command( + OUTPUT "${SYCL_EXAMPLE_KERNEL_OBJECT}" + COMMAND ${SYCL_KERNEL_COMPILE_COMMAND} + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/sycl_kernel.cpp" + VERBATIM + ) + target_sources(SYCL_Example PRIVATE "${SYCL_EXAMPLE_KERNEL_OBJECT}") + set_source_files_properties("${SYCL_EXAMPLE_KERNEL_OBJECT}" PROPERTIES + EXTERNAL_OBJECT TRUE + GENERATED TRUE + ) + target_include_directories(SYCL_Example PRIVATE "${ITLABAI_SYCL_ROOT}/include") + target_link_options(SYCL_Example PRIVATE -fsycl) + if(ITLABAI_SYCL_TARGETS) + target_link_options(SYCL_Example PRIVATE + -fsycl-targets=${ITLABAI_SYCL_TARGETS} + ) + endif() +else() + target_sources(SYCL_Example PRIVATE sycl_kernel.cpp) + itlabai_add_sycl_to_target(TARGET SYCL_Example SOURCES + sycl_kernel.cpp + ) +endif() + add_test(NAME SYCL.Example COMMAND SYCL_Example) set_tests_properties(SYCL.Example PROPERTIES LABELS "sycl;smoke" diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index a6df9db70..51486ed56 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -3,6 +3,7 @@ from __future__ import annotations import os +import shutil import sys from pathlib import Path @@ -276,6 +277,7 @@ def setup_unix_compilers(sycl_root: Path) -> None: if require_env("RUNNER_OS") == "Linux": export_openmp_include_dir = True + openmp_header = None openmp_library = find_file([sycl_root, Path("/opt/intel/oneapi")], "libiomp5.so") openmp_library_name = "iomp5" openmp_flags = "-fopenmp=libiomp5" @@ -289,27 +291,31 @@ def setup_unix_compilers(sycl_root: Path) -> None: gcc_openmp_header = find_file([gcc_include_root], "omp.h") gcc_openmp_library = Path(capture(["gcc-13", "-print-file-name=libgomp.so"])) if gcc_openmp_header is not None and gcc_openmp_library.exists(): + staged_openmp_include_dir = Path(require_env("RUNNER_TEMP")) / "gcc-openmp-include" + staged_openmp_include_dir.mkdir(parents=True, exist_ok=True) + shutil.copy2(gcc_openmp_header, staged_openmp_include_dir / "omp.h") openmp_library = gcc_openmp_library openmp_library_name = "gomp" openmp_flags = "-fopenmp=libgomp" - export_openmp_include_dir = False + openmp_header = staged_openmp_include_dir / "omp.h" if openmp_library is None and not source_built_linux_toolchain: main_error("Unable to locate an Intel toolchain OpenMP runtime library") - resource_dir = Path(capture([str(cxx_path), "-print-resource-dir"])) - openmp_header = find_file( - [ - resource_dir / "include", - sycl_root, - Path("/opt/intel/oneapi"), - ], - "omp.h", - ) - if openmp_header is None and source_built_linux_toolchain: + if openmp_library_name != "gomp": + resource_dir = Path(capture([str(cxx_path), "-print-resource-dir"])) + openmp_header = find_file( + [ + resource_dir / "include", + sycl_root, + Path("/opt/intel/oneapi"), + ], + "omp.h", + ) + if openmp_library_name != "gomp" and openmp_header is None and source_built_linux_toolchain: gcc_root = Path(require_env("ITLABAI_GCC_INSTALL_DIR")) openmp_header = find_file([gcc_root / "include"], "omp.h") export_openmp_include_dir = False - if openmp_header is None and not source_built_linux_toolchain: + if openmp_library_name != "gomp" and openmp_header is None and not source_built_linux_toolchain: main_error( "Unable to locate Intel-provided omp.h under the SYCL toolchain" ) From 9d3bbab3606f1d01d1bb6264663325ede900c5a5 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 22 Mar 2026 20:06:38 +0100 Subject: [PATCH 099/104] Isolate SYCL kernel from OpenMP compile flags --- app/SYCL/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index dd3258e0f..539d3ed8d 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -52,10 +52,11 @@ if(WIN32 AND ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") ) endif() else() - target_sources(SYCL_Example PRIVATE sycl_kernel.cpp) - itlabai_add_sycl_to_target(TARGET SYCL_Example SOURCES + add_library(SYCL_Example_kernel OBJECT sycl_kernel.cpp) + itlabai_add_sycl_to_target(TARGET SYCL_Example_kernel SOURCES sycl_kernel.cpp ) + target_sources(SYCL_Example PRIVATE $) endif() add_test(NAME SYCL.Example COMMAND SYCL_Example) From 58167bbe5af5cb5f7e779184e9fba6232c0ebe8b Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 22 Mar 2026 20:20:24 +0100 Subject: [PATCH 100/104] Restore SYCL host includes for example --- app/SYCL/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 539d3ed8d..953bf6236 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -3,6 +3,14 @@ add_executable(SYCL_Example ) target_link_libraries(SYCL_Example PRIVATE layers_lib) +if(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "AdaptiveCpp") + target_link_libraries(SYCL_Example PRIVATE AdaptiveCpp::acpp-rt) +elseif(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM" + AND ITLABAI_SYCL_ROOT + AND EXISTS "${ITLABAI_SYCL_ROOT}/include") + target_include_directories(SYCL_Example PRIVATE "${ITLABAI_SYCL_ROOT}/include") +endif() + set_source_files_properties(sycl_example.cpp PROPERTIES COMPILE_DEFINITIONS "SYCL_DISABLE_FSYCL_SYCLHPP_WARNING=1" COMPILE_OPTIONS "-Wno-deprecated-declarations" @@ -44,7 +52,6 @@ if(WIN32 AND ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") EXTERNAL_OBJECT TRUE GENERATED TRUE ) - target_include_directories(SYCL_Example PRIVATE "${ITLABAI_SYCL_ROOT}/include") target_link_options(SYCL_Example PRIVATE -fsycl) if(ITLABAI_SYCL_TARGETS) target_link_options(SYCL_Example PRIVATE From 3461caa858e079c5ea228450c64f3f8e7d361c34 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 22 Mar 2026 20:30:52 +0100 Subject: [PATCH 101/104] Link Intel SYCL example runtime --- app/SYCL/CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 953bf6236..20b891783 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -11,6 +11,15 @@ elseif(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM" target_include_directories(SYCL_Example PRIVATE "${ITLABAI_SYCL_ROOT}/include") endif() +if(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") + target_link_options(SYCL_Example PRIVATE -fsycl) + if(ITLABAI_SYCL_TARGETS) + target_link_options(SYCL_Example PRIVATE + -fsycl-targets=${ITLABAI_SYCL_TARGETS} + ) + endif() +endif() + set_source_files_properties(sycl_example.cpp PROPERTIES COMPILE_DEFINITIONS "SYCL_DISABLE_FSYCL_SYCLHPP_WARNING=1" COMPILE_OPTIONS "-Wno-deprecated-declarations" @@ -52,12 +61,6 @@ if(WIN32 AND ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") EXTERNAL_OBJECT TRUE GENERATED TRUE ) - target_link_options(SYCL_Example PRIVATE -fsycl) - if(ITLABAI_SYCL_TARGETS) - target_link_options(SYCL_Example PRIVATE - -fsycl-targets=${ITLABAI_SYCL_TARGETS} - ) - endif() else() add_library(SYCL_Example_kernel OBJECT sycl_kernel.cpp) itlabai_add_sycl_to_target(TARGET SYCL_Example_kernel SOURCES From fca6f3b075287ff20dd0a3fdd5aafc68e4560b3b Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Mon, 23 Mar 2026 01:16:40 +0100 Subject: [PATCH 102/104] Fix Windows SYCL linking and ccache --- .github/workflows/sycl-ci.yml | 5 +++-- CMakeLists.txt | 2 ++ app/SYCL/CMakeLists.txt | 8 +++++++- scripts/ci/sycl_configure.py | 6 +++++- scripts/ci/sycl_x86_setup.py | 7 +++++++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index 0b3241d11..b9242c7d5 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -121,9 +121,10 @@ jobs: uses: seanmiddleditch/gha-setup-ninja@v6 - name: Setup ccache - uses: Chocobo1/setup-ccache-action@v1 + uses: hendrikmuhs/ccache-action@v1.2 with: - windows_compile_environment: msvc + key: ccache-${{ github.job }}-${{ matrix.build_type }} + max-size: 2G - name: Setup MSVC environment uses: ilammy/msvc-dev-cmd@v1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9cd2fa3e3..a983fc98a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,8 @@ set(ITLABAI_SYCL_TARGETS "" CACHE STRING "Optional SYCL targets; forwarded to AdaptiveCpp as ACPP_TARGETS or IntelLLVM as -fsycl-targets") set(ITLABAI_SYCL_ROOT "" CACHE PATH "Optional root directory of the SYCL toolchain; used to expose SYCL headers to host-only sources") +set(ITLABAI_SYCL_LIBRARY "" CACHE FILEPATH + "Optional Intel SYCL runtime import library; used for Windows host linking") option(ENABLE_STATISTIC_TENSORS "Enable statistic tensors" OFF) diff --git a/app/SYCL/CMakeLists.txt b/app/SYCL/CMakeLists.txt index 20b891783..65452e1ad 100644 --- a/app/SYCL/CMakeLists.txt +++ b/app/SYCL/CMakeLists.txt @@ -11,7 +11,7 @@ elseif(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM" target_include_directories(SYCL_Example PRIVATE "${ITLABAI_SYCL_ROOT}/include") endif() -if(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") +if(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM" AND NOT WIN32) target_link_options(SYCL_Example PRIVATE -fsycl) if(ITLABAI_SYCL_TARGETS) target_link_options(SYCL_Example PRIVATE @@ -30,6 +30,11 @@ if(WIN32 AND ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") message(FATAL_ERROR "Windows IntelLLVM SYCL build requires clang++.exe under ITLABAI_SYCL_ROOT") endif() + if(NOT ITLABAI_SYCL_LIBRARY OR NOT EXISTS "${ITLABAI_SYCL_LIBRARY}") + message(FATAL_ERROR + "Windows IntelLLVM SYCL build requires ITLABAI_SYCL_LIBRARY " + "to point to the runtime import library") + endif() set(SYCL_EXAMPLE_KERNEL_OBJECT "${CMAKE_CURRENT_BINARY_DIR}/SYCL_Example.sycl_kernel.obj") @@ -61,6 +66,7 @@ if(WIN32 AND ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM") EXTERNAL_OBJECT TRUE GENERATED TRUE ) + target_link_libraries(SYCL_Example PRIVATE "${ITLABAI_SYCL_LIBRARY}") else() add_library(SYCL_Example_kernel OBJECT sycl_kernel.cpp) itlabai_add_sycl_to_target(TARGET SYCL_Example_kernel SOURCES diff --git a/scripts/ci/sycl_configure.py b/scripts/ci/sycl_configure.py index 4f2d34c3f..492704250 100644 --- a/scripts/ci/sycl_configure.py +++ b/scripts/ci/sycl_configure.py @@ -3,6 +3,7 @@ from __future__ import annotations import os +import shutil import sys from common import main_error, require_env, run @@ -15,7 +16,7 @@ def main() -> None: build_type, opencv_apps = sys.argv[1:] cmake_args = [] - if require_env("RUNNER_OS") != "Windows": + if shutil.which("ccache"): cmake_args.extend( [ "-DCMAKE_C_COMPILER_LAUNCHER=ccache", @@ -58,6 +59,9 @@ def main() -> None: itlabai_sycl_root = os.environ.get("SYCL_ROOT", "") if itlabai_sycl_root: cmake_args.append(f"-DITLABAI_SYCL_ROOT={itlabai_sycl_root}") + itlabai_sycl_library = os.environ.get("ITLABAI_SYCL_LIBRARY", "") + if itlabai_sycl_library: + cmake_args.append(f"-DITLABAI_SYCL_LIBRARY={itlabai_sycl_library}") c_flags = os.environ.get("ITLABAI_C_FLAGS", "") cxx_flags = os.environ.get("ITLABAI_CXX_FLAGS", "") diff --git a/scripts/ci/sycl_x86_setup.py b/scripts/ci/sycl_x86_setup.py index 51486ed56..7ef9f4b1c 100644 --- a/scripts/ci/sycl_x86_setup.py +++ b/scripts/ci/sycl_x86_setup.py @@ -228,10 +228,17 @@ def setup_windows_compilers(sycl_root: Path) -> None: sycl_root / "bin" / "clang++.exe", ] ) + sycl_library = find_first_existing( + [ + sycl_root / "lib" / "sycl8.lib", + sycl_root / "lib" / "sycl.lib", + ] + ) write_env("ITLABAI_CC", cygpath("m", cc_path)) write_env("ITLABAI_CXX", cygpath("m", cxx_path)) write_env("ITLABAI_CMAKE_PREFIX_PATH", cygpath("m", sycl_root)) + write_env("ITLABAI_SYCL_LIBRARY", cygpath("m", sycl_library)) append_path(cygpath("m", sycl_root / "bin")) From 4dc2b1bf575cf566c55203eb10abdba437099635 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Mon, 23 Mar 2026 02:33:51 +0100 Subject: [PATCH 103/104] Fail fast on SYCL example build --- .github/workflows/sycl-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index b9242c7d5..c0d303c2b 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -86,6 +86,9 @@ jobs: - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" + - name: Build SYCL example + run: cmake --build build --target SYCL_Example --parallel + - name: Build run: cmake --build build --parallel @@ -135,6 +138,9 @@ jobs: - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" + - name: Build SYCL example + run: cmake --build build --target SYCL_Example --parallel + - name: Build run: cmake --build build --parallel @@ -184,6 +190,9 @@ jobs: - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" + - name: Build SYCL example + run: cmake --build build --target SYCL_Example --parallel + - name: Build run: cmake --build build --parallel From 1cdb8edbe14ea7887f8327e6fecf71b040468836 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Mon, 23 Mar 2026 02:34:50 +0100 Subject: [PATCH 104/104] Revert "Fail fast on SYCL example build" This reverts commit 4dc2b1bf575cf566c55203eb10abdba437099635. --- .github/workflows/sycl-ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/sycl-ci.yml b/.github/workflows/sycl-ci.yml index c0d303c2b..b9242c7d5 100644 --- a/.github/workflows/sycl-ci.yml +++ b/.github/workflows/sycl-ci.yml @@ -86,9 +86,6 @@ jobs: - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" - - name: Build SYCL example - run: cmake --build build --target SYCL_Example --parallel - - name: Build run: cmake --build build --parallel @@ -138,9 +135,6 @@ jobs: - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" - - name: Build SYCL example - run: cmake --build build --target SYCL_Example --parallel - - name: Build run: cmake --build build --parallel @@ -190,9 +184,6 @@ jobs: - name: Configure run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}" - - name: Build SYCL example - run: cmake --build build --target SYCL_Example --parallel - - name: Build run: cmake --build build --parallel