Skip to content

Commit d544c20

Browse files
[SYCL] Add ABI symbols tests against release branch
Before this PR our approach was to have `sycl_symbols_[linux|windows]-sycl.dump` files in trunk that always capture the current state of symbols exported from `libsycl.so`/`sycl.dll` We highlighted added/removed symbols separately and considered "added" symbols as being OK while "removed" meant an ABI break. That works fine by is a bit too verbose. Also, not all "removed" are bad. If we've just added a symbol in a previous commit and are reverting it now, the backward ABI compatibility against the last release isn't being broken. I don't think we promise any backward compatibility between arbitrary builds in the trunk (`origin/sycl`), only the compatibility against previous official minor releases with the same major version. This PR adds two more tests that track what we promise better. I've modified our `sycl/tools/abi_check.py` to allow ignoring "added" symbols and only check against symbols that are being removed. I've also copied `sycl_symbols*.dump` from the `sycl-rel-6_3` branch into the trunk under `sycl_symbols*-sycl-rel-6_3.dump` names and started running the testing for them in that new mode. Those **must** never fail, unless we're incrementing the major version or the break is intentional and approved (hence dedicated `CODEOWNERS` who can approve such changes). I'm also adding a step to the `sycl-nightly.yml` workflow to ensure that those copies in trunk match the release branch. That would be handy if we were to cherry-pick some changes that add new symbols to the ongoing release.
1 parent 6927aef commit d544c20

File tree

6 files changed

+8704
-283
lines changed

6 files changed

+8704
-283
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,4 @@ sycl/test-e2e/ThreadSanitizer/ @intel/dpcpp-sanitizers-review
226226

227227
# ABI compatibility
228228
devops/compat_ci_exclude.sycl-rel-** @gmlueck @xtian-github
229+
sycl/test/abi/*sycl-rel*.dump @gmlueck @xtian-github

.github/workflows/sycl-linux-build.yml

Lines changed: 14 additions & 280 deletions
Original file line numberDiff line numberDiff line change
@@ -87,292 +87,26 @@ on:
8787
value: ${{ jobs.build.outputs.toolchain_decompress_command }}
8888

8989
workflow_dispatch:
90-
inputs:
91-
changes:
92-
description: 'Filter matches for the changed files in the PR'
93-
type: choice
94-
options:
95-
- "[]"
96-
- '[llvm, clang, sycl, llvm_spirv, xptifw, libclc]'
97-
build_image:
98-
type: choice
99-
options:
100-
- 'ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest'
101-
cc:
102-
type: choice
103-
options:
104-
- gcc
105-
cxx:
106-
type: choice
107-
options:
108-
- g++
109-
build_configure_extra_args:
110-
type: choice
111-
options:
112-
- "--hip --cuda --native_cpu"
113-
# Cache properties need to match CC/CXX/CMake opts. Any additional choices
114-
# would need extra care.
115-
build_cache_root:
116-
type: choice
117-
options:
118-
- "/__w/"
119-
build_cache_suffix:
120-
type: choice
121-
options:
122-
- "default"
123-
124-
retention-days:
125-
type: choice
126-
options:
127-
- 3
128-
129-
toolchain_artifact:
130-
type: choice
131-
options:
132-
- "sycl_linux_default"
13390

13491
permissions: read-all
13592

13693
jobs:
137-
build:
138-
name: Build + LIT
94+
check_abi_symbols:
95+
name: Check ABI symbols tests match release branch
13996
runs-on: [Linux, build]
140-
container:
141-
image: ${{ inputs.build_image }}
142-
options: -u 1001:1001
143-
outputs:
144-
build_conclusion: ${{ steps.build.conclusion }}
145-
toolchain_artifact_filename: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
146-
toolchain_decompress_command: ${{ steps.artifact_info.outputs.DECOMPRESS }}
147-
env:
148-
CCACHE_DIR: ${{ inputs.build_cache_root }}/build_cache_${{ inputs.build_cache_suffix }}
149-
CCACHE_MAXSIZE: 8G
97+
if: github.repository == 'intel/llvm'
98+
container: ghcr.io/intel/llvm/ubuntu2404_build
15099
steps:
151-
- name: Deduce artifact archive params
152-
# To reduce number of inputs parameters that is limited for manual triggers.
153-
id: artifact_info
154-
run: |
155-
NAME="${{inputs.toolchain_artifact_filename}}"
156-
if [ -z "$NAME" ]; then
157-
NAME=llvm_sycl.tar.zst
158-
fi
159-
echo ARCHIVE_NAME="$NAME" >> $GITHUB_OUTPUT
160-
if [ "${NAME}" != "${NAME%.tar.gz}" ]; then
161-
echo COMPRESS="gzip" >> $GITHUB_OUTPUT
162-
echo DECOMPRESS="gunzip" >> $GITHUB_OUTPUT
163-
elif [ "${NAME}" != "${NAME%.tar.zst}" ]; then
164-
echo COMPRESS="zstd -9" >> $GITHUB_OUTPUT
165-
echo DECOMPRESS="zstd" >> $GITHUB_OUTPUT
166-
else
167-
echo "Unsupported extension"
168-
exit 1
169-
fi
170100
- uses: actions/checkout@v4
171101
with:
172102
sparse-checkout: |
173-
devops/actions
174-
# Cleanup will be run after all actions are completed.
175-
- name: Register cleanup after job is finished
176-
uses: ./devops/actions/cleanup
177-
- uses: ./devops/actions/cached_checkout
178-
with:
179-
path: src
180-
ref: ${{ inputs.build_ref || github.sha }}
181-
cache_path: "/__w/repo_cache/"
182-
- name: Setup oneAPI env
183-
if: ${{ inputs.cc == 'icx' || inputs.cxx == 'icpx' }}
184-
uses: ./devops/actions/setup_linux_oneapi_env
185-
- name: Configure
186-
# Setting `CMAKE_INSTALL_PREFIX` is important because that's the location
187-
# where `sycl-linux-run-tests.yml` unpacks the toolchain to. That location
188-
# *must* match between build-only and run-only E2E tests runs and we might
189-
# be creating pre-built E2E tests' binaries in this workflow.
190-
env:
191-
CC: ${{ inputs.cc }}
192-
CXX: ${{ inputs.cxx }}
193-
CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs"
194-
run: |
195-
mkdir -p $CCACHE_DIR
196-
mkdir -p $GITHUB_WORKSPACE/build
197-
cd $GITHUB_WORKSPACE/build
198-
python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \
199-
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build \
200-
-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/toolchain \
201-
-t Release \
202-
--ci-defaults ${{ inputs.build_configure_extra_args }} \
203-
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
204-
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
205-
-DLLVM_INSTALL_UTILS=ON \
206-
-DNATIVECPU_USE_OCK=Off
207-
- name: Compile
208-
id: build
209-
# Emulate default value for manual dispatch as we've run out of available arguments.
210-
run: cmake --build $GITHUB_WORKSPACE/build --target ${{ inputs.build_target || 'sycl-toolchain' }}
211-
- name: check-llvm
212-
if: always() && !cancelled() && contains(inputs.changes, 'llvm')
213-
env:
214-
# Can't inline to support possible quotes inside:
215-
BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
216-
run: |
217-
if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then
218-
# https://github.com/llvm/llvm-project/issues/59429
219-
export LIT_FILTER_OUT="ExecutionEngine/MCJIT"
220-
fi
221-
222-
cmake --build $GITHUB_WORKSPACE/build --target check-llvm
223-
- name: check-clang
224-
if: always() && !cancelled() && contains(inputs.changes, 'clang')
225-
env:
226-
# Can't inline to support possible quotes inside:
227-
BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
228-
run: |
229-
# Can we move this to Dockerfile? Hopefully, noop on Windows.
230-
export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache
231-
if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then
232-
# https://github.com/llvm/llvm-project/issues/59428
233-
export LIT_FILTER_OUT="(E|e)xception"
234-
fi
235-
cmake --build $GITHUB_WORKSPACE/build --target check-clang
236-
- name: check-sycl
237-
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
238-
run: |
239-
# TODO consider moving this to Dockerfile.
240-
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
241-
cmake --build $GITHUB_WORKSPACE/build --target check-sycl
242-
- name: check-sycl-unittests
243-
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
244-
run: |
245-
# TODO consider moving this to Dockerfile.
246-
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
247-
cmake --build $GITHUB_WORKSPACE/build --target check-sycl-unittests
248-
- name: check-llvm-spirv
249-
if: always() && !cancelled() && contains(inputs.changes, 'llvm_spirv')
250-
run: |
251-
cmake --build $GITHUB_WORKSPACE/build --target check-llvm-spirv
252-
- name: check-xptifw
253-
if: always() && !cancelled() && contains(inputs.changes, 'xptifw')
254-
run: |
255-
cmake --build $GITHUB_WORKSPACE/build --target check-xptifw
256-
- name: check-libclc
257-
if: always() && !cancelled() && contains(inputs.changes, 'libclc')
258-
run: |
259-
cmake --build $GITHUB_WORKSPACE/build --target check-libclc
260-
- name: check-libdevice
261-
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
262-
run: |
263-
cmake --build $GITHUB_WORKSPACE/build --target check-libdevice
264-
- name: Check E2E test requirements
265-
if: always() && !cancelled() && !contains(inputs.changes, 'sycl')
266-
run: |
267-
# TODO consider moving this to Dockerfile.
268-
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
269-
LIT_OPTS="--allow-empty-runs" LIT_FILTER="e2e_test_requirements" cmake --build $GITHUB_WORKSPACE/build --target check-sycl
270-
- name: Install sycl-toolchain
271-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
272-
run: |
273-
cmake --build $GITHUB_WORKSPACE/build --target deploy-sycl-toolchain
274-
275-
- name: Pack toolchain release
276-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
277-
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
278-
- name: Upload toolchain release
279-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
280-
uses: actions/upload-artifact@v4
281-
with:
282-
name: ${{ inputs.release_toolchain_artifact }}
283-
path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
284-
retention-days: ${{ inputs.retention-days }}
285-
286-
- name: Install utilities
287-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
288-
# TODO replace utility installation with a single CMake target
289-
run: |
290-
cmake --build $GITHUB_WORKSPACE/build --target utils/FileCheck/install
291-
cmake --build $GITHUB_WORKSPACE/build --target utils/count/install
292-
cmake --build $GITHUB_WORKSPACE/build --target utils/not/install
293-
cmake --build $GITHUB_WORKSPACE/build --target utils/lit/install
294-
cmake --build $GITHUB_WORKSPACE/build --target utils/llvm-lit/install
295-
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-size
296-
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-cov
297-
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-profdata
298-
cmake --build $GITHUB_WORKSPACE/build --target install-compiler-rt
299-
# This is required to perform the DeviceConfigFile consistency test, see
300-
# sycl/test-e2e/Basic/device_config_file_consistency.cpp.
301-
cmake --install $GITHUB_WORKSPACE/build --component DeviceConfigFile
302-
- name: Additional Install for "--shared-libs" build
303-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '--shared-libs') }}
304-
run: |
305-
cmake --build $GITHUB_WORKSPACE/build --target install-clang-libraries
306-
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-libraries
307-
308-
- name: Pack toolchain
309-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
310-
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
311-
- name: Upload toolchain
312-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
313-
uses: actions/upload-artifact@v4
314-
with:
315-
name: ${{ inputs.toolchain_artifact }}
316-
path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
317-
retention-days: ${{ inputs.retention-days }}
318-
319-
320-
- name: Source OneAPI TBB vars.sh
321-
# Tasks that use the just built toolchain below, need extra environment
322-
# setup. No harm in it if all of those tasks would get skipped.
323-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
324-
run: |
325-
# https://github.com/actions/runner/issues/1964 prevents us from using
326-
# the ENTRYPOINT in the image.
327-
env | sort > env_before
328-
if [ -e /runtimes/oneapi-tbb/env/vars.sh ]; then
329-
source /runtimes/oneapi-tbb/env/vars.sh;
330-
elif [ -e /opt/runtimes/oneapi-tbb/env/vars.sh ]; then
331-
source /opt/runtimes/oneapi-tbb/env/vars.sh;
332-
else
333-
echo "no TBB vars in /opt/runtimes or /runtimes";
334-
fi
335-
env | sort > env_after
336-
comm -13 env_before env_after >> $GITHUB_ENV
337-
rm env_before env_after
338-
339-
- name: Build E2E tests
340-
if: ${{ inputs.e2e_binaries_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
341-
uses: ./devops/actions/run-tests/e2e
342-
with:
343-
ref: ${{ inputs.ref || github.sha }}
344-
testing_mode: build-only
345-
target_devices: all
346-
binaries_artifact: ${{ inputs.e2e_binaries_artifact }}
347-
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
348-
extra_lit_opts: --param sycl_build_targets="spir;nvidia;amd"
349-
350-
- name: Remove E2E tests before spirv-backend run
351-
if: ${{ inputs.e2e_binaries_spirv_backend_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
352-
run: rm -rf build-e2e
353-
354-
- name: Build E2E tests with SPIR-V Backend
355-
if: ${{ inputs.e2e_binaries_spirv_backend_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
356-
uses: ./devops/actions/run-tests/e2e
357-
with:
358-
ref: ${{ inputs.ref || github.sha }}
359-
testing_mode: build-only
360-
target_devices: all
361-
binaries_artifact: ${{ inputs.e2e_binaries_spirv_backend_artifact }}
362-
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
363-
extra_lit_opts: --param spirv-backend=True
364-
365-
- name: Remove E2E tests before preview-mode run
366-
if: ${{ inputs.e2e_binaries_preview_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
367-
run: rm -rf build-e2e
368-
369-
- name: Build E2E tests in Preview Mode
370-
if: ${{ inputs.e2e_binaries_preview_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
371-
uses: ./devops/actions/run-tests/e2e
372-
with:
373-
ref: ${{ inputs.ref || github.sha }}
374-
testing_mode: build-only
375-
target_devices: all
376-
binaries_artifact: ${{ inputs.e2e_binaries_preview_artifact }}
377-
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
378-
extra_lit_opts: --param test-preview-mode=True
103+
sycl/test/abi
104+
- run: |
105+
set -x
106+
git status
107+
git remote -v
108+
git branch -a
109+
git fetch origin sycl-rel-6_3
110+
git branch -a
111+
git diff -I "# RUN" origin/sycl-rel-6_3:sycl/test/abi/sycl_symbols_linux.dump sycl/test/abi/sycl_symbols_linux-sycl-rel-6_3.dump
112+
git diff -I "# RUN" origin/sycl-rel-6_3:sycl/test/abi/sycl_symbols_windows.dump sycl/test/abi/sycl_symbols_windows-sycl-rel-6_3.dump

.github/workflows/sycl-nightly.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ on:
88
permissions: read-all
99

1010
jobs:
11+
check_abi_symbols:
12+
name: Check ABI symbols tests match release branch
13+
runs-on: [Linux, build]
14+
if: github.repository == 'intel/llvm'
15+
container: ghcr.io/intel/llvm/ubuntu2404_build
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
sparse-checkout: |
20+
sycl/test/abi
21+
- run: |
22+
git diff -I "# RUN" origin/sycl-rel-6_3:sycl/test/abi/sycl_symbols_linux.dump sycl/test/abi/sycl_symbols_linux-sycl-rel-6_3.dump
23+
git diff -I "# RUN" origin/sycl-rel-6_3:sycl/test/abi/sycl_symbols_windows.dump sycl/test/abi/sycl_symbols_windows-sycl-rel-6_3.dump
24+
1125
ubuntu2204_build:
1226
if: github.repository == 'intel/llvm'
1327
uses: ./.github/workflows/sycl-linux-build.yml

0 commit comments

Comments
 (0)