Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
363 changes: 202 additions & 161 deletions .github/workflows/sycl-linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ on:
default: '[llvm, clang, sycl, llvm_spirv, xptifw, libclc]'
required: false

run_clang_tidy:
type: boolean
default: false

# Artifacts:

retention-days:
Expand Down Expand Up @@ -153,25 +157,25 @@ jobs:
CCACHE_DIR: ${{ inputs.build_cache_root }}/build_cache_${{ inputs.build_cache_suffix }}
CCACHE_MAXSIZE: 8G
steps:
- name: Deduce artifact archive params
# To reduce number of inputs parameters that is limited for manual triggers.
id: artifact_info
run: |
NAME="${{inputs.toolchain_artifact_filename}}"
if [ -z "$NAME" ]; then
NAME=llvm_sycl.tar.zst
fi
echo ARCHIVE_NAME="$NAME" >> $GITHUB_OUTPUT
if [ "${NAME}" != "${NAME%.tar.gz}" ]; then
echo COMPRESS="gzip" >> $GITHUB_OUTPUT
echo DECOMPRESS="gunzip" >> $GITHUB_OUTPUT
elif [ "${NAME}" != "${NAME%.tar.zst}" ]; then
echo COMPRESS="zstd -9" >> $GITHUB_OUTPUT
echo DECOMPRESS="zstd" >> $GITHUB_OUTPUT
else
echo "Unsupported extension"
exit 1
fi
# - name: Deduce artifact archive params
# # To reduce number of inputs parameters that is limited for manual triggers.
# id: artifact_info
# run: |
# NAME="${{inputs.toolchain_artifact_filename}}"
# if [ -z "$NAME" ]; then
# NAME=llvm_sycl.tar.zst
# fi
# echo ARCHIVE_NAME="$NAME" >> $GITHUB_OUTPUT
# if [ "${NAME}" != "${NAME%.tar.gz}" ]; then
# echo COMPRESS="gzip" >> $GITHUB_OUTPUT
# echo DECOMPRESS="gunzip" >> $GITHUB_OUTPUT
# elif [ "${NAME}" != "${NAME%.tar.zst}" ]; then
# echo COMPRESS="zstd -9" >> $GITHUB_OUTPUT
# echo DECOMPRESS="zstd" >> $GITHUB_OUTPUT
# else
# echo "Unsupported extension"
# exit 1
# fi
- uses: actions/checkout@v6
with:
sparse-checkout: |
Expand All @@ -184,9 +188,9 @@ jobs:
path: src
ref: ${{ inputs.build_ref || github.sha }}
cache_path: "/__w/repo_cache/"
- name: Setup oneAPI env
if: ${{ inputs.cc == 'icx' || inputs.cxx == 'icpx' }}
uses: ./devops/actions/setup_linux_oneapi_env
# - name: Setup oneAPI env
# if: ${{ inputs.cc == 'icx' || inputs.cxx == 'icpx' }}
# uses: ./devops/actions/setup_linux_oneapi_env
- name: Configure
# Setting `CMAKE_INSTALL_PREFIX` is important because that's the location
# where `sycl-linux-run-tests.yml` unpacks the toolchain to. That location
Expand Down Expand Up @@ -214,150 +218,187 @@ jobs:
# Emulate default value for manual dispatch as we've run out of available arguments.
run: cmake --build $GITHUB_WORKSPACE/build --target ${{ inputs.build_target || 'sycl-toolchain' }}
- run: $GITHUB_WORKSPACE/build/bin/clang++ --version
- name: check-llvm
if: ${{ !cancelled() && contains(inputs.changes, 'llvm') }}
env:
# Can't inline to support possible quotes inside:
BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
run: |
if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then
# https://github.com/llvm/llvm-project/issues/59429
export LIT_FILTER_OUT="ExecutionEngine/MCJIT"
fi

cmake --build $GITHUB_WORKSPACE/build --target check-llvm
- name: check-clang
if: ${{ !cancelled() && contains(inputs.changes, 'clang') }}
env:
# Can't inline to support possible quotes inside:
BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
- name: Run clang-tidy on modified files
# if: ${{ !cancelled() && steps.build.conclusion == 'success' && github.base_ref == 'sycl' && inputs.run_clang_tidy }}
if: ${{ !cancelled() && github.base_ref == 'sycl' && inputs.run_clang_tidy }}
# Exeprimental step, it won't affect the merge in case of failure.
continue-on-error: true
id: clang_tidy
run: |
# Can we move this to Dockerfile? Hopefully, noop on Windows.
export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache
if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then
# https://github.com/llvm/llvm-project/issues/59428
export LIT_FILTER_OUT="(E|e)xception"
# TODO: make it possible to disable this step in case of big PRs like pulldown etc.

# Download diff.
echo "Downloading diff"
curl -L "${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.diff" -o pr.diff

if ! grep -qE '\.(cpp|cxx|cc|hpp|h|hxx)$' pr.diff; then
echo "No C++ files were changed, skip clang-tidy."
exit 0
fi
cmake --build $GITHUB_WORKSPACE/build --target check-clang
- name: check-sycl
if: ${{ !cancelled() && contains(inputs.changes, 'sycl') }}
run: |
# TODO consider moving this to Dockerfile.
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
cmake --build $GITHUB_WORKSPACE/build --target check-sycl
- name: check-sycl-unittests
if: ${{ !cancelled() && contains(inputs.changes, 'sycl') }}
run: |
# TODO consider moving this to Dockerfile.
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
cmake --build $GITHUB_WORKSPACE/build --target check-sycl-unittests
- name: check-llvm-spirv
if: ${{ !cancelled() && contains(inputs.changes, 'llvm_spirv') }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-llvm-spirv
- name: check-xptifw
if: ${{ !cancelled() && contains(inputs.changes, 'xptifw') }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-xptifw
- name: check-libclc
if: ${{ !cancelled() && contains(inputs.changes, 'libclc') }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target check-libclc
- name: Check E2E test requirements
if: ${{ !cancelled() && !contains(inputs.changes, 'sycl') }}
run: |
# TODO consider moving this to Dockerfile.
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
LIT_OPTS="--allow-empty-runs" LIT_FILTER="e2e_test_requirements" cmake --build $GITHUB_WORKSPACE/build --target check-sycl
- name: Install sycl-toolchain
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target deploy-sycl-toolchain

- name: Pack toolchain release
if: ${{ !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
- name: Upload toolchain release
if: ${{ !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
uses: actions/upload-artifact@v6
with:
name: ${{ inputs.release_toolchain_artifact }}
path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
retention-days: ${{ inputs.retention-days }}

- name: Install utilities
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target install-sycl-test-utilities
# Prepare compile_commands.json:
# Remove commands containing the "-D__INTEL_PREVIEW_BREAKING_CHANGES" flag to avoid double runs on SYCL source files.
# TODO: need to remove gcc flags unsupported by clang
jq '[ .[] | select(.command | contains("-D__INTEL_PREVIEW_BREAKING_CHANGES") | not) ]' $GITHUB_WORKSPACE/build/compile_commands.json > $GITHUB_WORKSPACE/build/compile_commands.temp.json
mv $GITHUB_WORKSPACE/build/compile_commands.temp.json $GITHUB_WORKSPACE/build/compile_commands.json

- name: Additional Install for "--shared-libs" build
if: ${{ !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '--shared-libs') }}
run: |
cmake --build $GITHUB_WORKSPACE/build --target install-clang-libraries
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-libraries

- name: Pack toolchain
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
- name: Upload toolchain
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
uses: actions/upload-artifact@v6
with:
name: ${{ inputs.toolchain_artifact }}
path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
retention-days: ${{ inputs.retention-days }}
echo '::group::Build clang-tidy'
cmake --build $GITHUB_WORKSPACE/build --target clang-tidy
echo '::endgroup::'

cd "$GITHUB_WORKSPACE/src"
python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \
-clang-tidy-binary "$GITHUB_WORKSPACE/build/bin/clang-tidy" \
-p 1 \
-path "$GITHUB_WORKSPACE/build" \
-checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \
< "$GITHUB_WORKSPACE/pr.diff"

- name: Source OneAPI TBB vars.sh
# Tasks that use the just built toolchain below, need extra environment
# setup. No harm in it if all of those tasks would get skipped.
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
uses: ./devops/actions/source-tbb
# - name: check-llvm
# if: ${{ !cancelled() && contains(inputs.changes, 'llvm') }}
# env:
# # Can't inline to support possible quotes inside:
# BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
# run: |
# if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then
# # https://github.com/llvm/llvm-project/issues/59429
# export LIT_FILTER_OUT="ExecutionEngine/MCJIT"
# fi

- name: Build E2E tests
if: ${{ inputs.e2e_binaries_artifact && !cancelled() && steps.build.conclusion == 'success' }}
uses: ./devops/actions/run-tests/linux/e2e
with:
ref: ${{ inputs.ref || github.sha }}
testing_mode: build-only
target_devices: all
binaries_artifact: ${{ inputs.e2e_binaries_artifact }}
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
extra_lit_opts: --param sycl_build_targets="spir;nvidia;amd"

- name: Build E2E tests with NewOffloadModel
if: |
inputs.e2e_binaries_new_offload_model_artifact &&
!cancelled()
&& steps.build.conclusion == 'success' &&
contains(github.event.pull_request.labels.*.name, 'new-offload-model')
uses: ./devops/actions/run-tests/linux/e2e
with:
ref: ${{ inputs.ref || github.sha }}
testing_mode: build-only
target_devices: all
binaries_artifact: ${{ inputs.e2e_binaries_new_offload_model_artifact }}
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
extra_lit_opts: --param sycl_build_targets="spir;nvidia;amd" --param enable_new_offload_model=True

- name: Build E2E tests with SPIR-V Backend
if: ${{ inputs.e2e_binaries_spirv_backend_artifact && !cancelled() && steps.build.conclusion == 'success' }}
uses: ./devops/actions/run-tests/linux/e2e
with:
ref: ${{ inputs.ref || github.sha }}
testing_mode: build-only
target_devices: all
binaries_artifact: ${{ inputs.e2e_binaries_spirv_backend_artifact }}
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
extra_lit_opts: --param spirv-backend=True

- name: Build E2E tests in Preview Mode
if: ${{ inputs.e2e_binaries_preview_artifact && !cancelled() && steps.build.conclusion == 'success' }}
uses: ./devops/actions/run-tests/linux/e2e
with:
ref: ${{ inputs.ref || github.sha }}
testing_mode: build-only
target_devices: all
binaries_artifact: ${{ inputs.e2e_binaries_preview_artifact }}
sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
extra_lit_opts: --param test-preview-mode=True
# cmake --build $GITHUB_WORKSPACE/build --target check-llvm
# - name: check-clang
# if: ${{ !cancelled() && contains(inputs.changes, 'clang') }}
# env:
# # Can't inline to support possible quotes inside:
# BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
# run: |
# # Can we move this to Dockerfile? Hopefully, noop on Windows.
# export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache
# if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then
# # https://github.com/llvm/llvm-project/issues/59428
# export LIT_FILTER_OUT="(E|e)xception"
# fi
# cmake --build $GITHUB_WORKSPACE/build --target check-clang
# - name: check-sycl
# if: ${{ !cancelled() && contains(inputs.changes, 'sycl') }}
# run: |
# # TODO consider moving this to Dockerfile.
# export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
# cmake --build $GITHUB_WORKSPACE/build --target check-sycl
# - name: check-sycl-unittests
# if: ${{ !cancelled() && contains(inputs.changes, 'sycl') }}
# run: |
# # TODO consider moving this to Dockerfile.
# export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
# cmake --build $GITHUB_WORKSPACE/build --target check-sycl-unittests
# - name: check-llvm-spirv
# if: ${{ !cancelled() && contains(inputs.changes, 'llvm_spirv') }}
# run: |
# cmake --build $GITHUB_WORKSPACE/build --target check-llvm-spirv
# - name: check-xptifw
# if: ${{ !cancelled() && contains(inputs.changes, 'xptifw') }}
# run: |
# cmake --build $GITHUB_WORKSPACE/build --target check-xptifw
# - name: check-libclc
# if: ${{ !cancelled() && contains(inputs.changes, 'libclc') }}
# run: |
# cmake --build $GITHUB_WORKSPACE/build --target check-libclc
# - name: Check E2E test requirements
# if: ${{ !cancelled() && !contains(inputs.changes, 'sycl') }}
# run: |
# # TODO consider moving this to Dockerfile.
# export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
# LIT_OPTS="--allow-empty-runs" LIT_FILTER="e2e_test_requirements" cmake --build $GITHUB_WORKSPACE/build --target check-sycl
# - name: Install sycl-toolchain
# if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
# run: |
# cmake --build $GITHUB_WORKSPACE/build --target deploy-sycl-toolchain

# - name: Pack toolchain release
# if: ${{ !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
# run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
# - name: Upload toolchain release
# if: ${{ !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
# uses: actions/upload-artifact@v6
# with:
# name: ${{ inputs.release_toolchain_artifact }}
# path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
# retention-days: ${{ inputs.retention-days }}

# - name: Install utilities
# if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
# run: |
# cmake --build $GITHUB_WORKSPACE/build --target install-sycl-test-utilities

# - name: Additional Install for "--shared-libs" build
# if: ${{ !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '--shared-libs') }}
# run: |
# cmake --build $GITHUB_WORKSPACE/build --target install-clang-libraries
# cmake --build $GITHUB_WORKSPACE/build --target install-llvm-libraries

# - name: Pack toolchain
# if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
# run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
# - name: Upload toolchain
# if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
# uses: actions/upload-artifact@v6
# with:
# name: ${{ inputs.toolchain_artifact }}
# path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
# retention-days: ${{ inputs.retention-days }}


# - name: Source OneAPI TBB vars.sh
# # Tasks that use the just built toolchain below, need extra environment
# # setup. No harm in it if all of those tasks would get skipped.
# if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
# uses: ./devops/actions/source-tbb

# - name: Build E2E tests
# if: ${{ inputs.e2e_binaries_artifact && !cancelled() && steps.build.conclusion == 'success' }}
# uses: ./devops/actions/run-tests/linux/e2e
# with:
# ref: ${{ inputs.ref || github.sha }}
# testing_mode: build-only
# target_devices: all
# binaries_artifact: ${{ inputs.e2e_binaries_artifact }}
# sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
# extra_lit_opts: --param sycl_build_targets="spir;nvidia;amd"

# - name: Build E2E tests with NewOffloadModel
# if: |
# inputs.e2e_binaries_new_offload_model_artifact &&
# !cancelled()
# && steps.build.conclusion == 'success' &&
# contains(github.event.pull_request.labels.*.name, 'new-offload-model')
# uses: ./devops/actions/run-tests/linux/e2e
# with:
# ref: ${{ inputs.ref || github.sha }}
# testing_mode: build-only
# target_devices: all
# binaries_artifact: ${{ inputs.e2e_binaries_new_offload_model_artifact }}
# sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
# extra_lit_opts: --param sycl_build_targets="spir;nvidia;amd" --param enable_new_offload_model=True

# - name: Build E2E tests with SPIR-V Backend
# if: ${{ inputs.e2e_binaries_spirv_backend_artifact && !cancelled() && steps.build.conclusion == 'success' }}
# uses: ./devops/actions/run-tests/linux/e2e
# with:
# ref: ${{ inputs.ref || github.sha }}
# testing_mode: build-only
# target_devices: all
# binaries_artifact: ${{ inputs.e2e_binaries_spirv_backend_artifact }}
# sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
# extra_lit_opts: --param spirv-backend=True

# - name: Build E2E tests in Preview Mode
# if: ${{ inputs.e2e_binaries_preview_artifact && !cancelled() && steps.build.conclusion == 'success' }}
# uses: ./devops/actions/run-tests/linux/e2e
# with:
# ref: ${{ inputs.ref || github.sha }}
# testing_mode: build-only
# target_devices: all
# binaries_artifact: ${{ inputs.e2e_binaries_preview_artifact }}
# sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
# extra_lit_opts: --param test-preview-mode=True
Loading
Loading