|
| 1 | +name: SYCL CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +env: |
| 12 | + ADAPTIVECPP_TAG: v25.10.0 |
| 13 | + LLVM_MINGW_VERSION: "20231128" |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-sycl: |
| 17 | + name: ${{ matrix.platform }} |
| 18 | + runs-on: ${{ matrix.runner }} |
| 19 | + timeout-minutes: 360 |
| 20 | + strategy: |
| 21 | + fail-fast: true |
| 22 | + matrix: |
| 23 | + include: |
| 24 | + - platform: linux-x86_64 |
| 25 | + runner: ubuntu-latest |
| 26 | + - platform: linux-arm64 |
| 27 | + runner: ubuntu-24.04-arm |
| 28 | + - platform: macos-arm64 |
| 29 | + runner: macos-15 |
| 30 | + - platform: windows-x86_64 |
| 31 | + runner: windows-2022 |
| 32 | + |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + submodules: true |
| 37 | + |
| 38 | + - name: Setup ccache |
| 39 | + uses: hendrikmuhs/ccache-action@v1.2 |
| 40 | + with: |
| 41 | + key: ccache-${{ github.job }}-${{ matrix.platform }} |
| 42 | + max-size: 4G |
| 43 | + |
| 44 | + - name: Restore AdaptiveCpp toolchain cache |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + path: | |
| 48 | + ${{ runner.temp }}/AdaptiveCpp |
| 49 | + ${{ runner.temp }}/AdaptiveCpp-build |
| 50 | + ${{ runner.temp }}/adaptivecpp-install |
| 51 | + ${{ runner.temp }}/llvm |
| 52 | + ${{ runner.temp }}/boost_1_87_0 |
| 53 | + ${{ runner.temp }}/ninja_install |
| 54 | + ${{ runner.temp }}/archives |
| 55 | + key: sycl-toolchain-${{ matrix.platform }}-${{ env.ADAPTIVECPP_TAG }}-${{ env.LLVM_MINGW_VERSION }}-v1 |
| 56 | + |
| 57 | + - name: Setup MSVC environment |
| 58 | + if: runner.os == 'Windows' |
| 59 | + uses: ilammy/msvc-dev-cmd@v1 |
| 60 | + |
| 61 | + - name: Prepare AdaptiveCpp toolchain |
| 62 | + run: python ./scripts/ci/sycl_setup.py ${{ matrix.platform }} |
| 63 | + |
| 64 | + - name: Configure, build and test |
| 65 | + if: runner.os != 'Windows' |
| 66 | + shell: bash |
| 67 | + run: | |
| 68 | + for build_type in Debug Release; do |
| 69 | + build_dir="build/${build_type}" |
| 70 | + cmake_args=( |
| 71 | + -S . |
| 72 | + -B "${build_dir}" |
| 73 | + -G Ninja |
| 74 | + -DCMAKE_BUILD_TYPE=${build_type} |
| 75 | + -DCMAKE_C_COMPILER=${ITLABAI_CC} |
| 76 | + -DCMAKE_CXX_COMPILER=${ITLABAI_CXX} |
| 77 | + -DCMAKE_PREFIX_PATH=${ITLABAI_CMAKE_PREFIX_PATH} |
| 78 | + -DITLABAI_ENABLE_SYCL=ON |
| 79 | + -DITLABAI_SYCL_IMPLEMENTATION=AdaptiveCpp |
| 80 | + -DITLABAI_ENABLE_OPENCV_APPS=OFF |
| 81 | + -DITLABAI_BUILD_TESTS=ON |
| 82 | + -DACPP_TARGETS=${ACPP_TARGETS} |
| 83 | + ) |
| 84 | + if command -v ccache >/dev/null 2>&1; then |
| 85 | + cmake_args+=( |
| 86 | + -DCMAKE_C_COMPILER_LAUNCHER=ccache |
| 87 | + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache |
| 88 | + ) |
| 89 | + fi |
| 90 | + if [ -n "${ITLABAI_OPENMP_ROOT:-}" ]; then |
| 91 | + cmake_args+=(-DOpenMP_ROOT=${ITLABAI_OPENMP_ROOT}) |
| 92 | + fi |
| 93 | + cmake "${cmake_args[@]}" |
| 94 | + cmake --build "${build_dir}" --parallel |
| 95 | + ctest --test-dir "${build_dir}" --output-on-failure -E '^SYCL\.Example$' --parallel |
| 96 | + done |
| 97 | +
|
| 98 | + - name: Configure, build and test |
| 99 | + if: runner.os == 'Windows' |
| 100 | + shell: pwsh |
| 101 | + run: | |
| 102 | + foreach ($buildType in 'Debug', 'Release') { |
| 103 | + $buildDir = "build/$buildType" |
| 104 | + $cmakeArgs = @( |
| 105 | + '-S', '.', |
| 106 | + '-B', $buildDir, |
| 107 | + '-G', 'Ninja', |
| 108 | + "-DCMAKE_BUILD_TYPE=$buildType", |
| 109 | + "-DCMAKE_C_COMPILER=$env:ITLABAI_CC", |
| 110 | + "-DCMAKE_CXX_COMPILER=$env:ITLABAI_CXX", |
| 111 | + "-DCMAKE_PREFIX_PATH=$env:ITLABAI_CMAKE_PREFIX_PATH", |
| 112 | + '-DITLABAI_ENABLE_SYCL=ON', |
| 113 | + '-DITLABAI_SYCL_IMPLEMENTATION=AdaptiveCpp', |
| 114 | + '-DITLABAI_ENABLE_OPENCV_APPS=OFF', |
| 115 | + '-DITLABAI_BUILD_TESTS=ON', |
| 116 | + "-DACPP_TARGETS=$env:ACPP_TARGETS" |
| 117 | + ) |
| 118 | + if (Get-Command ccache -ErrorAction SilentlyContinue) { |
| 119 | + $cmakeArgs += '-DCMAKE_C_COMPILER_LAUNCHER=ccache' |
| 120 | + $cmakeArgs += '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache' |
| 121 | + } |
| 122 | + if ($env:ITLABAI_OPENMP_ROOT) { |
| 123 | + $cmakeArgs += "-DOpenMP_ROOT=$env:ITLABAI_OPENMP_ROOT" |
| 124 | + } |
| 125 | + & cmake @cmakeArgs |
| 126 | + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } |
| 127 | + & cmake --build $buildDir --parallel |
| 128 | + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } |
| 129 | + & ctest --test-dir $buildDir --output-on-failure -E '^SYCL\.Example$' --parallel |
| 130 | + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } |
| 131 | + } |
0 commit comments