Skip to content

Commit 8c1ae43

Browse files
committed
Simplify SYCL integration and CI
1 parent c5560ab commit 8c1ae43

13 files changed

Lines changed: 299 additions & 1374 deletions

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ jobs:
2727
cmake --build build --parallel
2828
- name: Run clang-tidy
2929
run: |
30-
mapfile -t sources < <(find app src -path 'app/SYCL' -prune -o -name '*.cpp' -print)
31-
clang-tidy "${sources[@]}" -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build
30+
clang-tidy app/**/*.cpp src/**/*.cpp -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build

.github/workflows/sycl-ci.yml

Lines changed: 95 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -9,216 +9,123 @@ concurrency:
99
cancel-in-progress: true
1010

1111
env:
12-
INTEL_LLVM_TAG: nightly-2026-03-17
13-
INTEL_OPENCL_CPU_RUNTIME_VERSION: 2025.3.1.762
14-
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
1512
ADAPTIVECPP_TAG: v25.10.0
13+
LLVM_MINGW_VERSION: "20231128"
1614

1715
jobs:
18-
prepare-sycl-linux-x86-toolchain:
19-
name: prepare-linux-x86_64-toolchain
20-
runs-on: ubuntu-latest
21-
timeout-minutes: 360
22-
23-
defaults:
24-
run:
25-
shell: bash
26-
27-
steps:
28-
- uses: actions/checkout@v4
29-
30-
- name: Setup Ninja
31-
uses: seanmiddleditch/gha-setup-ninja@v6
32-
33-
- name: Setup ccache
34-
uses: hendrikmuhs/ccache-action@v1.2
35-
with:
36-
key: ccache-${{ github.job }}-${{ env.INTEL_LLVM_TAG }}
37-
max-size: 8G
38-
39-
- name: Restore Intel toolchain cache
40-
uses: actions/cache@v4
41-
with:
42-
path: ${{ runner.temp }}/intel-nativecpu-toolchain/build
43-
key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v4
44-
45-
- name: Prepare Intel native_cpu toolchain
46-
run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64
47-
48-
build-sycl-linux-x86:
49-
name: linux-x86_64 / ${{ matrix.build_type }}
50-
runs-on: ubuntu-latest
51-
needs: prepare-sycl-linux-x86-toolchain
16+
build-sycl:
17+
name: ${{ matrix.platform }}
18+
runs-on: ${{ matrix.runner }}
5219
timeout-minutes: 360
5320
strategy:
5421
fail-fast: true
5522
matrix:
56-
build_type:
57-
- Debug
58-
- Release
59-
60-
defaults:
61-
run:
62-
shell: bash
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
6332

6433
steps:
6534
- uses: actions/checkout@v4
6635
with:
6736
submodules: true
6837

69-
- name: Setup Ninja
70-
uses: seanmiddleditch/gha-setup-ninja@v6
71-
7238
- name: Setup ccache
7339
uses: hendrikmuhs/ccache-action@v1.2
7440
with:
75-
key: ccache-${{ github.job }}-${{ matrix.build_type }}
76-
max-size: 2G
77-
78-
- name: Restore Intel toolchain cache
79-
uses: actions/cache@v4
80-
with:
81-
path: ${{ runner.temp }}/intel-nativecpu-toolchain/build
82-
key: intel-nativecpu-toolchain-${{ env.INTEL_LLVM_TAG }}-v4
83-
84-
- name: Prepare platform settings
85-
run: python3 ./scripts/ci/sycl_x86_setup.py linux-x86_64
86-
87-
- name: Configure
88-
run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}"
89-
90-
- name: Build
91-
run: cmake --build build --parallel
92-
93-
- name: Test
94-
run: |
95-
if [ -n "${DEVICE_SELECTOR}" ]; then
96-
ONEAPI_DEVICE_SELECTOR="${DEVICE_SELECTOR}" ctest --test-dir build --output-on-failure -E '^SYCL\.Example$' --parallel
97-
else
98-
ctest --test-dir build --output-on-failure -E '^SYCL\.Example$' --parallel
99-
fi
100-
101-
prepare-sycl-windows-x86-toolchain:
102-
name: prepare-windows-x86_64-toolchain
103-
runs-on: windows-2025
104-
timeout-minutes: 360
41+
key: ccache-${{ github.job }}-${{ matrix.platform }}
42+
max-size: 4G
10543

106-
defaults:
107-
run:
108-
shell: bash
109-
110-
steps:
111-
- uses: actions/checkout@v4
112-
113-
- name: Restore Intel toolchain cache
44+
- name: Restore AdaptiveCpp toolchain cache
11445
uses: actions/cache@v4
11546
with:
11647
path: |
117-
${{ runner.temp }}/intel-sycl
118-
${{ runner.temp }}/intel-opencl-runtime
119-
${{ runner.temp }}/intel-opencl-runtime.exe
120-
key: intel-windows-sycl-assets-${{ env.INTEL_LLVM_TAG }}-${{ env.INTEL_OPENCL_CPU_RUNTIME_VERSION }}-v1
121-
122-
- name: Prepare Intel Windows SYCL assets
123-
env:
124-
ITLABAI_PREPARE_ONLY: "1"
125-
run: python3 ./scripts/ci/sycl_x86_setup.py windows-x86_64
126-
127-
build-sycl-windows-x86:
128-
name: windows-x86_64 / ${{ matrix.build_type }}
129-
runs-on: windows-2025
130-
needs: prepare-sycl-windows-x86-toolchain
131-
timeout-minutes: 360
132-
strategy:
133-
fail-fast: true
134-
matrix:
135-
build_type:
136-
- Debug
137-
- Release
138-
139-
defaults:
140-
run:
141-
shell: bash
142-
143-
steps:
144-
- uses: actions/checkout@v4
145-
with:
146-
submodules: true
147-
148-
- name: Setup Ninja
149-
uses: seanmiddleditch/gha-setup-ninja@v6
150-
151-
- name: Setup ccache
152-
uses: hendrikmuhs/ccache-action@v1.2
153-
with:
154-
key: ccache-${{ github.job }}-${{ matrix.build_type }}
155-
max-size: 2G
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
15656

15757
- name: Setup MSVC environment
58+
if: runner.os == 'Windows'
15859
uses: ilammy/msvc-dev-cmd@v1
15960

160-
- name: Restore Intel toolchain cache
161-
uses: actions/cache@v4
162-
with:
163-
path: |
164-
${{ runner.temp }}/intel-sycl
165-
${{ runner.temp }}/intel-opencl-runtime
166-
${{ runner.temp }}/intel-opencl-runtime.exe
167-
key: intel-windows-sycl-assets-${{ env.INTEL_LLVM_TAG }}-${{ env.INTEL_OPENCL_CPU_RUNTIME_VERSION }}-v1
168-
169-
- name: Prepare platform settings
170-
run: python3 ./scripts/ci/sycl_x86_setup.py windows-x86_64
171-
172-
- name: Configure
173-
run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}"
174-
175-
- name: Build
176-
run: cmake --build build --parallel
177-
178-
- name: Test
179-
run: python3 ./scripts/ci/sycl_test.py
180-
181-
build-sycl-adaptivecpp-arm64:
182-
name: ${{ matrix.platform }} / ${{ matrix.build_type }}
183-
runs-on: ${{ matrix.platform == 'linux-arm64' && 'ubuntu-24.04-arm' || 'macos-15' }}
184-
timeout-minutes: 360
185-
strategy:
186-
fail-fast: true
187-
matrix:
188-
platform:
189-
- linux-arm64
190-
- macos-arm64
191-
build_type:
192-
- Debug
193-
- Release
194-
195-
defaults:
196-
run:
197-
shell: bash
198-
199-
steps:
200-
- uses: actions/checkout@v4
201-
with:
202-
submodules: true
203-
204-
- name: Setup Ninja
205-
uses: seanmiddleditch/gha-setup-ninja@v6
61+
- name: Prepare AdaptiveCpp toolchain
62+
run: python ./scripts/ci/sycl_setup.py ${{ matrix.platform }}
20663

207-
- name: Setup ccache
208-
uses: hendrikmuhs/ccache-action@v1.2
209-
with:
210-
key: ccache-${{ github.job }}-${{ matrix.platform }}-${{ matrix.build_type }}
211-
max-size: 2G
212-
213-
- name: Install AdaptiveCpp prerequisites
214-
run: python3 ./scripts/ci/sycl_adaptivecpp_setup.py
215-
216-
- name: Configure
217-
run: python3 ./scripts/ci/sycl_configure.py "${{ matrix.build_type }}" "${ITLABAI_ENABLE_OPENCV_APPS}"
218-
219-
- name: Build
220-
run: cmake --build build --parallel
221-
222-
- name: Test
223-
run: ctest --test-dir build --output-on-failure --parallel
224-
-E '^SYCL\.Example$'
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

Comments
 (0)