Skip to content

Commit 0f04f66

Browse files
authored
[CI] Add SYCL-CTS on Win (#17501)
This patch adds SYCL-CTS build&launch on Win. Also prepare the workflow for separate actions like it was done for Linux.
1 parent 63af8bb commit 0f04f66

File tree

4 files changed

+260
-12
lines changed

4 files changed

+260
-12
lines changed

.github/workflows/sycl-nightly.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ jobs:
202202
with:
203203
mode: stop
204204

205-
build-sycl-cts:
205+
build-sycl-cts-linux:
206206
needs: ubuntu2204_build
207207
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
208208
uses: ./.github/workflows/sycl-linux-run-tests.yml
209209
with:
210-
name: Build SYCL-CTS
210+
name: Build SYCL-CTS for Linux
211211
runner: '["Linux", "build"]'
212212
cts_testing_mode: 'build-only'
213213
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
@@ -216,9 +216,10 @@ jobs:
216216
sycl_toolchain_artifact: sycl_linux_default
217217
sycl_toolchain_archive: ${{ needs.ubuntu2204_build.outputs.artifact_archive_name }}
218218
sycl_toolchain_decompress_command: ${{ needs.ubuntu2204_build.outputs.artifact_decompress_command }}
219+
sycl_cts_artifact: sycl_cts_bin_linux
219220

220-
run-sycl-cts:
221-
needs: [ubuntu2204_build, build-sycl-cts]
221+
run-sycl-cts-linux:
222+
needs: [ubuntu2204_build, build-sycl-cts-linux]
222223
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
223224
strategy:
224225
fail-fast: false
@@ -245,7 +246,41 @@ jobs:
245246
sycl_toolchain_artifact: sycl_linux_default
246247
sycl_toolchain_archive: ${{ needs.ubuntu2204_build.outputs.artifact_archive_name }}
247248
sycl_toolchain_decompress_command: ${{ needs.ubuntu2204_build.outputs.artifact_decompress_command }}
248-
sycl_cts_artifact: sycl_cts_bin
249+
sycl_cts_artifact: sycl_cts_bin_linux
250+
251+
build-sycl-cts-win:
252+
needs: build-win
253+
if: ${{ always() && !cancelled() && needs.build-win.outputs.build_conclusion == 'success' }}
254+
uses: ./.github/workflows/sycl-windows-run-tests.yml
255+
with:
256+
name: Build SYCL-CTS for Windows
257+
runner: '["Windows", "build-e2e"]'
258+
cts_testing_mode: 'build-only'
259+
tests_selector: cts
260+
ref: ${{ github.sha }}
261+
sycl_toolchain_archive: ${{ needs.build-win.outputs.artifact_archive_name }}
262+
sycl_cts_artifact: sycl_cts_bin_win
263+
264+
run-sycl-cts-win:
265+
needs: [build-win, build-sycl-cts-win]
266+
if: ${{ always() && !cancelled() && needs.build-win.outputs.build_conclusion == 'success' }}
267+
strategy:
268+
fail-fast: false
269+
matrix:
270+
include:
271+
- name: SYCL-CTS on L0 gen12
272+
runner: '["Windows", "gen12"]'
273+
target_devices: level_zero:gpu
274+
uses: ./.github/workflows/sycl-windows-run-tests.yml
275+
with:
276+
name: ${{ matrix.name }}
277+
runner: ${{ matrix.runner }}
278+
cts_testing_mode: 'run-only'
279+
target_devices: ${{ matrix.target_devices }}
280+
tests_selector: cts
281+
ref: ${{ github.sha }}
282+
sycl_toolchain_archive: ${{ needs.build-win.outputs.artifact_archive_name }}
283+
sycl_cts_artifact: sycl_cts_bin_win
249284

250285
aggregate_benchmark_results:
251286
if: github.repository == 'intel/llvm' && !cancelled()

.github/workflows/sycl-windows-run-tests.yml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ on:
1010
type: string
1111
required: True
1212

13+
target_devices:
14+
type: string
15+
required: False
16+
extra_cmake_args:
17+
type: string
18+
required: False
19+
tests_selector:
20+
description: |
21+
Two possible options: "e2e" and "cts".
22+
type: string
23+
default: "e2e"
24+
1325
extra_lit_opts:
1426
description: |
1527
Extra options to be added to LIT_OPTS.
@@ -28,6 +40,10 @@ on:
2840
Note: it doesn't affect ./devops/actions/run-tests/* as these actions
2941
call checkout again and therefore override the devops directory, so
3042
configs/dependecies from input.ref are used.
43+
tests_ref:
44+
type: string
45+
required: False
46+
description: Commit SHA or branch to checkout e2e/cts tests.
3147

3248
sycl_toolchain_artifact:
3349
type: string
@@ -48,6 +64,23 @@ on:
4864
required: false
4965
default: "cl"
5066

67+
cts_testing_mode:
68+
description: |
69+
Testing mode to run SYCL-CTS in, can be either `full`, `build-only`
70+
or `run-only`. In `build-only` mode an artifact of the CTS binaries
71+
will be uploaded.
72+
type: string
73+
default: 'full'
74+
75+
sycl_cts_artifact:
76+
type: string
77+
default: ''
78+
required: False
79+
artifact_retention_days:
80+
description: 'E2E/SYCL-CTS binaries artifact retention period.'
81+
type: string
82+
default: 1
83+
5184
permissions: read-all
5285

5386
jobs:
@@ -86,6 +119,7 @@ jobs:
86119
- name: Register cleanup after job is finished
87120
uses: ./devops/actions/cleanup
88121
- uses: ./devops/actions/cached_checkout
122+
if: inputs.tests_selector == 'e2e'
89123
with:
90124
path: llvm
91125
ref: ${{ inputs.ref || github.sha }}
@@ -103,16 +137,19 @@ jobs:
103137
- name: Setup SYCL toolchain
104138
run: |
105139
echo "PATH=$env:GITHUB_WORKSPACE\\install\\bin;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
140+
echo "LIB=$env:GITHUB_WORKSPACE\\install\\lib;$env:LIB" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
106141
- run: |
107142
sycl-ls
108143
- run: |
109144
sycl-ls --verbose
110145
- name: Configure E2E with Level Zero target
146+
if: inputs.tests_selector == 'e2e'
111147
shell: cmd
112148
run: |
113149
mkdir build-e2e
114150
cmake -GNinja -B build-e2e -S.\llvm\sycl\test-e2e -DSYCL_TEST_E2E_TARGETS="level_zero:gpu" -DCMAKE_CXX_COMPILER="clang++" -DLEVEL_ZERO_LIBS_DIR="D:\\github\\level-zero_win-sdk\\lib" -DLEVEL_ZERO_INCLUDE="D:\\github\\level-zero_win-sdk\\include" -DLLVM_LIT="..\\llvm\\llvm\\utils\\lit\\lit.py"
115151
- name: Run End-to-End tests
152+
if: inputs.tests_selector == 'e2e'
116153
shell: bash
117154
run: |
118155
# Run E2E tests.
@@ -121,6 +158,18 @@ jobs:
121158
fi
122159
export LIT_OPTS="-v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests ${{ inputs.extra_lit_opts }}"
123160
cmake --build build-e2e --target check-sycl-e2e
161+
162+
- name: Run SYCL CTS Tests
163+
if: inputs.tests_selector == 'cts'
164+
uses: ./devops/actions/run-tests/windows/cts
165+
with:
166+
ref: ${{ inputs.tests_ref || 'main' }}
167+
extra_cmake_args: ${{ inputs.extra_cmake_args }}
168+
cts_testing_mode: ${{ inputs.cts_testing_mode }}
169+
sycl_cts_artifact: ${{ inputs.sycl_cts_artifact }}
170+
target_devices: ${{ inputs.target_devices }}
171+
retention-days: ${{ inputs.artifact_retention_days }}
172+
124173
- name: Detect hung tests
125174
if: always()
126175
shell: powershell
@@ -135,4 +184,4 @@ jobs:
135184
if: always()
136185
run: |
137186
rmdir /q /s install
138-
rmdir /q /s build-e2e
187+
if exist build-e2e rmdir /q /s build-e2e

devops/actions/run-tests/cts/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Run SYCL CTS tests'
1+
name: 'Run SYCL CTS tests on Linux'
22

33
inputs:
44
ref:
@@ -47,7 +47,7 @@ runs:
4747
run: |
4848
git -C khronos_sycl_cts submodule update --init
4949
- name: Build SYCL CTS tests
50-
if: inputs.sycl_cts_artifact == ''
50+
if: inputs.cts_testing_mode != 'run-only'
5151
shell: bash
5252
env:
5353
CMAKE_EXTRA_ARGS: ${{ inputs.extra_cmake_args }}
@@ -91,18 +91,18 @@ runs:
9191
if: always() && !cancelled() && inputs.cts_testing_mode == 'build-only'
9292
uses: actions/upload-artifact@v4
9393
with:
94-
name: sycl_cts_bin
94+
name: ${{ inputs.sycl_cts_artifact }}
9595
path: sycl_cts_bin.tar.zst
9696
retention-days: ${{ inputs.retention-days }}
9797

9898
- name: Download SYCL-CTS binaries
99-
if: inputs.sycl_cts_artifact != ''
99+
if: inputs.cts_testing_mode == 'run-only'
100100
uses: actions/download-artifact@v4
101101
with:
102102
name: ${{ inputs.sycl_cts_artifact }}
103103

104104
- name: Extract SYCL-CTS binaries
105-
if: inputs.sycl_cts_artifact != ''
105+
if: inputs.cts_testing_mode == 'run-only'
106106
shell: bash
107107
run: |
108108
mkdir -p build-cts/bin
@@ -124,7 +124,7 @@ runs:
124124
# these files may differ from each other, so when there is a pre-built set of
125125
# tests, we need to filter it according to the filter-file.
126126
- name: Filter SYCL CTS test categories
127-
if: inputs.sycl_cts_artifact != ''
127+
if: inputs.cts_testing_mode == 'run-only'
128128
shell: bash
129129
run: |
130130
cts_exclude_filter=""
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: 'Run SYCL CTS tests on Windows'
2+
3+
inputs:
4+
ref:
5+
description: "Commit SHA or branch to checkout tests"
6+
required: false
7+
default: "main"
8+
extra_cmake_args:
9+
required: false
10+
cts_testing_mode:
11+
required: true
12+
sycl_cts_artifact:
13+
require: false
14+
target_devices:
15+
required: true
16+
retention-days:
17+
required: false
18+
19+
runs:
20+
using: "composite"
21+
steps:
22+
- name: Checkout SYCL CTS tests
23+
if: inputs.cts_testing_mode != 'run-only'
24+
uses: ./devops/actions/cached_checkout
25+
with:
26+
path: khronos_sycl_cts
27+
repository: 'KhronosGroup/SYCL-CTS'
28+
ref: ${{ inputs.ref }}
29+
cache_path: "D:\\\\github\\\\_work\\\\repo_cache\\\\"
30+
- name: SYCL CTS GIT submodules init
31+
if: inputs.cts_testing_mode != 'run-only'
32+
shell: bash
33+
run: |
34+
git -C khronos_sycl_cts submodule update --init
35+
- name: Build SYCL CTS tests
36+
if: inputs.cts_testing_mode != 'run-only'
37+
shell: bash
38+
env:
39+
CMAKE_EXTRA_ARGS: ${{ inputs.extra_cmake_args }}
40+
run: |
41+
cts_exclude_filter=""
42+
# If CTS_TESTS_TO_BUILD is null - use filter
43+
if [ -z "$CTS_TESTS_TO_BUILD" ]; then
44+
if [ "${{ contains(inputs.cts_testing_mode, 'build-only') }}" = "true" ]; then
45+
cts_exclude_filter=$PWD/devops/cts_exclude_filter_compfails
46+
elif [ "${{ contains(inputs.target_devices, 'opencl:cpu') }}" = "true" ]; then
47+
cts_exclude_filter=$PWD/devops/cts_exclude_filter_OCL_CPU
48+
elif [ "${{ contains(inputs.target_devices, 'level_zero:gpu') }}" = "true" ]; then
49+
cts_exclude_filter=$PWD/devops/cts_exclude_filter_L0_GPU
50+
fi
51+
52+
# List excluded SYCL CTS categories:
53+
# SYCL_CTS_EXCLUDE_TEST_CATEGORIES - Optional file specifying a list
54+
# of test categories to be excluded from the build.
55+
echo "::group::Excluded test categories"
56+
cat $cts_exclude_filter
57+
echo "::endgroup::"
58+
fi
59+
60+
cmake -GNinja -B./build-cts -S./khronos_sycl_cts \
61+
-DSYCL_IMPLEMENTATION=DPCPP \
62+
-DSYCL_CTS_EXCLUDE_TEST_CATEGORIES="$cts_exclude_filter" \
63+
-DSYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS=OFF \
64+
-DDPCPP_INSTALL_DIR="$(dirname $(which clang++))/.." \
65+
-DCMAKE_CXX_COMPILER=cl \
66+
-DCMAKE_BUILD_TYPE=Release \
67+
$CMAKE_EXTRA_ARGS
68+
# Ignore errors so that if one category build fails others still have a
69+
# chance to finish and be executed at the run stage. Note that
70+
# "test_conformance" target skips building "test_all" executable.
71+
ninja -C build-cts -k0 $( [ -n "$CTS_TESTS_TO_BUILD" ] && echo "$CTS_TESTS_TO_BUILD" || echo "test_conformance")
72+
73+
- name: Pack SYCL-CTS binaries
74+
if: always() && !cancelled() && inputs.cts_testing_mode == 'build-only'
75+
shell: bash
76+
run: tar -I 'zstd -9' -cf sycl_cts_bin.tar.zst -C ./build-cts/bin .
77+
78+
- name: Upload SYCL-CTS binaries
79+
if: always() && !cancelled() && inputs.cts_testing_mode == 'build-only'
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: ${{ inputs.sycl_cts_artifact }}
83+
path: sycl_cts_bin.tar.zst
84+
retention-days: ${{ inputs.retention-days }}
85+
86+
- name: Download SYCL-CTS binaries
87+
if: inputs.cts_testing_mode == 'run-only'
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: ${{ inputs.sycl_cts_artifact }}
91+
92+
- name: Extract SYCL-CTS binaries
93+
if: inputs.cts_testing_mode == 'run-only'
94+
shell: bash
95+
run: |
96+
mkdir -p build-cts/bin
97+
tar -I 'zstd' -xf sycl_cts_bin.tar.zst -C build-cts/bin
98+
99+
- name: SYCL CTS List devices
100+
# Proceed with execution even if the 'build' step did not succeed.
101+
if: (always() && !cancelled()) && inputs.cts_testing_mode != 'build-only'
102+
shell: bash
103+
env:
104+
ONEAPI_DEVICE_SELECTOR: ${{ inputs.target_devices }}
105+
run: |
106+
./build-cts/bin/* --list-devices
107+
108+
# If the suite was built on another machine then the build contains the full
109+
# set of tests. We have special files to filter out some test categories,
110+
# see "devops/cts_exclude_filter_*". Each configuration has its own file, e.g.
111+
# there is "cts_exclude_filter_OCL_CPU" for opencl:cpu device. Therefore,
112+
# these files may differ from each other, so when there is a pre-built set of
113+
# tests, we need to filter it according to the filter-file.
114+
- name: Filter SYCL CTS test categories
115+
if: inputs.cts_testing_mode == 'run-only'
116+
shell: bash
117+
run: |
118+
cts_exclude_filter=""
119+
if [ "${{ contains(inputs.target_devices, 'opencl:cpu') }}" = "true" ]; then
120+
cts_exclude_filter=$PWD/devops/cts_exclude_filter_OCL_CPU
121+
elif [ "${{ contains(inputs.target_devices, 'level_zero:gpu') }}" = "true" ]; then
122+
cts_exclude_filter=$PWD/devops/cts_exclude_filter_L0_GPU
123+
fi
124+
125+
while IFS= read -r line; do
126+
if [[ $line != \#* ]]; then
127+
rm "./build-cts/bin/test_$line"
128+
fi
129+
done < "$cts_exclude_filter"
130+
131+
- name: Run SYCL CTS tests
132+
# Proceed with execution even if the previous two steps did not succeed.
133+
if: (always() && !cancelled()) && inputs.cts_testing_mode != 'build-only'
134+
env:
135+
ONEAPI_DEVICE_SELECTOR: ${{ inputs.target_devices }}
136+
# By-default GitHub actions execute the "run" shell script with -e option,
137+
# so the execution terminates if any command returns a non-zero status.
138+
# Since we're using a loop to run all test-binaries separately, some test
139+
# may fail and terminate the execution. Setting "shell" value to override
140+
# the default behavior.
141+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#custom-shell
142+
shell: bash {0}
143+
run: |
144+
# Run each test category separately so that
145+
# - crash on one would not affect others
146+
# - multiple tests could be run in parallel
147+
mkdir logs
148+
find build-cts/bin/ -type f -print | \
149+
xargs -t -I % -P 8 sh -c 'log=logs/$(basename %).log ; echo % >$log ; date >>$log ; timeout 60m % >>$log 2>&1 ; ret=$? ; echo "exit code: $ret" >>$log ; date >>$log ; exit $ret'
150+
ret=$?
151+
152+
for f in logs/* ; do
153+
echo "::group::$f"
154+
cat $f
155+
echo "::endgroup::"
156+
done
157+
158+
echo "::group::Fails:"
159+
grep 'exit code: [^0]' -r logs
160+
echo "::endgroup::"
161+
162+
grep 'exit code: [^0]' -r logs >> $GITHUB_STEP_SUMMARY
163+
164+
exit $ret

0 commit comments

Comments
 (0)