Skip to content

Commit 31dc4ac

Browse files
committed
Change planned testing to build llvm and run all tests.
The current system was very limited to being able to cope with updates of llvm. It also did not allow us to run all testing on one llvm or the other. Additionally, it lacked flexibility. Build llvm as an artefact before testing. Option to support using caching on a per llvm basis - but unlike before this will build it if it does not find it. planned_testing_caller.yml has been changed to call both internal tests (run_ock_internal_tests.yml renamed from run_pr_tests.yml) and external tests (run_ock_external_tests.yml, renamed from planned_testing.yml). It has also been changed so it can only be run via being called. It allows a wide variety of inputs so different variants of the pipeline can be run. At the top of the planned testing change are per llvm callers, planned_testing_caller_19.yml and planned_testing_caller_20.yml. These do little more than call planned_testing.yml with different llvms on a cron job. They are not expected to change much. llvm_source is passed down to the run_* workflows, and has a run id option which means it downloads it from that run id. If it is the same workflow id as being run on, then it will use download-artifact, otherwise it will use gh. This additionally switches the overnight testing to llvm 19 and llvm 20 from a previous 18/19 mix, run on different nights. Some extra flexibility has also been added for which runners are used as it was difficult to test with the conflict on available runners.
1 parent 38bd5af commit 31dc4ac

16 files changed

+589
-87
lines changed
+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: build-llvm
2+
description: Action to build llvm artifacts
3+
4+
inputs:
5+
os:
6+
type: string
7+
description: 'operating system, one of ubuntu-22.04, ubuntu-24.04 or windows-2019'
8+
default: 'ubuntu-22.04'
9+
arch:
10+
type: string
11+
description: 'architecture, one of x86_64, aarch64, x86 or riscv64'
12+
default: 'x86_64'
13+
build_type:
14+
type: string
15+
description: 'build type, one of Release, RelAssert (default RelAssert)'
16+
default: RelAssert
17+
llvm_version:
18+
type: string
19+
description: llvm version - used for naming purposes e.g. 19,20,main"
20+
default: ""
21+
llvm_branch:
22+
type: string
23+
description: "The actual llvm branch to check out e.g. release/19.x"
24+
use_github_cache:
25+
type: boolean
26+
description: "Whether to use caching - will rebuild if not existing"
27+
default: false
28+
29+
runs:
30+
using: "composite"
31+
steps:
32+
- name: Setup Windows
33+
if: startsWith(runner.os, 'Windows')
34+
uses: llvm/actions/setup-windows@main
35+
with:
36+
arch: amd64
37+
- name: Cache llvm
38+
id: cache
39+
if: inputs.use_github_cache == 'true'
40+
uses: actions/cache@v4
41+
with:
42+
path:
43+
llvm_install/**
44+
key: llvm-${{ inputs.os }}-${{ inputs.arch }}-v${{ inputs.llvm_version }}-${{ inputs.build_type }}
45+
46+
- name: Checkout repo llvm
47+
if: inputs.use_github_cache == 'false' || steps.cache.outputs.cache-hit != 'true'
48+
uses: actions/checkout@v4
49+
with:
50+
repository: llvm/llvm-project
51+
ref: ${{inputs.llvm_branch}}
52+
path: llvm-project
53+
54+
- name: Install Ninja
55+
uses: llvm/actions/install-ninja@a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main branch
56+
57+
- name: install aarch64 build tools and set flags
58+
shell: bash
59+
if: inputs.arch == 'aarch64' && (inputs.use_github_cache == 'false' || steps.cache.outputs.cache-hit != 'true')
60+
run: |
61+
sudo apt-get install --yes g++-aarch64-linux-gnu
62+
echo "ARCH_FLAGS=-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/platform/arm-linux/aarch64-toolchain.cmake -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu" > $GITHUB_ENV
63+
64+
- name: install riscv64 build tools and set flags
65+
shell: bash
66+
if: inputs.arch == 'riscv64' && (inputs.use_github_cache == 'false' || steps.cache.outputs.cache-hit != 'true')
67+
run: |
68+
sudo apt-get install --yes g++-riscv64-linux-gnu
69+
echo "ARCH_FLAGS=-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/platform/riscv64-linux/riscv64-gcc-toolchain.cmake -DLLVM_HOST_TRIPLE=riscv64-unknown-linux-gnu" > $GITHUB_ENV
70+
71+
- name: install x86 build tools and set flags
72+
shell: bash
73+
if: inputs.arch == 'x86' && (inputs.use_github_cache == 'false' || steps.cache.outputs.cache-hit != 'true')
74+
run: |
75+
sudo dpkg --add-architecture i386
76+
sudo apt-get update
77+
sudo apt-get install --yes gcc-multilib g++-multilib libc6-dev:i386 lib32tinfo-dev
78+
echo "ARCH_FLAGS=-DLLVM_BUILD_32_BITS=ON -DLIBXML2_LIBRARIES=IGNORE -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_HOST_TRIPLE=i686-unknown-linux-gnu" > $GITHUB_ENV
79+
80+
- name: Run cmake
81+
if: inputs.use_github_cache == 'false' || steps.cache.outputs.cache-hit != 'true'
82+
shell: ${{ startsWith(runner.os, 'Windows') && 'pwsh' || 'bash' }}
83+
run:
84+
cmake llvm-project/llvm
85+
-DLLVM_ENABLE_DIA_SDK=OFF
86+
-DCMAKE_INSTALL_PREFIX=llvm_install
87+
-DLLVM_ENABLE_ZLIB=FALSE
88+
-DLLVM_ENABLE_ZSTD=FALSE
89+
-DLLVM_ENABLE_Z3_SOLVER=FALSE
90+
-DLLVM_ENABLE_PROJECTS="clang;lld"
91+
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64;RISCV"
92+
-Bbuild
93+
-GNinja
94+
-DCMAKE_BUILD_TYPE=Release
95+
${{ inputs.build_type == 'RelAssert' && '-DLLVM_ENABLE_ASSERTIONS=ON' || '' }}
96+
${{ !startsWith(runner.os, 'Windows') && '-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON' || '' }}
97+
$ARCH_FLAGS
98+
99+
- name: Run build on llvm
100+
if: inputs.use_github_cache == 'false' || steps.cache.outputs.cache-hit != 'true'
101+
shell: ${{ startsWith(runner.os, 'Windows') && 'pwsh' || 'bash' }}
102+
run:
103+
cmake --build build --target install
104+
105+
- name: Copy lit tools
106+
if: inputs.use_github_cache == 'false' || steps.cache.outputs.cache-hit != 'true'
107+
shell: bash
108+
run: |
109+
cp build/bin/FileCheck* llvm_install/bin
110+
cp build/bin/not* llvm_install/bin
111+
112+
- name: upload artefact
113+
uses: ./.github/actions/upload_artifact
114+
with:
115+
name: llvm-${{ inputs.os }}-${{ inputs.arch }}-${{ inputs.llvm_version }}-${{ inputs.build_type }}
116+
path: llvm_install
117+
needs_tar: ${{ startsWith(runner.os, 'Windows') && 'false' || 'true' }}
118+
retention-days: 7

.github/actions/do_build_ock_artefact/action.yml

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ inputs:
77
llvm_version:
88
description: 'llvm version we want to use (18-19)'
99
default: '19'
10+
llvm_source:
11+
required: true
12+
description: 'source to get llvm from - one of install, cache or workflow id'
13+
type: string
1014
target:
1115
description: 'target architecture'
1216
download_ock_artefact:
@@ -40,6 +44,8 @@ runs:
4044
&& 'none' || steps.calc_vars.outputs.arch }}
4145
os: ${{ contains(inputs.target, 'windows') && 'windows' || 'ubuntu' }}
4246
ubuntu_version: ${{ contains(inputs.target, 'riscv64') && '24.04' || '22.04' }}
47+
llvm_source: ${{ inputs.llvm_source }}
48+
github_token: ${{ env.GH_TOKEN }}
4349

4450
- name: build native ock - x86_64 and aarch64
4551
if: ( steps.calc_vars.outputs.arch == 'x86_64' || steps.calc_vars.outputs.arch == 'aarch64' )
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: download artifact
2+
description: Download an artifact, either through the action or using gh, depending which workflow it came from.
3+
4+
inputs:
5+
name:
6+
description: 'name of artifact to download'
7+
default: "none"
8+
path:
9+
description: 'path to download to - currently must be a directory if needs_tar is true'
10+
default: "none"
11+
token:
12+
description: 'gh token for downloading artifacts - only needed for gh'
13+
default: 'TOKEN_NOT_SET'
14+
run_id:
15+
description: 'The run_id for the workflow the artifact came from'
16+
default: 'RUN_ID_UNKNOWN'
17+
needs_tar:
18+
description: 'The archive is tarred so we need to untar it after downloading it'
19+
type: boolean
20+
default: false
21+
22+
runs:
23+
using: "composite"
24+
steps:
25+
# The normal case is to use the github action
26+
- name: download using download_artifact
27+
if: inputs.run_id == github.run_id
28+
uses: actions/download-artifact@v4
29+
with:
30+
name: ${{ inputs.name }}
31+
path: ${{ inputs.needs_tar == 'true' && github.workspace || inputs.path }}
32+
33+
# The run_id is not from this workflow, we need to use gh
34+
- name: download using gh run download
35+
if: inputs.run_id != github.run_id
36+
shell: bash
37+
run: |
38+
git config --global --add safe.directory $PWD
39+
GH_TOKEN=${{ inputs.token }} gh run download ${{ inputs.run_id }} -n ${{ inputs.name }} -D ${{ inputs.needs_tar == 'true' && github.workspace || inputs.path }}
40+
41+
- name: untar artefact
42+
if: inputs.needs_tar == 'true'
43+
shell: bash
44+
run: |
45+
# Everything goes under the new path
46+
mkdir -p ${{ inputs.path }}
47+
tar xf tmp.tar -C ${{ inputs.path }}

.github/actions/run_opencl_cts/action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ inputs:
99
test_type:
1010
description: 'quick | full'
1111
default: "quick"
12+
llvm_version:
13+
description: 'llvm major version (e.g 19,20, main) - to be used for llvm specific fails'
14+
required: true
1215

1316
runs:
1417
using: "composite"
@@ -37,7 +40,7 @@ runs:
3740
# Build override file, all is done first, then the target specific.
3841
# The last file can overwrite previous overrides.
3942
python3 scripts/testing/create_override_csv.py -d .github/opencl_cts \
40-
-k ${{ inputs.target }} \
43+
-k ${{ inputs.target }} llvm_${{ inputs.llvm_version }} \
4144
-o override_combined.csv -vv
4245
4346
# $CTS_FILTER ignores certain test, so is treated differently to temporary fails.

.github/actions/run_sycl_cts/action.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ description: run sycl cts
44
inputs:
55
target:
66
description: 'target architecture'
7+
llvm_version:
8+
description: 'llvm major version (e.g 19,20, main) - to be used for llvm specific fails'
9+
required: true
710

811
runs:
912
using: "composite"
@@ -67,11 +70,9 @@ runs:
6770
export ONEAPI_DEVICE_SELECTOR=opencl:0
6871
export CTS_CSV_FILE=$GITHUB_WORKSPACE/scripts/testing/sycl-cts.csv
6972
70-
# $CTS_FILTER ignores certain test, so is treated differently to temporary fails.
71-
7273
# Build override file, all is done first, then the target specific. The last file can overwrite previous overrides.
7374
python3 scripts/testing/create_override_csv.py -d .github/sycl_cts/ \
74-
-k opencl ${{ inputs.target }} \
75+
-k opencl ${{ inputs.target }} llvm_${{ inputs.llvm_version }} \
7576
-o override_combined.csv -vv
7677
7778
exitcode=0

.github/actions/setup_build/action.yml

+28-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ inputs:
2424
description: 'Cross compilation architecture from: x86, arm, aarch64, riscv64. Default: "none" (no cross compile), will auto fetch native arch'
2525
default: "none"
2626
llvm_source:
27-
description: 'source to get llvm from - one of install or cache'
27+
description: 'source to get llvm from - one of install, cache or workflow id'
2828
default: "cache"
29+
github_token:
30+
description: "gh token for downloading artifacts"
31+
default: 'TOKEN_NOT_SET'
32+
2933

3034
runs:
3135
# We don't want a new docker just a list of steps, so mark as composite
@@ -95,18 +99,40 @@ runs:
9599
96100
ln -s /usr/lib/llvm-${{ inputs.llvm_version }} llvm_install
97101
102+
- name: download llvm native
103+
if: inputs.llvm_source != 'install' && inputs.llvm_source != 'cache'
104+
uses: ./.github/actions/download_artifact
105+
with:
106+
name: llvm-${{ inputs.os }}-${{ steps.set_llvm_key.outputs.key_version }}-${{ steps.set_llvm_key.outputs.key_native_arch }}-${{ inputs.llvm_version }}-${{ inputs.llvm_build_type }}
107+
run_id: ${{ inputs.llvm_source }}
108+
token: ${{ inputs.github_token }}
109+
path: llvm_install
110+
needs_tar: ${{ startsWith(runner.os, 'Windows') && 'false' || 'true' }}
111+
98112
- shell: bash
99113
if: inputs.cross_arch != 'none'
100114
run: mv llvm_install llvm_install_native
101115

102-
- name: load llvm cross
116+
# This is deprecated and will be removed soon.
117+
- name: load llvm cross cache
103118
if: inputs.cross_arch != 'none' && inputs.llvm_source == 'cache'
104119
uses: actions/cache/restore@v4
105120
with:
106121
path: llvm_install/**
107122
key: llvm-${{ inputs.os }}-${{ steps.set_llvm_key.outputs.key_version }}-${{ steps.set_llvm_key.outputs.key_arch }}-v${{ inputs.llvm_version }}-${{ inputs.llvm_build_type }}
108123
fail-on-cache-miss: true
109124

125+
- name: load llvm cross download
126+
if: inputs.cross_arch != 'none' && inputs.llvm_source != 'cache' && inputs.llvm_source != 'install'
127+
128+
uses: ./.github/actions/download_artifact
129+
with:
130+
name: llvm-${{ inputs.os }}-${{ steps.set_llvm_key.outputs.key_version }}-${{ steps.set_llvm_key.outputs.key_arch }}-${{ inputs.llvm_version }}-${{ inputs.llvm_build_type }}
131+
run_id: ${{ inputs.llvm_source }}
132+
token: ${{ inputs.github_token }}
133+
path: llvm_install
134+
needs_tar: ${{ startsWith(runner.os, 'Windows') && 'false' || 'true' }}
135+
110136
# note the PR testing usage should set 'save' to false, to avoid PR testing creating new caches on a branch
111137
- name: Setup ccache
112138
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: upload artifact
2+
description: upload an artifact, tarring first if necessary
3+
4+
inputs:
5+
name:
6+
description: 'name of artifact to download'
7+
type: string
8+
default: "none"
9+
needs_tar:
10+
description: 'dictates whether we tar it first'
11+
type: boolean
12+
default: false
13+
retention-days:
14+
description: 'number of days to retain'
15+
type: string
16+
default: 7
17+
path:
18+
description: 'path to upload'
19+
type: string
20+
required: true
21+
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: tar artefacts
26+
shell: bash
27+
if: inputs.needs_tar == 'true'
28+
run: |
29+
tar cf tmp.tar -C ${{ inputs.path }} .
30+
31+
- name: upload artifact
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: ${{ inputs.name }}
35+
path: ${{ inputs.needs_tar == 'true' && 'tmp.tar' || inputs.path }}
36+
retention-days: ${{ inputs.retention-days }}

.github/sycl_cts/override_all.csv

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
SYCL_CTS,test_math_builtin_api "math_builtin_float_base_*",Xfail
2-
SYCL_CTS,test_math_builtin_api "math_builtin_float_double_*",Xfail
31
SYCL_CTS,test_event "event::wait does not report asynchronous errors",Mayfail
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SYCL_CTS,test_math_builtin_api "math_builtin_float_base_*",Xfail
2+
SYCL_CTS,test_math_builtin_api "math_builtin_float_double_*",Xfail
3+
SYCL_CTS,test_event "event::wait does not report asynchronous errors",Mayfail
4+
SYCL_CTS,test_language,Xfail

0 commit comments

Comments
 (0)