Add SYCL support #142
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SYCL CI | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| ADAPTIVECPP_TAG: v25.10.0 | |
| ADAPTIVECPP_CACHE_VERSION: v4 | |
| ACPP_TARGETS: omp.library-only | |
| jobs: | |
| prepare-sycl-toolchain: | |
| name: prepare ${{ matrix.platform }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 180 | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| platform: | |
| - linux-x86_64 | |
| - linux-arm64 | |
| - windows-x86_64 | |
| include: | |
| - platform: linux-x86_64 | |
| runner: ubuntu-latest | |
| - platform: linux-arm64 | |
| runner: ubuntu-24.04-arm | |
| - platform: windows-x86_64 | |
| runner: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: ccache-${{ github.job }}-${{ matrix.platform }} | |
| max-size: 4G | |
| - name: Restore or save AdaptiveCpp toolchain cache | |
| id: sycl-toolchain-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ runner.temp }}/AdaptiveCpp | |
| ${{ runner.temp }}/AdaptiveCpp-build | |
| ${{ runner.temp }}/adaptivecpp-install | |
| ${{ runner.temp }}/archives | |
| key: sycl-toolchain-${{ matrix.platform }}-${{ env.ADAPTIVECPP_TAG }}-${{ env.ADAPTIVECPP_CACHE_VERSION }} | |
| - name: Prepare SYCL toolchain | |
| uses: ./.github/actions/setup-sycl-toolchain | |
| with: | |
| phase: prepare | |
| cache-hit: ${{ steps.sycl-toolchain-cache.outputs.cache-hit }} | |
| build-sycl: | |
| name: ${{ matrix.platform }} ${{ matrix.build_type }} | |
| needs: prepare-sycl-toolchain | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 180 | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| platform: | |
| - linux-x86_64 | |
| - linux-arm64 | |
| - macos-arm64 | |
| - windows-x86_64 | |
| build_type: | |
| - Debug | |
| - Release | |
| include: | |
| - platform: linux-x86_64 | |
| runner: ubuntu-latest | |
| - platform: linux-arm64 | |
| runner: ubuntu-24.04-arm | |
| - platform: macos-arm64 | |
| runner: macos-15 | |
| - platform: windows-x86_64 | |
| runner: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Setup ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: ccache-${{ github.job }}-${{ matrix.platform }}-${{ matrix.build_type }} | |
| max-size: 4G | |
| - name: Restore AdaptiveCpp toolchain cache | |
| if: runner.os != 'macOS' | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ${{ runner.temp }}/AdaptiveCpp | |
| ${{ runner.temp }}/AdaptiveCpp-build | |
| ${{ runner.temp }}/adaptivecpp-install | |
| ${{ runner.temp }}/archives | |
| key: sycl-toolchain-${{ matrix.platform }}-${{ env.ADAPTIVECPP_TAG }}-${{ env.ADAPTIVECPP_CACHE_VERSION }} | |
| fail-on-cache-miss: true | |
| - name: Setup SYCL toolchain | |
| uses: ./.github/actions/setup-sycl-toolchain | |
| with: | |
| phase: build | |
| - name: Configure | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| cmake -S . -B "build/${{ matrix.build_type }}" -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ | |
| -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ | |
| -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ | |
| -DOpenMP_ROOT="${ITLABAI_OPENMP_ROOT}" \ | |
| -DACPP_TARGETS="${ACPP_TARGETS}" \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| - name: Configure | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| cmake -S . -B "build/${{ matrix.build_type }}" -G Ninja ` | |
| "-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}" ` | |
| "-DCMAKE_C_COMPILER=$env:ITLABAI_CC" ` | |
| "-DCMAKE_CXX_COMPILER=$env:ITLABAI_CXX" ` | |
| "-DCMAKE_PREFIX_PATH=$env:ITLABAI_CMAKE_PREFIX_PATH" ` | |
| "-DACPP_TARGETS=$env:ACPP_TARGETS" ` | |
| "-DACPP_CPU_CXX=$env:ITLABAI_ACPP_CPU_CXX" ` | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache ` | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| - name: Build | |
| run: cmake --build "build/${{ matrix.build_type }}" --target SYCL_Example run_test --parallel | |
| - name: Test | |
| run: ctest --test-dir "build/${{ matrix.build_type }}" --output-on-failure -R '^(UnitTests|SYCL\.Example)$' | |
| codecov-sycl: | |
| name: codecov sycl | |
| needs: prepare-sycl-toolchain | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Setup ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: ccache-${{ github.job }}-linux-x86_64 | |
| max-size: 4G | |
| - name: Restore AdaptiveCpp toolchain cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ${{ runner.temp }}/AdaptiveCpp | |
| ${{ runner.temp }}/AdaptiveCpp-build | |
| ${{ runner.temp }}/adaptivecpp-install | |
| ${{ runner.temp }}/archives | |
| key: sycl-toolchain-linux-x86_64-${{ env.ADAPTIVECPP_TAG }}-${{ env.ADAPTIVECPP_CACHE_VERSION }} | |
| fail-on-cache-miss: true | |
| - name: Setup SYCL toolchain | |
| uses: ./.github/actions/setup-sycl-toolchain | |
| with: | |
| phase: build | |
| - name: Install coverage tools | |
| shell: bash | |
| run: sudo apt-get update && sudo apt-get install -y gcovr | |
| - name: Configure | |
| shell: bash | |
| run: | | |
| cmake -S . -B build/sycl-coverage -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_COMPILER="${ITLABAI_CC}" \ | |
| -DCMAKE_CXX_COMPILER="${ITLABAI_CXX}" \ | |
| -DCMAKE_PREFIX_PATH="${ITLABAI_CMAKE_PREFIX_PATH}" \ | |
| -DOpenMP_ROOT="${ITLABAI_OPENMP_ROOT}" \ | |
| -DACPP_TARGETS="${ACPP_TARGETS}" \ | |
| -DCMAKE_C_FLAGS="--coverage" \ | |
| -DCMAKE_CXX_FLAGS="--coverage" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="--coverage" \ | |
| -DCMAKE_SHARED_LINKER_FLAGS="--coverage" \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| - name: Build | |
| run: cmake --build build/sycl-coverage --target SYCL_Example run_test --parallel | |
| - name: Test | |
| run: ctest --test-dir build/sycl-coverage --output-on-failure -R '^(UnitTests|SYCL\.Example)$' | |
| - name: Generate SYCL coverage data | |
| run: gcovr -r . --xml -o sycl-coverage.xml --gcov-executable "llvm-cov-18 gcov" --gcov-ignore-parse-errors | |
| - name: Upload SYCL coverage report to Codecov | |
| uses: codecov/codecov-action@v4.0.1 | |
| with: | |
| files: sycl-coverage.xml | |
| flags: sycl | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: embedded-dev-research/ITLabAI |