Skip to content

Commit a9ef82d

Browse files
authored
[CI] Add LLVM test suite jobs to reusable workflow (#5097)
Overview of changes: 1. Refactor cleanup into a separate action to make sure that's the last thing we do 2. Introduce new llvm_test_suite action, that downloads and executes tests from intel/llvm-test-suite 3. Add 4 new jobs: OCL gen9, L0 gen9, OCL x64, HIP AMD GPU 4. Make cuda and hip args optional 5. Upload LIT as artifact to make it usable from LLVM Test suite General idea: one build job compiles SYCL toolchain with all available backends enabled. Test jobs wait for build to complete and download pre-built artifact to run tests in parallel on various hardware. Amount of testing can be configured from outside by specifying `lts_config` parameter with one or more of the following values, separated with semicolon: `ocl_x64`, `ocl_gen9`, `l0_gen9`, `hip_amdgpu`. When tests are done, results from all the jobs are uploaded to lit_results artifact, which will contain all the logs in JSON format. Also, GitHub will automatically send notification to PR owner if one of the jobs has failed.
1 parent cc0d67f commit a9ef82d

File tree

5 files changed

+269
-11
lines changed

5 files changed

+269
-11
lines changed

.github/workflows/sycl_linux_build_and_test.yml

Lines changed: 152 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,30 @@ on:
4040
build_configure_extra_args:
4141
type: string
4242
required: false
43-
default: ""
43+
default: "--hip --hip-amd-arch=gfx906 --cuda"
4444
build_artifact_suffix:
4545
type: string
4646
required: true
47+
intel_drivers_image:
48+
type: string
49+
required: false
50+
default: "ghcr.io/intel/llvm/ubuntu2004_intel_drivers:latest"
51+
lts_config:
52+
type: string
53+
required: false
54+
default: ""
55+
gen9_runs_on:
56+
type: string
57+
required: false
58+
default: "gen9"
59+
amdgpu_image:
60+
type: string
61+
required: false
62+
default: "ghcr.io/intel/llvm/ubuntu2004_build:latest"
63+
amdgpu_runs_on:
64+
type: string
65+
required: false
66+
default: "amdgpu"
4767

4868
jobs:
4969
configure:
@@ -60,15 +80,20 @@ jobs:
6080
INPUTS="{
6181
\"cc\":\"gcc\",
6282
\"cxx\":\"g++\",
63-
\"build_runs_on\":\"sycl-precommit-linux\",
83+
\"build_runs_on\":\"build\",
6484
\"build_image\":\"ghcr.io/intel/llvm/ubuntu2004_build:latest\",
6585
\"build_github_cache\":\"false\",
6686
\"build_cache_root\":\"/__w/\",
6787
\"build_cache_suffix\":\"default\",
6888
\"build_cache_size\":\"2G\",
69-
\"build_configure_extra_args\":\"\",
89+
\"build_configure_extra_args\":\"--hip --hip-amd-arch=gfx906 --cuda\",
7090
\"build_artifact_suffix\":\"default\",
71-
\"build_upload_artifact\":\"false\"
91+
\"build_upload_artifact\":\"false\",
92+
\"intel_drivers_image\":\"ghcr.io/intel/llvm/ubuntu2004_intel_drivers:latest\",
93+
\"amdgpu_image\":\"ghcr.io/intel/llvm/ubuntu2004_build:latest\",
94+
\"lts_config\":\"ocl_x64;hip_amdgpu\",
95+
\"gen9_runs_on\":\"gen9\",
96+
\"amdgpu_runs_on\":\"amdgpu\"
7297
}"
7398
fi
7499
INPUTS="${INPUTS//'%'/'%25'}"
@@ -77,7 +102,7 @@ jobs:
77102
echo "::set-output name=params::$INPUTS"
78103
echo "$INPUTS"
79104
build:
80-
name: Build SYCL toolchain
105+
name: Build + LIT
81106
needs: configure
82107
runs-on: ${{ fromJSON(needs.configure.outputs.params).build_runs_on }}
83108
container:
@@ -87,6 +112,8 @@ jobs:
87112
- uses: actions/checkout@v2
88113
with:
89114
path: src
115+
- name: Register cleanup after job is finished
116+
uses: ./src/devops/actions/cleanup
90117
- name: Setup Cache
91118
uses: actions/cache@v2
92119
if: ${{ steps.parameters.build_github_cache }}
@@ -111,10 +138,11 @@ jobs:
111138
cd $GITHUB_WORKSPACE/build
112139
python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \
113140
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release \
114-
--ci-defaults $ARGS --cuda --hip --hip-amd-arch="gfx906" \
141+
--ci-defaults $ARGS \
115142
--cmake-opt="-DLLVM_CCACHE_BUILD=ON" \
116143
--cmake-opt="-DLLVM_CCACHE_DIR=$CACHE_ROOT/build_cache_$CACHE_SUFFIX" \
117144
--cmake-opt="-DLLVM_CCACHE_MAXSIZE=$CACHE_SIZE" \
145+
--cmake-opt="-DLLVM_INSTALL_UTILS=ON" \
118146
--cmake-opt="-DSYCL_PI_TESTS=OFF"
119147
- name: Compile
120148
run: cmake --build $GITHUB_WORKSPACE/build
@@ -157,15 +185,128 @@ jobs:
157185
cmake --build $GITHUB_WORKSPACE/build --target utils/llvm-lit/install
158186
cmake --build $GITHUB_WORKSPACE/build --target install-clang-format
159187
cmake --build $GITHUB_WORKSPACE/build --target install-clang-tidy
188+
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-size
189+
# TODO this should be resolved in CMakeLists.txt
190+
cmake --build $GITHUB_WORKSPACE/build --target install-lld || echo "skipped"
160191
161-
- name: Pack
192+
- name: Pack toolchain
162193
run: tar -cJf llvm_sycl.tar.xz -C $GITHUB_WORKSPACE/build/install .
163-
- name: Upload artifacts
194+
- name: Pack LIT
195+
run: tar -cJf lit.tar.xz -C $GITHUB_WORKSPACE/src/llvm/utils/lit .
196+
- name: Upload toolchain
164197
uses: actions/upload-artifact@v1
165198
with:
166199
name: sycl_linux_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
167200
path: llvm_sycl.tar.xz
168-
- name: Cleanup
169-
if: always()
170-
run: rm -rf $GITHUB_WORKSPACE/*
201+
- name: Upload LIT
202+
uses: actions/upload-artifact@v1
203+
with:
204+
name: sycl_lit_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
205+
path: lit.tar.xz
171206

207+
llvm_test_suite_l0_gen9:
208+
name: L0 GEN9 Test Suite
209+
needs: [build, configure]
210+
if: ${{ contains(fromJSON(needs.configure.outputs.params).lts_config, 'l0_gen9') }}
211+
runs-on: ${{ fromJSON(needs.configure.outputs.params).gen9_runs_on }}
212+
container:
213+
image: ${{ fromJSON(needs.configure.outputs.params).intel_drivers_image }}
214+
options: -u 1001 --device=/dev/dri
215+
steps:
216+
- uses: actions/checkout@v2
217+
with:
218+
path: llvm
219+
- name: Register cleanup after job is finished
220+
uses: ./llvm/devops/actions/cleanup
221+
- uses: ./llvm/devops/actions/llvm_test_suite
222+
name: Run LLVM Test Suite
223+
with:
224+
# TODO allow custom test references
225+
test_ref: 'intel'
226+
sycl_artifact: sycl_linux_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
227+
sycl_archive: llvm_sycl.tar.xz
228+
lit_artifact: sycl_lit_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
229+
lit_archive: lit.tar.xz
230+
check_sycl_all: 'level_zero:gpu,host'
231+
results_name_suffix: l0_gpu_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
232+
cmake_args: '-DGPU_AOT_TARGET_OPTS="\\\"-device gen9\\\""'
233+
234+
llvm_test_suite_ocl_gen9:
235+
name: OCL GEN9 Test Suite
236+
needs: [build, configure]
237+
if: ${{ contains(fromJSON(needs.configure.outputs.params).lts_config, 'ocl_gen9') }}
238+
runs-on: ${{ fromJSON(needs.configure.outputs.params).gen9_runs_on }}
239+
container:
240+
image: ${{ fromJSON(needs.configure.outputs.params).intel_drivers_image }}
241+
options: -u 1001 --device=/dev/dri
242+
steps:
243+
- uses: actions/checkout@v2
244+
with:
245+
path: llvm
246+
- name: Register cleanup after job is finished
247+
uses: ./llvm/devops/actions/cleanup
248+
- uses: ./llvm/devops/actions/llvm_test_suite
249+
name: Run LLVM Test Suite
250+
with:
251+
# TODO allow custom test references
252+
test_ref: 'intel'
253+
sycl_artifact: sycl_linux_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
254+
sycl_archive: llvm_sycl.tar.xz
255+
lit_artifact: sycl_lit_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
256+
lit_archive: lit.tar.xz
257+
check_sycl_all: 'opencl:gpu,host'
258+
results_name_suffix: ocl_gpu_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
259+
cmake_args: '-DGPU_AOT_TARGET_OPTS="\\\"-device gen9\\\""'
260+
261+
llvm_test_suite_ocl_x64:
262+
name: OCL x64 Test Suite
263+
needs: [build, configure]
264+
if: ${{ contains(fromJSON(needs.configure.outputs.params).lts_config, 'ocl_x64') }}
265+
runs-on: ${{ fromJSON(needs.configure.outputs.params).gen9_runs_on }}
266+
container:
267+
image: ${{ fromJSON(needs.configure.outputs.params).intel_drivers_image }}
268+
options: -u 1001
269+
steps:
270+
- uses: actions/checkout@v2
271+
with:
272+
path: llvm
273+
- name: Register cleanup after job is finished
274+
uses: ./llvm/devops/actions/cleanup
275+
- uses: ./llvm/devops/actions/llvm_test_suite
276+
name: Run LLVM Test Suite
277+
with:
278+
# TODO allow custom test references
279+
test_ref: 'intel'
280+
sycl_artifact: sycl_linux_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
281+
sycl_archive: llvm_sycl.tar.xz
282+
lit_artifact: sycl_lit_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
283+
lit_archive: lit.tar.xz
284+
check_sycl_all: 'opencl:cpu,host'
285+
results_name_suffix: ocl_x64_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
286+
287+
llvm_test_suite_hip_amdgpu:
288+
name: HIP AMD GPU Test Suite
289+
needs: [build, configure]
290+
if: ${{ contains(fromJSON(needs.configure.outputs.params).lts_config, 'hip_amdgpu') }}
291+
runs-on: ${{ fromJSON(needs.configure.outputs.params).amdgpu_runs_on }}
292+
container:
293+
image: ${{ fromJSON(needs.configure.outputs.params).amdgpu_image }}
294+
options: --device=/dev/dri --device=/dev/kfd
295+
steps:
296+
- uses: actions/checkout@v2
297+
with:
298+
path: llvm
299+
- name: Register cleanup after job is finished
300+
uses: ./llvm/devops/actions/cleanup
301+
- uses: ./llvm/devops/actions/llvm_test_suite
302+
name: Run LLVM Test Suite
303+
with:
304+
# TODO allow custom test references
305+
test_ref: 'intel'
306+
sycl_artifact: sycl_linux_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
307+
sycl_archive: llvm_sycl.tar.xz
308+
lit_artifact: sycl_lit_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
309+
lit_archive: lit.tar.xz
310+
check_sycl_all: 'hip:gpu,host'
311+
results_name_suffix: hip_amdgpu_${{ fromJSON(needs.configure.outputs.params).build_artifact_suffix }}
312+
cmake_args: '-DHIP_PLATFORM="AMD" -DAMD_ARCH="gfx1031"'

devops/actions/cleanup/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: 'Cleanup'
2+
description: 'Cleanup work directory upon job finish'
3+
4+
runs:
5+
using: 'node12'
6+
main: 'dummy.js'
7+
post: 'cleanup.js'
8+

devops/actions/cleanup/cleanup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const path = process.env.GITHUB_WORKSPACE + '/*';
2+
console.log('Cleaning ' + path)
3+
require('child_process').execSync('rm -rf ' + path);

devops/actions/cleanup/dummy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('setup cleanup');
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: 'Run llvm-test-suite testing'
2+
description: 'Run E2E SYCL tests from llvm-test-suite'
3+
inputs:
4+
test_ref:
5+
description: 'commit-ish identifier for test repo'
6+
required: true
7+
default: 'intel'
8+
sycl_artifact:
9+
description: 'Name of the artifact, that contains compiler toolchain'
10+
required: true
11+
sycl_archive:
12+
description: 'Name of SYCL toolchain archive file'
13+
required: false
14+
default: 'llvm_sycl.tar.xz'
15+
lit_artifact:
16+
description: 'Name of the artifact, that contains LIT tool'
17+
required: true
18+
lit_archive:
19+
description: 'Name of LIT archive file'
20+
required: false
21+
default: 'lit.tar.xz'
22+
results_name_suffix:
23+
description: 'Name suffix of the results artifact'
24+
required: true
25+
check_sycl_all:
26+
description: 'List of SYCL backends with set of target devices per each to be tested iteratively'
27+
required: true
28+
cmake_args:
29+
description: 'Extra arguments to cmake command'
30+
required: false
31+
32+
post-if: false
33+
runs:
34+
using: "composite"
35+
steps:
36+
- name: Checkout LLVM Test Suite
37+
uses: actions/checkout@v2
38+
with:
39+
path: llvm_test_suite
40+
repository: 'intel/llvm-test-suite'
41+
ref: ${{ inputs.test_ref }}
42+
- name: Download compiler toolchain
43+
uses: actions/download-artifact@v2
44+
with:
45+
name: ${{ inputs.sycl_artifact }}
46+
- name: Extract SYCL toolchain
47+
shell: bash
48+
run: |
49+
mkdir toolchain
50+
tar -xf ${{ inputs.sycl_archive }} -C toolchain
51+
rm -f ${{ inputs.sycl_archive }}
52+
- name: Download LIT
53+
uses: actions/download-artifact@v2
54+
with:
55+
name: ${{ inputs.lit_artifact }}
56+
- name: Extract LIT
57+
shell: bash
58+
run: |
59+
mkdir lit
60+
ls -la
61+
tar -xf ${{ inputs.lit_archive }} -C lit
62+
rm -f ${{ inputs.lit_archive }}
63+
- name: Configure
64+
shell: bash
65+
run: |
66+
echo "::group::CMake configuration"
67+
mkdir build
68+
export PATH=$PWD/toolchain/bin/:$PATH
69+
cmake -GNinja -B./build -S./llvm_test_suite -DTEST_SUITE_SUBDIRS=SYCL -DCHECK_SYCL_ALL="${{ inputs.check_sycl_all }}" -DCMAKE_CXX_COMPILER="$PWD/toolchain/bin/clang++" -DTEST_SUITE_LIT="$PWD/lit/lit.py" ${{ inputs.cmake_args }}
70+
echo "::endgroup::"
71+
- name: Run testing
72+
shell: bash
73+
run: |
74+
export LD_LIBRARY_PATH=$PWD/toolchain/lib/:$LD_LIBRARY_PATH
75+
export PATH=$PWD/toolchain/bin/:$PATH
76+
# TODO make this part of container build
77+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/hip/lib/:/opt/rocm/lib
78+
export LIT_OPTS="-v --no-progress-bar --show-unsupported --time-tests -o $PWD/build/results_${{ inputs.results_name_suffix }}.json"
79+
if [ -e /runtimes/oneapi-tbb/env/vars.sh ]; then
80+
source /runtimes/oneapi-tbb/env/vars.sh;
81+
fi
82+
echo "::group::sycl-ls --verbose"
83+
sycl-ls --verbose
84+
echo "::endgroup::"
85+
echo "::group::SYCL_PI_TRACE=-1 sycl-ls"
86+
echo $LD_LIBRARY_PATH
87+
ldd $PWD/toolchain/lib/libpi_hip.so
88+
SYCL_PI_TRACE=-1 sycl-ls
89+
echo "::endgroup::"
90+
cd build
91+
ninja check-sycl-all
92+
- name: Upload test results
93+
uses: actions/upload-artifact@v1
94+
if: always()
95+
with:
96+
name: lit_results
97+
path: build/results_${{ inputs.results_name_suffix }}.json
98+
- name: Cleanup
99+
shell: bash
100+
if: always()
101+
run: |
102+
rm -rf toolchain
103+
rm -rf lit
104+
rm -rf build
105+
rm -rf llvm_test_suite

0 commit comments

Comments
 (0)