From 8634b166cd9c7d328699d8ee0aae5c7edc9e3395 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Mon, 2 Feb 2026 15:08:43 +0100 Subject: [PATCH 01/22] init --- .github/workflows/sycl-clang-tidy.yml | 68 +++++++++++++++++++++ .github/workflows/sycl-linux-precommit.yml | 8 +++ devops/scripts/should_run_clang-tidy.py | 69 ++++++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 .github/workflows/sycl-clang-tidy.yml create mode 100644 devops/scripts/should_run_clang-tidy.py diff --git a/.github/workflows/sycl-clang-tidy.yml b/.github/workflows/sycl-clang-tidy.yml new file mode 100644 index 0000000000000..7eba35d612d24 --- /dev/null +++ b/.github/workflows/sycl-clang-tidy.yml @@ -0,0 +1,68 @@ +name: clang-tidy + +on: + workflow_call: + +permissions: read-all + +jobs: + run-clang-tidy: + runs-on: [Linux, build] + container: + image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest + options: -u 1001:1001 + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + sparse-checkout: | + devops/actions + devops/scripts/should_run_clang-tidy.py + - name: Register cleanup after job is finished + uses: ./devops/actions/cleanup + + - name: Check diff + id: should_run_tidy + run: | + echo "Downloading the diff" + curl -L "${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.diff" -o pr.diff + # DEBUG + pwd + ls -lR + + if python3 devops/scripts/should_run_clang-tidy.py pr.diff; then + echo "run=true" >> "$GITHUB_OUTPUT" + else + echo "run=false" >> "$GITHUB_OUTPUT" + fi + + - if: steps.should_run_tidy.outputs.run == 'true' + uses: ./devops/actions/cached_checkout + with: + path: src + ref: ${{ github.sha }} + cache_path: "/__w/repo_cache/" + + - name: Get compile_commands.json + if: steps.should_run_tidy.outputs.run == 'true' + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + with: + name: compile_commands + - name: Preprocess compile_commands.json + if: steps.should_run_tidy.outputs.run == 'true' + run: | + # Remove commands containing "-D__INTEL_PREVIEW_BREAKING_CHANGES" to avoid running on the same file twice. + jq '[ .[] | select(.command | contains("-D__INTEL_PREVIEW_BREAKING_CHANGES") | not) ]' $GITHUB_WORKSPACE/compile_commands.json > $GITHUB_WORKSPACE/compile_commands.temp.json + mv $GITHUB_WORKSPACE/compile_commands.temp.json $GITHUB_WORKSPACE/compile_commands.json + + - name: Run clang-tidy on modified files + if: steps.should_run_tidy.outputs.run == 'true' + # Exeprimental workflow, it won't affect the pre-commit status in case of failure. + continue-on-error: true + run: | + cd "$GITHUB_WORKSPACE/src" + python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ + -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ + -p 1 \ + -path "$GITHUB_WORKSPACE" \ + -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ + < "$GITHUB_WORKSPACE/pr.diff" diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index ca06e819a5dea..64074fa633d73 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -69,6 +69,14 @@ jobs: e2e_binaries_preview_artifact: e2e_bin_preview e2e_binaries_new_offload_model_artifact: e2e_bin_new_offload_model + # For clang-tidy + build_configure_extra_args: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + clang-tidy: + needs: build + if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' && github.base_ref == 'sycl' !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} + uses: ./.github/workflows/sycl-clang-tidy.yml + # Build and run native cpu e2e tests separately as cannot currently # build all the e2e tests build_run_native_cpu_e2e_tests: diff --git a/devops/scripts/should_run_clang-tidy.py b/devops/scripts/should_run_clang-tidy.py new file mode 100644 index 0000000000000..11f4da1f33669 --- /dev/null +++ b/devops/scripts/should_run_clang-tidy.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 + +# This script checks if a diff contains changes that should be inspected by +# clang-tidy. + +from __future__ import annotations +import re +import sys +from typing import Iterator + +EXCLUDE_PATH_RE = re.compile(r"(?:^|/)(test|test-e2e|unittests)(?:/|$)") + + +def is_relevant_path(path: str) -> bool: + return EXCLUDE_PATH_RE.search(path) is None + + +# This iterator splits a diff file into separate sections like: +# diff --git a/path-to/file b/path-to/file +# ... code changes ... +def iter_diff_sections(diff_content: str) -> Iterator[str]: + section_lines: list[str] = [] + started = False + + for line in diff_content.splitlines(True): # keep '\n' + if line.startswith("diff --git "): + if started and section_lines: + yield "".join(section_lines) + section_lines = [] + started = True + + if started: + section_lines.append(line) + + if started and section_lines: + yield "".join(section_lines) + + +def main() -> int: + diff_path = sys.argv[1] + with open(diff_path, "r", encoding="utf-8", errors="replace") as f: + diff_content = f.read() + + should_run = False + for section in iter_diff_sections(diff_content): + lines = section.splitlines() + # Skip removed files. + if lines[4] == "+++ /dev/null": + continue + result_file = lines[3] + # Skip non-c++ files. + if not result_file.endswith((".cpp", ".hpp", ".h")): + continue + # Skip tests etc. + if not is_relevant_path(result_file): + continue + # Check if any non-comment string was added. + for line in lines[4:]: + if line.startswith("+") and not line[1:].lstrip().startswith("//"): + should_run = True + break + if should_run == True: + break + + sys.exit(0 if should_run else 1) + + +if __name__ == "__main__": + sys.exit(main()) From b5c6a5e89dd4fdc87f7a1980e67c159ab453b096 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 13:41:35 +0100 Subject: [PATCH 02/22] dummy-change --- sycl/include/sycl/accessor.hpp | 3 +-- sycl/source/accessor.cpp | 3 +-- sycl/source/device.cpp | 3 +-- sycl/source/image.cpp | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sycl/include/sycl/accessor.hpp b/sycl/include/sycl/accessor.hpp index d804c9ca7af29..366819e9bd2db 100644 --- a/sycl/include/sycl/accessor.hpp +++ b/sycl/include/sycl/accessor.hpp @@ -767,8 +767,7 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor : detail::InitializedVal::template get<0>()) {} #else - accessor(const detail::AccessorImplPtr &Impl) - : detail::AccessorBaseHost{Impl} {} + accessor(const detail::AccessorImplPtr &Impl) : detail::AccessorBaseHost{Impl} {} void *getPtr() { return AccessorBaseHost::getPtr(); } diff --git a/sycl/source/accessor.cpp b/sycl/source/accessor.cpp index dc6f9a1ec206f..5340be01c160d 100644 --- a/sycl/source/accessor.cpp +++ b/sycl/source/accessor.cpp @@ -102,8 +102,7 @@ LocalAccessorBaseHost::LocalAccessorBaseHost( sycl::range<3> Size, int Dims, int ElemSize, const property_list &PropertyList) { verifyAccessorProps(PropertyList); - impl = std::shared_ptr( - new LocalAccessorImplHost(Size, Dims, ElemSize, PropertyList)); + impl = std::shared_ptr(new LocalAccessorImplHost(Size, Dims, ElemSize, PropertyList)); } sycl::range<3> &LocalAccessorBaseHost::getSize() { return impl->MSize; } const sycl::range<3> &LocalAccessorBaseHost::getSize() const { diff --git a/sycl/source/device.cpp b/sycl/source/device.cpp index 0c99630effbc2..849aec2d1b164 100644 --- a/sycl/source/device.cpp +++ b/sycl/source/device.cpp @@ -59,8 +59,7 @@ device::device(const device_selector &deviceSelector) { std::vector device::get_devices(info::device_type deviceType) { std::vector devices; - detail::ods_target_list *OdsTargetList = - detail::SYCLConfig::get(); + detail::ods_target_list *OdsTargetList = detail::SYCLConfig::get(); auto thePlatforms = platform::get_platforms(); for (const auto &plt : thePlatforms) { diff --git a/sycl/source/image.cpp b/sycl/source/image.cpp index 511d816e5d31f..4c62a6d6b0950 100644 --- a/sycl/source/image.cpp +++ b/sycl/source/image.cpp @@ -16,8 +16,7 @@ image_plain::image_plain(image_channel_order Order, image_channel_type Type, const range<3> &Range, std::unique_ptr Allocator, uint8_t Dimensions, const property_list &PropList) { - impl = std::make_shared( - Order, Type, Range, std::move(Allocator), Dimensions, PropList); + impl = std::make_shared(Order, Type, Range, std::move(Allocator), Dimensions, PropList); } image_plain::image_plain(image_channel_order Order, image_channel_type Type, From 6ced96ec1511c189f89231844509750cceb98b34 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 13:49:24 +0100 Subject: [PATCH 03/22] strace --- .github/workflows/sycl-clang-tidy.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sycl-clang-tidy.yml b/.github/workflows/sycl-clang-tidy.yml index 7eba35d612d24..606f5b13a4eb9 100644 --- a/.github/workflows/sycl-clang-tidy.yml +++ b/.github/workflows/sycl-clang-tidy.yml @@ -60,9 +60,16 @@ jobs: continue-on-error: true run: | cd "$GITHUB_WORKSPACE/src" - python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ + strace -vf -s500 -o CTD.strace python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ -p 1 \ -path "$GITHUB_WORKSPACE" \ -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ < "$GITHUB_WORKSPACE/pr.diff" + + - name: upload CTD.strace + uses: actions/upload-artifact@v6 + with: + name: CTD.strace + path: "$GITHUB_WORKSPACE/CTD.strace" + retention-days: 1 From 8bfa7163e2460e8c4c61fc709387f914acbbf9f5 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 14:36:06 +0100 Subject: [PATCH 04/22] fix-linux-precommit --- .github/workflows/sycl-linux-precommit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 64074fa633d73..5f59cb93b4d9f 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -74,7 +74,7 @@ jobs: clang-tidy: needs: build - if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' && github.base_ref == 'sycl' !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} + if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' && github.base_ref == 'sycl' && !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} uses: ./.github/workflows/sycl-clang-tidy.yml # Build and run native cpu e2e tests separately as cannot currently From 026088dfc39f6e1416db3359a29e1bf3692f8ce4 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 15:13:04 +0100 Subject: [PATCH 05/22] upload-compile-commands --- .github/workflows/sycl-linux-build.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/sycl-linux-build.yml b/.github/workflows/sycl-linux-build.yml index 7fe6f9fbff281..02fb346d55296 100644 --- a/.github/workflows/sycl-linux-build.yml +++ b/.github/workflows/sycl-linux-build.yml @@ -214,6 +214,15 @@ 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: Upload compile_commands + if: ${{ !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON') }} + uses: actions/upload-artifact@v6 + with: + name: compile_commands + path: "$GITHUB_WORKSPACE/build/compile_commands.json" + retention-days: ${{ inputs.retention-days }} + - name: check-llvm if: ${{ !cancelled() && contains(inputs.changes, 'llvm') }} env: From 185b6c4f95fbb9e66f41d60eb30af1f5eeaa5bbd Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 16:12:21 +0100 Subject: [PATCH 06/22] fix-path --- .github/workflows/sycl-linux-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sycl-linux-build.yml b/.github/workflows/sycl-linux-build.yml index 02fb346d55296..0ee25387a5d6e 100644 --- a/.github/workflows/sycl-linux-build.yml +++ b/.github/workflows/sycl-linux-build.yml @@ -220,7 +220,7 @@ jobs: uses: actions/upload-artifact@v6 with: name: compile_commands - path: "$GITHUB_WORKSPACE/build/compile_commands.json" + path: $GITHUB_WORKSPACE/build/compile_commands.json retention-days: ${{ inputs.retention-days }} - name: check-llvm From 0b76b4828a50fe0d6ac4121a6797546a9d2d2720 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 16:40:30 +0100 Subject: [PATCH 07/22] configure-within-workflow --- .github/workflows/sycl-clang-tidy.yml | 37 ++++++++++++++++------ .github/workflows/sycl-linux-precommit.yml | 8 ----- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/.github/workflows/sycl-clang-tidy.yml b/.github/workflows/sycl-clang-tidy.yml index 606f5b13a4eb9..fc70629cd90dc 100644 --- a/.github/workflows/sycl-clang-tidy.yml +++ b/.github/workflows/sycl-clang-tidy.yml @@ -1,12 +1,16 @@ name: clang-tidy on: - workflow_call: + pull_requests: + branches: + - sycl permissions: read-all jobs: run-clang-tidy: + # Add more conditions + if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} runs-on: [Linux, build] container: image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest @@ -41,18 +45,33 @@ jobs: path: src ref: ${{ github.sha }} cache_path: "/__w/repo_cache/" - - - name: Get compile_commands.json + - name: Configure if: steps.should_run_tidy.outputs.run == 'true' - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 - with: - name: compile_commands + env: + CC: ${{ inputs.cc }} + CXX: ${{ inputs.cxx }} + CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs" + run: | + mkdir -p $CCACHE_DIR + mkdir -p $GITHUB_WORKSPACE/build + cd $GITHUB_WORKSPACE/build + python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \ + -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build \ + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/toolchain \ + -t Release \ + --ci-defaults --use-zstd ${{ inputs.build_configure_extra_args }} \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DLLVM_INSTALL_UTILS=ON \ + -DSYCL_UR_FORCE_FETCH_LEVEL_ZERO=ON \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - name: Preprocess compile_commands.json if: steps.should_run_tidy.outputs.run == 'true' run: | # Remove commands containing "-D__INTEL_PREVIEW_BREAKING_CHANGES" to avoid running on the same file twice. - jq '[ .[] | select(.command | contains("-D__INTEL_PREVIEW_BREAKING_CHANGES") | not) ]' $GITHUB_WORKSPACE/compile_commands.json > $GITHUB_WORKSPACE/compile_commands.temp.json - mv $GITHUB_WORKSPACE/compile_commands.temp.json $GITHUB_WORKSPACE/compile_commands.json + 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: Run clang-tidy on modified files if: steps.should_run_tidy.outputs.run == 'true' @@ -63,7 +82,7 @@ jobs: strace -vf -s500 -o CTD.strace python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ -p 1 \ - -path "$GITHUB_WORKSPACE" \ + -path "$GITHUB_WORKSPACE/build" \ -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ < "$GITHUB_WORKSPACE/pr.diff" diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 5f59cb93b4d9f..ca06e819a5dea 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -69,14 +69,6 @@ jobs: e2e_binaries_preview_artifact: e2e_bin_preview e2e_binaries_new_offload_model_artifact: e2e_bin_new_offload_model - # For clang-tidy - build_configure_extra_args: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - - clang-tidy: - needs: build - if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' && github.base_ref == 'sycl' && !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} - uses: ./.github/workflows/sycl-clang-tidy.yml - # Build and run native cpu e2e tests separately as cannot currently # build all the e2e tests build_run_native_cpu_e2e_tests: From 2a75004579eaa81d69e0843e26850d90868941b5 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 16:57:19 +0100 Subject: [PATCH 08/22] use-precommit-file --- .github/workflows/sycl-linux-build.yml | 9 - .github/workflows/sycl-linux-precommit.yml | 374 +++++---------------- 2 files changed, 75 insertions(+), 308 deletions(-) diff --git a/.github/workflows/sycl-linux-build.yml b/.github/workflows/sycl-linux-build.yml index 0ee25387a5d6e..7fe6f9fbff281 100644 --- a/.github/workflows/sycl-linux-build.yml +++ b/.github/workflows/sycl-linux-build.yml @@ -214,15 +214,6 @@ 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: Upload compile_commands - if: ${{ !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON') }} - uses: actions/upload-artifact@v6 - with: - name: compile_commands - path: $GITHUB_WORKSPACE/build/compile_commands.json - retention-days: ${{ inputs.retention-days }} - - name: check-llvm if: ${{ !cancelled() && contains(inputs.changes, 'llvm') }} env: diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index ca06e819a5dea..f9cc3c470a326 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -1,318 +1,94 @@ -name: SYCL Pre Commit on Linux +name: clang-tidy 2 on: - # We rely on "Fork pull request workflows from outside collaborators" - - # "Require approval for all outside collaborators" at - # https://github.com/intel/llvm/settings/actions for security. - pull_request: + pull_requests: branches: - sycl - - sycl-rel-** - # Do not run builds if changes are only in the following locations - # Note: benchmark-related paths are the same as in sycl-ur-perf-benchmarking.yml (to run there instead) - paths-ignore: - - '.github/ISSUE_TEMPLATE/**' - - '.github/CODEOWNERS' - - 'sycl/cts_exclude_filter/**' - - 'sycl/doc/**' - - 'sycl/gdb/**' - - 'clang/docs/**' - - '**.md' - - '**.rst' - - '.github/workflows/sycl-windows-*.yml' - - '.github/workflows/sycl-macos-*.yml' - - '.github/workflows/sycl-nightly.yml' - - '.github/workflows/sycl-rel-nightly.yml' - - '.github/workflows/sycl-rel-nightly-launch.yml' - - '.github/workflows/sycl-trivy.yml' - - '.github/workflows/sycl-coverity.yml' - - '.github/workflows/sycl-weekly.yml' - - 'devops/containers/**' - - 'devops/actions/build_container/**' - - 'unified-runtime/examples/**' - - 'unified-runtime/scripts/**' - - 'unified-runtime/test/**' - - 'unified-runtime/third_party/**' - - 'unified-runtime/tools/**' - - 'devops/scripts/benchmarks/**' - - 'devops/actions/run-tests/benchmark/**' - - '.github/workflows/sycl-ur-perf-benchmarking.yml' - -concurrency: - # Cancel a currently running workflow from the same PR, branch or tag. - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true permissions: read-all jobs: - detect_changes: - uses: ./.github/workflows/sycl-detect-changes.yml - - build: - name: Self build - needs: [detect_changes] - if: success() - uses: ./.github/workflows/sycl-linux-build.yml - with: - build_ref: ${{ github.sha }} - build_cache_root: "/__w/" - build_cache_suffix: "default" - # Docker image has last nightly pre-installed and added to the PATH - build_image: "ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest" - cc: clang - cxx: clang++ - changes: ${{ needs.detect_changes.outputs.filters }} - - toolchain_artifact: sycl_linux_default - e2e_binaries_artifact: e2e_bin - e2e_binaries_preview_artifact: e2e_bin_preview - e2e_binaries_new_offload_model_artifact: e2e_bin_new_offload_model - - # Build and run native cpu e2e tests separately as cannot currently - # build all the e2e tests - build_run_native_cpu_e2e_tests: - if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }} + run-clang-tidy: + # Add more conditions + if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} runs-on: [Linux, build] - needs: [build] container: image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest options: -u 1001:1001 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: sparse-checkout: | - devops/ + devops/actions + devops/scripts/should_run_clang-tidy.py + - name: Register cleanup after job is finished + uses: ./devops/actions/cleanup - # download build artefact - - name: Download toolchain - uses: actions/download-artifact@v7 + - name: Check diff + id: should_run_tidy + run: | + echo "Downloading the diff" + curl -L "${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.diff" -o pr.diff + # DEBUG + pwd + ls -lR + + if python3 devops/scripts/should_run_clang-tidy.py pr.diff; then + echo "run=true" >> "$GITHUB_OUTPUT" + else + echo "run=false" >> "$GITHUB_OUTPUT" + fi + + - if: steps.should_run_tidy.outputs.run == 'true' + uses: ./devops/actions/cached_checkout with: - name: sycl_linux_default - - name: Extract SYCL toolchain - shell: bash + path: src + ref: ${{ github.sha }} + cache_path: "/__w/repo_cache/" + - name: Configure + if: steps.should_run_tidy.outputs.run == 'true' + env: + CC: ${{ inputs.cc }} + CXX: ${{ inputs.cxx }} + CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs" + run: | + mkdir -p $CCACHE_DIR + mkdir -p $GITHUB_WORKSPACE/build + cd $GITHUB_WORKSPACE/build + python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \ + -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build \ + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/toolchain \ + -t Release \ + --ci-defaults --use-zstd ${{ inputs.build_configure_extra_args }} \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DLLVM_INSTALL_UTILS=ON \ + -DSYCL_UR_FORCE_FETCH_LEVEL_ZERO=ON \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + - name: Preprocess compile_commands.json + if: steps.should_run_tidy.outputs.run == 'true' run: | - mkdir toolchain - tar -xf llvm_sycl.tar.zst -C toolchain - rm llvm_sycl.tar.zst - - name: Build and run E2E tests - uses: ./devops/actions/run-tests/linux/e2e + # Remove commands containing "-D__INTEL_PREVIEW_BREAKING_CHANGES" to avoid running on the same file twice. + 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: Run clang-tidy on modified files + if: steps.should_run_tidy.outputs.run == 'true' + # Exeprimental workflow, it won't affect the pre-commit status in case of failure. + continue-on-error: true + run: | + cd "$GITHUB_WORKSPACE/src" + strace -vf -s500 -o CTD.strace python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ + -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ + -p 1 \ + -path "$GITHUB_WORKSPACE/build" \ + -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ + < "$GITHUB_WORKSPACE/pr.diff" + + - name: upload CTD.strace + uses: actions/upload-artifact@v6 with: - ref: ${{ inputs.ref || github.sha }} - testing_mode: full - target_devices: native_cpu:cpu - sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++ - extra_lit_opts: --param sycl_build_targets="native_cpu" - extra_cmake_args: -DSYCL_TEST_E2E_TARGETS="native_cpu:cpu" -DSYCL_TEST_E2E_STANDALONE=ON - - # If a PR changes CUDA adapter, run the build on Ubuntu 22.04 as well. - # Ubuntu 22.04 container has CUDA 12.1 installed while Ubuntu 24.0 image - # has CUDA 12.6.1 installed. - # The idea is to ensure that the code works with both CUDA versions. - build_ubuntu2204: - needs: [detect_changes] - if: ${{ !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur_cuda_adapter') }} - uses: ./.github/workflows/sycl-linux-build.yml - with: - build_ref: ${{ github.sha }} - build_cache_root: "/__w/" - build_cache_suffix: "ubuntu22" - build_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest" - changes: ${{ needs.detect_changes.outputs.filters }} - - toolchain_artifact: sycl_linux_ubuntu22 - - compat_read_exclude: - name: Read compatibility testing exclude list - runs-on: [Linux, aux-tasks] - outputs: - FILTER_6_2: ${{ steps.result.outputs.FILTER_6_2 }} - FILTER_6_3: ${{ steps.result.outputs.FILTER_6_3 }} - steps: - - uses: actions/checkout@v6 - with: - sparse-checkout: | - devops/ - - name: Register cleanup after job is finished - uses: ./devops/actions/cleanup - - id: result - shell: bash - run: | - # Transform to format expected by `llvm-lit --filter-out "pattern1|pattern2|..."`. - # First, remove comments/empty lines, then join lines with "|" as separator. - echo FILTER_6_2="$(grep -v '^#\|^\W*$' devops/compat_ci_exclude.sycl-rel-6_2 | paste -sd '|')" >> $GITHUB_OUTPUT - echo FILTER_6_3="$(grep -v '^#\|^\W*$' devops/compat_ci_exclude.sycl-rel-6_3 | paste -sd '|')" >> $GITHUB_OUTPUT - - E2E: - needs: [build, detect_changes, compat_read_exclude] - if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }} - permissions: - contents: write - packages: read - strategy: - fail-fast: false - matrix: - include: - - name: Intel / GEN 12 Integrated - runner: '["Linux", "gen12"]' - target_devices: level_zero:gpu;opencl:gpu;opencl:cpu - - name: NVIDIA/CUDA - runner: '["Linux", "cuda"]' - image_options: -u 1001 --gpus all --cap-add SYS_ADMIN - target_devices: cuda:gpu - - name: AMD/HIP - runner: '["Linux", "amdgpu"]' - image_options: -u 1001 --device=/dev/dri --device=/dev/kfd - target_devices: hip:gpu - extra_lit_opts: -j 1 - - name: Intel / Arc A-Series Graphics - runner: '["Linux", "arc"]' - target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu - env: '{"LIT_FILTER":"Matrix/"}' - - name: Intel / Ponte Vecchio GPU - runner: '["Linux", "pvc"]' - target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu - - name: Intel / Battlemage Graphics - runner: '["Linux", "bmg"]' - target_devices: level_zero_v1:gpu;level_zero_v2:gpu - - name: Preview Mode - runner: '["Linux", "gen12"]' - target_devices: level_zero:gpu;opencl:gpu;opencl:cpu - extra_lit_opts: --param test-preview-mode=True - binaries_artifact: e2e_bin_preview - - name: Intel / ARL with L0 v2 - runner: '["Linux", "arl"]' - target_devices: level_zero_v2:arch-intel_gpu_mtl_u - extra_lit_opts: --param test-preview-mode=True - - # We're in an ABI-breaking window, so these don't make sense for now. - - name: ABI compatibility / sycl-rel-6_2 - runner: '["Linux", "pvc"]' - image: ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_2 - target_devices: level_zero:gpu - extra_lit_opts: '--param test-preview-mode=False --filter-out "${{ needs.compat_read_exclude.outputs.FILTER_6_2 }}"' - binaries_artifact: 'in-container' - skip_run: true - - name: ABI compatibility / sycl-rel-6_3 - runner: '["Linux", "pvc"]' - image: ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_3 - target_devices: level_zero:gpu - extra_lit_opts: '--param test-preview-mode=False --filter-out "${{ needs.compat_read_exclude.outputs.FILTER_6_3 }}"' - binaries_artifact: 'in-container' - skip_run: true - - uses: ./.github/workflows/sycl-linux-run-tests.yml - with: - name: ${{ matrix.name }} - runner: ${{ matrix.runner }} - image: ${{ matrix.image }} - image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }} - target_devices: ${{ matrix.target_devices }} - extra_lit_opts: ${{ matrix.extra_lit_opts }} - repo_ref: ${{ github.sha }} - toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} - toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} - toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} - binaries_artifact: ${{ matrix.binaries_artifact || 'e2e_bin' }} - testing_mode: 'run-only' - - # Do not install drivers on AMD and CUDA runners. - install_igc_driver: >- - ${{ !contains(matrix.target_devices, 'cuda') && - !contains(matrix.target_devices, 'hip') && - contains(needs.detect_changes.outputs.filters, 'drivers') }} - skip_run: ${{ matrix.skip_run || 'false' }} - env: ${{ matrix.env || (contains(needs.detect_changes.outputs.filters, 'esimd') && '{}' || '{"LIT_FILTER_OUT":"ESIMD/"}') }} - - E2E-with-new-offload-model: - needs: [build, detect_changes, compat_read_exclude] - if: | - !cancelled() && - needs.build.outputs.build_conclusion == 'success' && - contains(github.event.pull_request.labels.*.name, 'new-offload-model') - permissions: - contents: write - packages: read - strategy: - fail-fast: false - matrix: - include: - - name: Intel / GEN 12 Integrated - runner: '["Linux", "gen12"]' - target_devices: opencl:cpu;opencl:gpu - - name: Intel / Arc A-Series Graphics - runner: '["Linux", "arc"]' - target_devices: level_zero:gpu - - name: Intel / Ponte Vecchio GPU - runner: '["Linux", "pvc"]' - target_devices: level_zero:gpu - - name: Intel / Battlemage Graphics - runner: '["Linux", "bmg"]' - target_devices: level_zero_v2:gpu - - name: NVIDIA/CUDA - runner: '["Linux", "cuda"]' - image_options: -u 1001 --gpus all --cap-add SYS_ADMIN - target_devices: cuda:gpu - - name: AMD/HIP - runner: '["Linux", "amdgpu"]' - image_options: -u 1001 --device=/dev/dri --device=/dev/kfd - target_devices: hip:gpu - extra_lit_opts: -j 1 - - uses: ./.github/workflows/sycl-linux-run-tests.yml - with: - name: ${{ matrix.name }} with NewOffloadModel - runner: ${{ matrix.runner }} - image: ${{ matrix.image }} - image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }} - target_devices: ${{ matrix.target_devices }} - extra_lit_opts: ${{ matrix.extra_lit_opts }} --param enable_new_offload_model=True - repo_ref: ${{ github.sha }} - toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} - toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} - toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} - binaries_artifact: 'e2e_bin_new_offload_model' - testing_mode: 'run-only' - - - test-perf: - needs: [build, detect_changes] - permissions: - contents: write - packages: read - if: | - !cancelled() - && needs.build.outputs.build_conclusion == 'success' - && (contains(github.event.pull_request.labels.*.name, 'run-perf-tests') - || contains(needs.detect_changes.outputs.filters, 'perf-tests')) - strategy: - fail-fast: false - matrix: - include: - - name: Intel GEN12 Graphics system - runner: '["Linux", "gen12"]' - image_extra_opts: --device=/dev/dri - - name: Intel Arc A-Series Graphics system - runner: '["Linux", "arc"]' - image_extra_opts: --device=/dev/dri - - name: AMD system - runner: '["Linux", "amdgpu"]' - image_extra_opts: --device=/dev/dri --device=/dev/kfd - - name: CUDA system - runner: '["Linux", "cuda"]' - image_extra_opts: --gpus all - uses: ./.github/workflows/sycl-linux-run-tests.yml - with: - name: Perf tests on ${{ matrix.name }} - runner: ${{ matrix. runner }} - image_options: -u 1001 --privileged --cap-add SYS_ADMIN ${{ matrix.image_extra_opts }} - target_devices: all - - env: '{"LIT_FILTER":"PerformanceTests/"}' - extra_lit_opts: -a -j 1 --param enable-perf-tests=True - - repo_ref: ${{ github.sha }} - - toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} - toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} - toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} + name: CTD.strace + path: "$GITHUB_WORKSPACE/CTD.strace" + retention-days: 1 From f6936eece19fce02d3dc92ec61b6dc3a20e6d459 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 16:59:26 +0100 Subject: [PATCH 09/22] Revert "use-precommit-file" This reverts commit 2a75004579eaa81d69e0843e26850d90868941b5. --- .github/workflows/sycl-linux-build.yml | 9 + .github/workflows/sycl-linux-precommit.yml | 374 ++++++++++++++++----- 2 files changed, 308 insertions(+), 75 deletions(-) diff --git a/.github/workflows/sycl-linux-build.yml b/.github/workflows/sycl-linux-build.yml index 7fe6f9fbff281..0ee25387a5d6e 100644 --- a/.github/workflows/sycl-linux-build.yml +++ b/.github/workflows/sycl-linux-build.yml @@ -214,6 +214,15 @@ 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: Upload compile_commands + if: ${{ !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON') }} + uses: actions/upload-artifact@v6 + with: + name: compile_commands + path: $GITHUB_WORKSPACE/build/compile_commands.json + retention-days: ${{ inputs.retention-days }} + - name: check-llvm if: ${{ !cancelled() && contains(inputs.changes, 'llvm') }} env: diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index f9cc3c470a326..ca06e819a5dea 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -1,94 +1,318 @@ -name: clang-tidy 2 +name: SYCL Pre Commit on Linux on: - pull_requests: + # We rely on "Fork pull request workflows from outside collaborators" - + # "Require approval for all outside collaborators" at + # https://github.com/intel/llvm/settings/actions for security. + pull_request: branches: - sycl + - sycl-rel-** + # Do not run builds if changes are only in the following locations + # Note: benchmark-related paths are the same as in sycl-ur-perf-benchmarking.yml (to run there instead) + paths-ignore: + - '.github/ISSUE_TEMPLATE/**' + - '.github/CODEOWNERS' + - 'sycl/cts_exclude_filter/**' + - 'sycl/doc/**' + - 'sycl/gdb/**' + - 'clang/docs/**' + - '**.md' + - '**.rst' + - '.github/workflows/sycl-windows-*.yml' + - '.github/workflows/sycl-macos-*.yml' + - '.github/workflows/sycl-nightly.yml' + - '.github/workflows/sycl-rel-nightly.yml' + - '.github/workflows/sycl-rel-nightly-launch.yml' + - '.github/workflows/sycl-trivy.yml' + - '.github/workflows/sycl-coverity.yml' + - '.github/workflows/sycl-weekly.yml' + - 'devops/containers/**' + - 'devops/actions/build_container/**' + - 'unified-runtime/examples/**' + - 'unified-runtime/scripts/**' + - 'unified-runtime/test/**' + - 'unified-runtime/third_party/**' + - 'unified-runtime/tools/**' + - 'devops/scripts/benchmarks/**' + - 'devops/actions/run-tests/benchmark/**' + - '.github/workflows/sycl-ur-perf-benchmarking.yml' + +concurrency: + # Cancel a currently running workflow from the same PR, branch or tag. + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true permissions: read-all jobs: - run-clang-tidy: - # Add more conditions - if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} + detect_changes: + uses: ./.github/workflows/sycl-detect-changes.yml + + build: + name: Self build + needs: [detect_changes] + if: success() + uses: ./.github/workflows/sycl-linux-build.yml + with: + build_ref: ${{ github.sha }} + build_cache_root: "/__w/" + build_cache_suffix: "default" + # Docker image has last nightly pre-installed and added to the PATH + build_image: "ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest" + cc: clang + cxx: clang++ + changes: ${{ needs.detect_changes.outputs.filters }} + + toolchain_artifact: sycl_linux_default + e2e_binaries_artifact: e2e_bin + e2e_binaries_preview_artifact: e2e_bin_preview + e2e_binaries_new_offload_model_artifact: e2e_bin_new_offload_model + + # Build and run native cpu e2e tests separately as cannot currently + # build all the e2e tests + build_run_native_cpu_e2e_tests: + if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }} runs-on: [Linux, build] + needs: [build] container: image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest options: -u 1001:1001 steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@v6 with: sparse-checkout: | - devops/actions - devops/scripts/should_run_clang-tidy.py - - name: Register cleanup after job is finished - uses: ./devops/actions/cleanup + devops/ - - name: Check diff - id: should_run_tidy - run: | - echo "Downloading the diff" - curl -L "${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.diff" -o pr.diff - # DEBUG - pwd - ls -lR - - if python3 devops/scripts/should_run_clang-tidy.py pr.diff; then - echo "run=true" >> "$GITHUB_OUTPUT" - else - echo "run=false" >> "$GITHUB_OUTPUT" - fi - - - if: steps.should_run_tidy.outputs.run == 'true' - uses: ./devops/actions/cached_checkout + # download build artefact + - name: Download toolchain + uses: actions/download-artifact@v7 with: - path: src - ref: ${{ github.sha }} - cache_path: "/__w/repo_cache/" - - name: Configure - if: steps.should_run_tidy.outputs.run == 'true' - env: - CC: ${{ inputs.cc }} - CXX: ${{ inputs.cxx }} - CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs" - run: | - mkdir -p $CCACHE_DIR - mkdir -p $GITHUB_WORKSPACE/build - cd $GITHUB_WORKSPACE/build - python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \ - -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build \ - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/toolchain \ - -t Release \ - --ci-defaults --use-zstd ${{ inputs.build_configure_extra_args }} \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DLLVM_INSTALL_UTILS=ON \ - -DSYCL_UR_FORCE_FETCH_LEVEL_ZERO=ON \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - - - name: Preprocess compile_commands.json - if: steps.should_run_tidy.outputs.run == 'true' + name: sycl_linux_default + - name: Extract SYCL toolchain + shell: bash run: | - # Remove commands containing "-D__INTEL_PREVIEW_BREAKING_CHANGES" to avoid running on the same file twice. - 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: Run clang-tidy on modified files - if: steps.should_run_tidy.outputs.run == 'true' - # Exeprimental workflow, it won't affect the pre-commit status in case of failure. - continue-on-error: true - run: | - cd "$GITHUB_WORKSPACE/src" - strace -vf -s500 -o CTD.strace python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ - -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ - -p 1 \ - -path "$GITHUB_WORKSPACE/build" \ - -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ - < "$GITHUB_WORKSPACE/pr.diff" - - - name: upload CTD.strace - uses: actions/upload-artifact@v6 + mkdir toolchain + tar -xf llvm_sycl.tar.zst -C toolchain + rm llvm_sycl.tar.zst + - name: Build and run E2E tests + uses: ./devops/actions/run-tests/linux/e2e with: - name: CTD.strace - path: "$GITHUB_WORKSPACE/CTD.strace" - retention-days: 1 + ref: ${{ inputs.ref || github.sha }} + testing_mode: full + target_devices: native_cpu:cpu + sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++ + extra_lit_opts: --param sycl_build_targets="native_cpu" + extra_cmake_args: -DSYCL_TEST_E2E_TARGETS="native_cpu:cpu" -DSYCL_TEST_E2E_STANDALONE=ON + + # If a PR changes CUDA adapter, run the build on Ubuntu 22.04 as well. + # Ubuntu 22.04 container has CUDA 12.1 installed while Ubuntu 24.0 image + # has CUDA 12.6.1 installed. + # The idea is to ensure that the code works with both CUDA versions. + build_ubuntu2204: + needs: [detect_changes] + if: ${{ !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur_cuda_adapter') }} + uses: ./.github/workflows/sycl-linux-build.yml + with: + build_ref: ${{ github.sha }} + build_cache_root: "/__w/" + build_cache_suffix: "ubuntu22" + build_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest" + changes: ${{ needs.detect_changes.outputs.filters }} + + toolchain_artifact: sycl_linux_ubuntu22 + + compat_read_exclude: + name: Read compatibility testing exclude list + runs-on: [Linux, aux-tasks] + outputs: + FILTER_6_2: ${{ steps.result.outputs.FILTER_6_2 }} + FILTER_6_3: ${{ steps.result.outputs.FILTER_6_3 }} + steps: + - uses: actions/checkout@v6 + with: + sparse-checkout: | + devops/ + - name: Register cleanup after job is finished + uses: ./devops/actions/cleanup + - id: result + shell: bash + run: | + # Transform to format expected by `llvm-lit --filter-out "pattern1|pattern2|..."`. + # First, remove comments/empty lines, then join lines with "|" as separator. + echo FILTER_6_2="$(grep -v '^#\|^\W*$' devops/compat_ci_exclude.sycl-rel-6_2 | paste -sd '|')" >> $GITHUB_OUTPUT + echo FILTER_6_3="$(grep -v '^#\|^\W*$' devops/compat_ci_exclude.sycl-rel-6_3 | paste -sd '|')" >> $GITHUB_OUTPUT + + E2E: + needs: [build, detect_changes, compat_read_exclude] + if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }} + permissions: + contents: write + packages: read + strategy: + fail-fast: false + matrix: + include: + - name: Intel / GEN 12 Integrated + runner: '["Linux", "gen12"]' + target_devices: level_zero:gpu;opencl:gpu;opencl:cpu + - name: NVIDIA/CUDA + runner: '["Linux", "cuda"]' + image_options: -u 1001 --gpus all --cap-add SYS_ADMIN + target_devices: cuda:gpu + - name: AMD/HIP + runner: '["Linux", "amdgpu"]' + image_options: -u 1001 --device=/dev/dri --device=/dev/kfd + target_devices: hip:gpu + extra_lit_opts: -j 1 + - name: Intel / Arc A-Series Graphics + runner: '["Linux", "arc"]' + target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu + env: '{"LIT_FILTER":"Matrix/"}' + - name: Intel / Ponte Vecchio GPU + runner: '["Linux", "pvc"]' + target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu + - name: Intel / Battlemage Graphics + runner: '["Linux", "bmg"]' + target_devices: level_zero_v1:gpu;level_zero_v2:gpu + - name: Preview Mode + runner: '["Linux", "gen12"]' + target_devices: level_zero:gpu;opencl:gpu;opencl:cpu + extra_lit_opts: --param test-preview-mode=True + binaries_artifact: e2e_bin_preview + - name: Intel / ARL with L0 v2 + runner: '["Linux", "arl"]' + target_devices: level_zero_v2:arch-intel_gpu_mtl_u + extra_lit_opts: --param test-preview-mode=True + + # We're in an ABI-breaking window, so these don't make sense for now. + - name: ABI compatibility / sycl-rel-6_2 + runner: '["Linux", "pvc"]' + image: ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_2 + target_devices: level_zero:gpu + extra_lit_opts: '--param test-preview-mode=False --filter-out "${{ needs.compat_read_exclude.outputs.FILTER_6_2 }}"' + binaries_artifact: 'in-container' + skip_run: true + - name: ABI compatibility / sycl-rel-6_3 + runner: '["Linux", "pvc"]' + image: ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_3 + target_devices: level_zero:gpu + extra_lit_opts: '--param test-preview-mode=False --filter-out "${{ needs.compat_read_exclude.outputs.FILTER_6_3 }}"' + binaries_artifact: 'in-container' + skip_run: true + + uses: ./.github/workflows/sycl-linux-run-tests.yml + with: + name: ${{ matrix.name }} + runner: ${{ matrix.runner }} + image: ${{ matrix.image }} + image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }} + target_devices: ${{ matrix.target_devices }} + extra_lit_opts: ${{ matrix.extra_lit_opts }} + repo_ref: ${{ github.sha }} + toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} + toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} + toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} + binaries_artifact: ${{ matrix.binaries_artifact || 'e2e_bin' }} + testing_mode: 'run-only' + + # Do not install drivers on AMD and CUDA runners. + install_igc_driver: >- + ${{ !contains(matrix.target_devices, 'cuda') && + !contains(matrix.target_devices, 'hip') && + contains(needs.detect_changes.outputs.filters, 'drivers') }} + skip_run: ${{ matrix.skip_run || 'false' }} + env: ${{ matrix.env || (contains(needs.detect_changes.outputs.filters, 'esimd') && '{}' || '{"LIT_FILTER_OUT":"ESIMD/"}') }} + + E2E-with-new-offload-model: + needs: [build, detect_changes, compat_read_exclude] + if: | + !cancelled() && + needs.build.outputs.build_conclusion == 'success' && + contains(github.event.pull_request.labels.*.name, 'new-offload-model') + permissions: + contents: write + packages: read + strategy: + fail-fast: false + matrix: + include: + - name: Intel / GEN 12 Integrated + runner: '["Linux", "gen12"]' + target_devices: opencl:cpu;opencl:gpu + - name: Intel / Arc A-Series Graphics + runner: '["Linux", "arc"]' + target_devices: level_zero:gpu + - name: Intel / Ponte Vecchio GPU + runner: '["Linux", "pvc"]' + target_devices: level_zero:gpu + - name: Intel / Battlemage Graphics + runner: '["Linux", "bmg"]' + target_devices: level_zero_v2:gpu + - name: NVIDIA/CUDA + runner: '["Linux", "cuda"]' + image_options: -u 1001 --gpus all --cap-add SYS_ADMIN + target_devices: cuda:gpu + - name: AMD/HIP + runner: '["Linux", "amdgpu"]' + image_options: -u 1001 --device=/dev/dri --device=/dev/kfd + target_devices: hip:gpu + extra_lit_opts: -j 1 + + uses: ./.github/workflows/sycl-linux-run-tests.yml + with: + name: ${{ matrix.name }} with NewOffloadModel + runner: ${{ matrix.runner }} + image: ${{ matrix.image }} + image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }} + target_devices: ${{ matrix.target_devices }} + extra_lit_opts: ${{ matrix.extra_lit_opts }} --param enable_new_offload_model=True + repo_ref: ${{ github.sha }} + toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} + toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} + toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} + binaries_artifact: 'e2e_bin_new_offload_model' + testing_mode: 'run-only' + + + test-perf: + needs: [build, detect_changes] + permissions: + contents: write + packages: read + if: | + !cancelled() + && needs.build.outputs.build_conclusion == 'success' + && (contains(github.event.pull_request.labels.*.name, 'run-perf-tests') + || contains(needs.detect_changes.outputs.filters, 'perf-tests')) + strategy: + fail-fast: false + matrix: + include: + - name: Intel GEN12 Graphics system + runner: '["Linux", "gen12"]' + image_extra_opts: --device=/dev/dri + - name: Intel Arc A-Series Graphics system + runner: '["Linux", "arc"]' + image_extra_opts: --device=/dev/dri + - name: AMD system + runner: '["Linux", "amdgpu"]' + image_extra_opts: --device=/dev/dri --device=/dev/kfd + - name: CUDA system + runner: '["Linux", "cuda"]' + image_extra_opts: --gpus all + uses: ./.github/workflows/sycl-linux-run-tests.yml + with: + name: Perf tests on ${{ matrix.name }} + runner: ${{ matrix. runner }} + image_options: -u 1001 --privileged --cap-add SYS_ADMIN ${{ matrix.image_extra_opts }} + target_devices: all + + env: '{"LIT_FILTER":"PerformanceTests/"}' + extra_lit_opts: -a -j 1 --param enable-perf-tests=True + + repo_ref: ${{ github.sha }} + + toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} + toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} + toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} From 8fe04a2bac6ceebcff26c2d06ca3b4c220011987 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 17:00:05 +0100 Subject: [PATCH 10/22] use-precommit-file --- .github/workflows/sycl-linux-precommit.yml | 373 +++++---------------- 1 file changed, 75 insertions(+), 298 deletions(-) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 70c7a5c4bee2c..f9cc3c470a326 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -1,317 +1,94 @@ -name: SYCL Pre Commit on Linux +name: clang-tidy 2 on: - # We rely on "Fork pull request workflows from outside collaborators" - - # "Require approval for all outside collaborators" at - # https://github.com/intel/llvm/settings/actions for security. - pull_request: + pull_requests: branches: - sycl - - sycl-rel-** - # Do not run builds if changes are only in the following locations - # Note: benchmark-related paths are the same as in sycl-ur-perf-benchmarking.yml (to run there instead) - paths-ignore: - - '.github/ISSUE_TEMPLATE/**' - - '.github/CODEOWNERS' - - 'sycl/cts_exclude_filter/**' - - 'sycl/doc/**' - - 'sycl/gdb/**' - - 'clang/docs/**' - - '**.md' - - '**.rst' - - '.github/workflows/sycl-windows-*.yml' - - '.github/workflows/sycl-macos-*.yml' - - '.github/workflows/sycl-nightly.yml' - - '.github/workflows/sycl-rel-nightly.yml' - - '.github/workflows/sycl-rel-nightly-launch.yml' - - '.github/workflows/sycl-trivy.yml' - - '.github/workflows/sycl-coverity.yml' - - '.github/workflows/sycl-weekly.yml' - - 'devops/containers/**' - - 'devops/actions/build_container/**' - - 'unified-runtime/examples/**' - - 'unified-runtime/scripts/**' - - 'unified-runtime/test/**' - - 'unified-runtime/third_party/**' - - 'unified-runtime/tools/**' - - 'devops/scripts/benchmarks/**' - - 'devops/actions/run-tests/benchmark/**' - - '.github/workflows/sycl-ur-perf-benchmarking.yml' - -concurrency: - # Cancel a currently running workflow from the same PR, branch or tag. - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true permissions: read-all jobs: - detect_changes: - uses: ./.github/workflows/sycl-detect-changes.yml - - build: - name: Self build - needs: [detect_changes] - uses: ./.github/workflows/sycl-linux-build.yml - with: - build_ref: ${{ github.sha }} - build_cache_root: "/__w/" - build_cache_suffix: "default" - # Docker image has last nightly pre-installed and added to the PATH - build_image: "ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest" - cc: clang - cxx: clang++ - changes: ${{ needs.detect_changes.outputs.filters }} - - toolchain_artifact: sycl_linux_default - e2e_binaries_artifact: e2e_bin - e2e_binaries_preview_artifact: e2e_bin_preview - e2e_binaries_new_offload_model_artifact: e2e_bin_new_offload_model - - # Build and run native cpu e2e tests separately as cannot currently - # build all the e2e tests - build_run_native_cpu_e2e_tests: - if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }} + run-clang-tidy: + # Add more conditions + if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} runs-on: [Linux, build] - needs: [build] container: image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest options: -u 1001:1001 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: sparse-checkout: | - devops/ + devops/actions + devops/scripts/should_run_clang-tidy.py + - name: Register cleanup after job is finished + uses: ./devops/actions/cleanup - # download build artefact - - name: Download toolchain - uses: actions/download-artifact@v7 + - name: Check diff + id: should_run_tidy + run: | + echo "Downloading the diff" + curl -L "${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.diff" -o pr.diff + # DEBUG + pwd + ls -lR + + if python3 devops/scripts/should_run_clang-tidy.py pr.diff; then + echo "run=true" >> "$GITHUB_OUTPUT" + else + echo "run=false" >> "$GITHUB_OUTPUT" + fi + + - if: steps.should_run_tidy.outputs.run == 'true' + uses: ./devops/actions/cached_checkout with: - name: sycl_linux_default - - name: Extract SYCL toolchain - shell: bash + path: src + ref: ${{ github.sha }} + cache_path: "/__w/repo_cache/" + - name: Configure + if: steps.should_run_tidy.outputs.run == 'true' + env: + CC: ${{ inputs.cc }} + CXX: ${{ inputs.cxx }} + CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs" + run: | + mkdir -p $CCACHE_DIR + mkdir -p $GITHUB_WORKSPACE/build + cd $GITHUB_WORKSPACE/build + python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \ + -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build \ + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/toolchain \ + -t Release \ + --ci-defaults --use-zstd ${{ inputs.build_configure_extra_args }} \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DLLVM_INSTALL_UTILS=ON \ + -DSYCL_UR_FORCE_FETCH_LEVEL_ZERO=ON \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + - name: Preprocess compile_commands.json + if: steps.should_run_tidy.outputs.run == 'true' run: | - mkdir toolchain - tar -xf llvm_sycl.tar.zst -C toolchain - rm llvm_sycl.tar.zst - - name: Build and run E2E tests - uses: ./devops/actions/run-tests/linux/e2e + # Remove commands containing "-D__INTEL_PREVIEW_BREAKING_CHANGES" to avoid running on the same file twice. + 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: Run clang-tidy on modified files + if: steps.should_run_tidy.outputs.run == 'true' + # Exeprimental workflow, it won't affect the pre-commit status in case of failure. + continue-on-error: true + run: | + cd "$GITHUB_WORKSPACE/src" + strace -vf -s500 -o CTD.strace python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ + -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ + -p 1 \ + -path "$GITHUB_WORKSPACE/build" \ + -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ + < "$GITHUB_WORKSPACE/pr.diff" + + - name: upload CTD.strace + uses: actions/upload-artifact@v6 with: - ref: ${{ inputs.ref || github.sha }} - testing_mode: full - target_devices: native_cpu:cpu - sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++ - extra_lit_opts: --param sycl_build_targets="native_cpu" - extra_cmake_args: -DSYCL_TEST_E2E_TARGETS="native_cpu:cpu" -DSYCL_TEST_E2E_STANDALONE=ON - - # If a PR changes CUDA adapter, run the build on Ubuntu 22.04 as well. - # Ubuntu 22.04 container has CUDA 12.1 installed while Ubuntu 24.0 image - # has CUDA 12.6.1 installed. - # The idea is to ensure that the code works with both CUDA versions. - build_ubuntu2204: - needs: [detect_changes] - if: ${{ !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur_cuda_adapter') }} - uses: ./.github/workflows/sycl-linux-build.yml - with: - build_ref: ${{ github.sha }} - build_cache_root: "/__w/" - build_cache_suffix: "ubuntu22" - build_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest" - changes: ${{ needs.detect_changes.outputs.filters }} - - toolchain_artifact: sycl_linux_ubuntu22 - - compat_read_exclude: - name: Read compatibility testing exclude list - runs-on: [Linux, aux-tasks] - outputs: - FILTER_6_2: ${{ steps.result.outputs.FILTER_6_2 }} - FILTER_6_3: ${{ steps.result.outputs.FILTER_6_3 }} - steps: - - uses: actions/checkout@v6 - with: - sparse-checkout: | - devops/ - - name: Register cleanup after job is finished - uses: ./devops/actions/cleanup - - id: result - shell: bash - run: | - # Transform to format expected by `llvm-lit --filter-out "pattern1|pattern2|..."`. - # First, remove comments/empty lines, then join lines with "|" as separator. - echo FILTER_6_2="$(grep -v '^#\|^\W*$' devops/compat_ci_exclude.sycl-rel-6_2 | paste -sd '|')" >> $GITHUB_OUTPUT - echo FILTER_6_3="$(grep -v '^#\|^\W*$' devops/compat_ci_exclude.sycl-rel-6_3 | paste -sd '|')" >> $GITHUB_OUTPUT - - E2E: - needs: [build, detect_changes, compat_read_exclude] - if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }} - permissions: - contents: write - packages: read - strategy: - fail-fast: false - matrix: - include: - - name: Intel / GEN 12 Integrated - runner: '["Linux", "gen12"]' - target_devices: level_zero:gpu;opencl:gpu;opencl:cpu - - name: NVIDIA/CUDA - runner: '["Linux", "cuda"]' - image_options: -u 1001 --gpus all --cap-add SYS_ADMIN - target_devices: cuda:gpu - - name: AMD/HIP - runner: '["Linux", "amdgpu"]' - image_options: -u 1001 --device=/dev/dri --device=/dev/kfd - target_devices: hip:gpu - extra_lit_opts: -j 1 - - name: Intel / Arc A-Series Graphics - runner: '["Linux", "arc"]' - target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu - env: '{"LIT_FILTER":"Matrix/"}' - - name: Intel / Ponte Vecchio GPU - runner: '["Linux", "pvc"]' - target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu - - name: Intel / Battlemage Graphics - runner: '["Linux", "bmg"]' - target_devices: level_zero_v1:gpu;level_zero_v2:gpu - - name: Preview Mode - runner: '["Linux", "gen12"]' - target_devices: level_zero:gpu;opencl:gpu;opencl:cpu - extra_lit_opts: --param test-preview-mode=True - binaries_artifact: e2e_bin_preview - - name: Intel / ARL with L0 v2 - runner: '["Linux", "arl"]' - target_devices: level_zero_v2:arch-intel_gpu_mtl_u - extra_lit_opts: --param test-preview-mode=True - - # We're in an ABI-breaking window, so these don't make sense for now. - - name: ABI compatibility / sycl-rel-6_2 - runner: '["Linux", "pvc"]' - image: ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_2 - target_devices: level_zero:gpu - extra_lit_opts: '--param test-preview-mode=False --filter-out "${{ needs.compat_read_exclude.outputs.FILTER_6_2 }}"' - binaries_artifact: 'in-container' - skip_run: true - - name: ABI compatibility / sycl-rel-6_3 - runner: '["Linux", "pvc"]' - image: ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_3 - target_devices: level_zero:gpu - extra_lit_opts: '--param test-preview-mode=False --filter-out "${{ needs.compat_read_exclude.outputs.FILTER_6_3 }}"' - binaries_artifact: 'in-container' - skip_run: true - - uses: ./.github/workflows/sycl-linux-run-tests.yml - with: - name: ${{ matrix.name }} - runner: ${{ matrix.runner }} - image: ${{ matrix.image }} - image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }} - target_devices: ${{ matrix.target_devices }} - extra_lit_opts: ${{ matrix.extra_lit_opts }} - repo_ref: ${{ github.sha }} - toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} - toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} - toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} - binaries_artifact: ${{ matrix.binaries_artifact || 'e2e_bin' }} - testing_mode: 'run-only' - - # Do not install drivers on AMD and CUDA runners. - install_igc_driver: >- - ${{ !contains(matrix.target_devices, 'cuda') && - !contains(matrix.target_devices, 'hip') && - contains(needs.detect_changes.outputs.filters, 'drivers') }} - skip_run: ${{ matrix.skip_run || 'false' }} - env: ${{ matrix.env || (contains(needs.detect_changes.outputs.filters, 'esimd') && '{}' || '{"LIT_FILTER_OUT":"ESIMD/"}') }} - - E2E-with-new-offload-model: - needs: [build, detect_changes] - if: | - !cancelled() && - needs.build.outputs.build_conclusion == 'success' && - contains(github.event.pull_request.labels.*.name, 'new-offload-model') - permissions: - contents: write - packages: read - strategy: - fail-fast: false - matrix: - include: - - name: Intel / GEN 12 Integrated - runner: '["Linux", "gen12"]' - target_devices: opencl:cpu;opencl:gpu - - name: Intel / Arc A-Series Graphics - runner: '["Linux", "arc"]' - target_devices: level_zero:gpu - - name: Intel / Ponte Vecchio GPU - runner: '["Linux", "pvc"]' - target_devices: level_zero:gpu - - name: Intel / Battlemage Graphics - runner: '["Linux", "bmg"]' - target_devices: level_zero_v2:gpu - - name: NVIDIA/CUDA - runner: '["Linux", "cuda"]' - image_options: -u 1001 --gpus all --cap-add SYS_ADMIN - target_devices: cuda:gpu - - name: AMD/HIP - runner: '["Linux", "amdgpu"]' - image_options: -u 1001 --device=/dev/dri --device=/dev/kfd - target_devices: hip:gpu - extra_lit_opts: -j 1 - - uses: ./.github/workflows/sycl-linux-run-tests.yml - with: - name: ${{ matrix.name }} with NewOffloadModel - runner: ${{ matrix.runner }} - image: ${{ matrix.image }} - image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }} - target_devices: ${{ matrix.target_devices }} - extra_lit_opts: ${{ matrix.extra_lit_opts }} --param enable_new_offload_model=True - repo_ref: ${{ github.sha }} - toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} - toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} - toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} - binaries_artifact: 'e2e_bin_new_offload_model' - testing_mode: 'run-only' - - - test-perf: - needs: [build, detect_changes] - permissions: - contents: write - packages: read - if: | - !cancelled() - && needs.build.outputs.build_conclusion == 'success' - && (contains(github.event.pull_request.labels.*.name, 'run-perf-tests') - || contains(needs.detect_changes.outputs.filters, 'perf-tests')) - strategy: - fail-fast: false - matrix: - include: - - name: Intel GEN12 Graphics system - runner: '["Linux", "gen12"]' - image_extra_opts: --device=/dev/dri - - name: Intel Arc A-Series Graphics system - runner: '["Linux", "arc"]' - image_extra_opts: --device=/dev/dri - - name: AMD system - runner: '["Linux", "amdgpu"]' - image_extra_opts: --device=/dev/dri --device=/dev/kfd - - name: CUDA system - runner: '["Linux", "cuda"]' - image_extra_opts: --gpus all - uses: ./.github/workflows/sycl-linux-run-tests.yml - with: - name: Perf tests on ${{ matrix.name }} - runner: ${{ matrix. runner }} - image_options: -u 1001 --privileged --cap-add SYS_ADMIN ${{ matrix.image_extra_opts }} - target_devices: all - - env: '{"LIT_FILTER":"PerformanceTests/"}' - extra_lit_opts: -a -j 1 --param enable-perf-tests=True - - repo_ref: ${{ github.sha }} - - toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} - toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} - toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} + name: CTD.strace + path: "$GITHUB_WORKSPACE/CTD.strace" + retention-days: 1 From 77029bf89f9d020223e1e80b00e3d0573dfdccc3 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 17:03:04 +0100 Subject: [PATCH 11/22] fix-error --- .github/workflows/sycl-linux-precommit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index f9cc3c470a326..c87e5be349b44 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -1,7 +1,7 @@ name: clang-tidy 2 on: - pull_requests: + pull_request: branches: - sycl From c3f0fe3733745a82af7dc0c7e44d747ab69c52f2 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 17:16:45 +0100 Subject: [PATCH 12/22] set-env --- .github/workflows/sycl-clang-tidy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sycl-clang-tidy.yml b/.github/workflows/sycl-clang-tidy.yml index fc70629cd90dc..80f060cc4a56c 100644 --- a/.github/workflows/sycl-clang-tidy.yml +++ b/.github/workflows/sycl-clang-tidy.yml @@ -15,6 +15,9 @@ jobs: container: image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest options: -u 1001:1001 + env: + CCACHE_DIR: ${{ inputs.build_cache_root }}/build_cache_${{ inputs.build_cache_suffix }} + CCACHE_MAXSIZE: 8G steps: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: From 994a4a308ad26f9514ab5e79a499ccfc0b168d55 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 4 Feb 2026 17:19:24 +0100 Subject: [PATCH 13/22] set-env --- .github/workflows/sycl-linux-precommit.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index c87e5be349b44..f076a34b7c0c9 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -15,6 +15,9 @@ jobs: container: image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest options: -u 1001:1001 + env: + CCACHE_DIR: ${{ inputs.build_cache_root }}/build_cache_${{ inputs.build_cache_suffix }} + CCACHE_MAXSIZE: 8G steps: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: From 02a15c06b5d119f1d523ceb721a83b2d1ba81ff8 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Thu, 5 Feb 2026 14:27:02 +0100 Subject: [PATCH 14/22] get-rid-of-ccache-and-co --- .github/workflows/sycl-linux-build.yml | 9 --------- .github/workflows/sycl-linux-precommit.yml | 19 ++++--------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/.github/workflows/sycl-linux-build.yml b/.github/workflows/sycl-linux-build.yml index 1e812f958a090..77fea94435e54 100644 --- a/.github/workflows/sycl-linux-build.yml +++ b/.github/workflows/sycl-linux-build.yml @@ -214,15 +214,6 @@ 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: Upload compile_commands - if: ${{ !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON') }} - uses: actions/upload-artifact@v6 - with: - name: compile_commands - path: $GITHUB_WORKSPACE/build/compile_commands.json - retention-days: ${{ inputs.retention-days }} - - name: check-llvm if: ${{ !cancelled() && contains(inputs.changes, 'llvm') }} env: diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index f076a34b7c0c9..335a10067cd2e 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -15,9 +15,6 @@ jobs: container: image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest options: -u 1001:1001 - env: - CCACHE_DIR: ${{ inputs.build_cache_root }}/build_cache_${{ inputs.build_cache_suffix }} - CCACHE_MAXSIZE: 8G steps: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: @@ -51,23 +48,15 @@ jobs: - name: Configure if: steps.should_run_tidy.outputs.run == 'true' env: - CC: ${{ inputs.cc }} - CXX: ${{ inputs.cxx }} + CC: gcc + CXX: g++ CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs" run: | - mkdir -p $CCACHE_DIR mkdir -p $GITHUB_WORKSPACE/build cd $GITHUB_WORKSPACE/build python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \ - -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build \ - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/toolchain \ - -t Release \ - --ci-defaults --use-zstd ${{ inputs.build_configure_extra_args }} \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DLLVM_INSTALL_UTILS=ON \ - -DSYCL_UR_FORCE_FETCH_LEVEL_ZERO=ON \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release \ + --ci-defaults -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Preprocess compile_commands.json if: steps.should_run_tidy.outputs.run == 'true' From e323673066f18037195e77869f5d9c857d4ad627 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 6 Feb 2026 13:50:43 +0100 Subject: [PATCH 15/22] no strace --- .github/workflows/sycl-linux-precommit.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 335a10067cd2e..1e9bd9dac4264 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -71,16 +71,16 @@ jobs: continue-on-error: true run: | cd "$GITHUB_WORKSPACE/src" - strace -vf -s500 -o CTD.strace python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ + python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ -p 1 \ -path "$GITHUB_WORKSPACE/build" \ -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ < "$GITHUB_WORKSPACE/pr.diff" - - name: upload CTD.strace - uses: actions/upload-artifact@v6 - with: - name: CTD.strace - path: "$GITHUB_WORKSPACE/CTD.strace" - retention-days: 1 + # - name: upload CTD.strace + # uses: actions/upload-artifact@v6 + # with: + # name: CTD.strace + # path: "$GITHUB_WORKSPACE/CTD.strace" + # retention-days: 1 From b26e51d5c007fd38a72f6a109df2780316fb1ef5 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 6 Feb 2026 14:51:55 +0100 Subject: [PATCH 16/22] remove-gcc-flags --- .github/workflows/sycl-linux-precommit.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 1e9bd9dac4264..1eb934c4a06c4 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -29,9 +29,6 @@ jobs: run: | echo "Downloading the diff" curl -L "${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.diff" -o pr.diff - # DEBUG - pwd - ls -lR if python3 devops/scripts/should_run_clang-tidy.py pr.diff; then echo "run=true" >> "$GITHUB_OUTPUT" @@ -65,6 +62,14 @@ jobs: 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 + # Remove gcc-specific flags + perl -0777 -pe ' + s/(?:^|[ \t])\-Wno-class-memaccess(?=$|[ \t])//g; + s/(?:^|[ \t])\-Wno-dangling-reference(?=$|[ \t])//g; + s/(?:^|[ \t])\-Wno-stringop-overread(?=$|[ \t])//g; + s/[ \t]{2,}/ /g; + ' -i $GITHUB_WORKSPACE/build/compile_commands.json + - name: Run clang-tidy on modified files if: steps.should_run_tidy.outputs.run == 'true' # Exeprimental workflow, it won't affect the pre-commit status in case of failure. From a2582bf74ee4c4b65e4b20bfb447a2b73e9bf040 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 6 Feb 2026 15:43:23 +0100 Subject: [PATCH 17/22] strace --- .github/workflows/sycl-linux-precommit.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 1eb934c4a06c4..50d1bda437470 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -69,23 +69,25 @@ jobs: s/(?:^|[ \t])\-Wno-stringop-overread(?=$|[ \t])//g; s/[ \t]{2,}/ /g; ' -i $GITHUB_WORKSPACE/build/compile_commands.json - + - run: | + sudo apt-get update + sudo apt-get install -y strace - name: Run clang-tidy on modified files if: steps.should_run_tidy.outputs.run == 'true' # Exeprimental workflow, it won't affect the pre-commit status in case of failure. continue-on-error: true run: | cd "$GITHUB_WORKSPACE/src" - python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ + strace -vf -s500 -o CTD.strace python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ -p 1 \ -path "$GITHUB_WORKSPACE/build" \ -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ < "$GITHUB_WORKSPACE/pr.diff" - # - name: upload CTD.strace - # uses: actions/upload-artifact@v6 - # with: - # name: CTD.strace - # path: "$GITHUB_WORKSPACE/CTD.strace" - # retention-days: 1 + - name: upload CTD.strace + uses: actions/upload-artifact@v6 + with: + name: CTD.strace + path: "$GITHUB_WORKSPACE/CTD.strace" + retention-days: 1 From b7dc6a433ec793401d331558690b82333ba4880c Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 6 Feb 2026 15:46:04 +0100 Subject: [PATCH 18/22] fix-strace-log-path --- .github/workflows/sycl-linux-precommit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 50d1bda437470..0464848af246b 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -89,5 +89,5 @@ jobs: uses: actions/upload-artifact@v6 with: name: CTD.strace - path: "$GITHUB_WORKSPACE/CTD.strace" + path: src/CTD.strace retention-days: 1 From 6ff99463ed8f1b8ca165a5ed4e97273e19064d5a Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 6 Feb 2026 18:18:37 +0100 Subject: [PATCH 19/22] final? --- .github/workflows/sycl-clang-tidy.yml | 45 +-- .github/workflows/sycl-linux-precommit.yml | 372 +++++++++++++++++---- 2 files changed, 314 insertions(+), 103 deletions(-) diff --git a/.github/workflows/sycl-clang-tidy.yml b/.github/workflows/sycl-clang-tidy.yml index 80f060cc4a56c..8791da8255e71 100644 --- a/.github/workflows/sycl-clang-tidy.yml +++ b/.github/workflows/sycl-clang-tidy.yml @@ -1,23 +1,16 @@ name: clang-tidy on: - pull_requests: - branches: - - sycl + workflow_call: permissions: read-all jobs: run-clang-tidy: - # Add more conditions - if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} runs-on: [Linux, build] container: image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest options: -u 1001:1001 - env: - CCACHE_DIR: ${{ inputs.build_cache_root }}/build_cache_${{ inputs.build_cache_suffix }} - CCACHE_MAXSIZE: 8G steps: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: @@ -32,9 +25,6 @@ jobs: run: | echo "Downloading the diff" curl -L "${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.diff" -o pr.diff - # DEBUG - pwd - ls -lR if python3 devops/scripts/should_run_clang-tidy.py pr.diff; then echo "run=true" >> "$GITHUB_OUTPUT" @@ -51,23 +41,15 @@ jobs: - name: Configure if: steps.should_run_tidy.outputs.run == 'true' env: - CC: ${{ inputs.cc }} - CXX: ${{ inputs.cxx }} + CC: gcc + CXX: g++ CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs" run: | - mkdir -p $CCACHE_DIR mkdir -p $GITHUB_WORKSPACE/build cd $GITHUB_WORKSPACE/build python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \ - -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build \ - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/toolchain \ - -t Release \ - --ci-defaults --use-zstd ${{ inputs.build_configure_extra_args }} \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DLLVM_INSTALL_UTILS=ON \ - -DSYCL_UR_FORCE_FETCH_LEVEL_ZERO=ON \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release \ + --ci-defaults -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Preprocess compile_commands.json if: steps.should_run_tidy.outputs.run == 'true' @@ -76,22 +58,23 @@ jobs: 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 + # Remove gcc-specific flags + perl -0777 -pe ' + s/(?:^|[ \t])\-Wno-class-memaccess(?=$|[ \t])//g; + s/(?:^|[ \t])\-Wno-dangling-reference(?=$|[ \t])//g; + s/(?:^|[ \t])\-Wno-stringop-overread(?=$|[ \t])//g; + s/[ \t]{2,}/ /g; + ' -i $GITHUB_WORKSPACE/build/compile_commands.json + - name: Run clang-tidy on modified files if: steps.should_run_tidy.outputs.run == 'true' # Exeprimental workflow, it won't affect the pre-commit status in case of failure. continue-on-error: true run: | cd "$GITHUB_WORKSPACE/src" - strace -vf -s500 -o CTD.strace python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ + python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ -p 1 \ -path "$GITHUB_WORKSPACE/build" \ -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ < "$GITHUB_WORKSPACE/pr.diff" - - - name: upload CTD.strace - uses: actions/upload-artifact@v6 - with: - name: CTD.strace - path: "$GITHUB_WORKSPACE/CTD.strace" - retention-days: 1 diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 0464848af246b..2f986a96fb978 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -1,93 +1,321 @@ -name: clang-tidy 2 +name: SYCL Pre Commit on Linux on: + # We rely on "Fork pull request workflows from outside collaborators" - + # "Require approval for all outside collaborators" at + # https://github.com/intel/llvm/settings/actions for security. pull_request: branches: - sycl + - sycl-rel-** + # Do not run builds if changes are only in the following locations + # Note: benchmark-related paths are the same as in sycl-ur-perf-benchmarking.yml (to run there instead) + paths-ignore: + - '.github/ISSUE_TEMPLATE/**' + - '.github/CODEOWNERS' + - 'sycl/cts_exclude_filter/**' + - 'sycl/doc/**' + - 'sycl/gdb/**' + - 'clang/docs/**' + - '**.md' + - '**.rst' + - '.github/workflows/sycl-windows-*.yml' + - '.github/workflows/sycl-macos-*.yml' + - '.github/workflows/sycl-nightly.yml' + - '.github/workflows/sycl-rel-nightly.yml' + - '.github/workflows/sycl-rel-nightly-launch.yml' + - '.github/workflows/sycl-trivy.yml' + - '.github/workflows/sycl-coverity.yml' + - '.github/workflows/sycl-weekly.yml' + - 'devops/containers/**' + - 'devops/actions/build_container/**' + - 'unified-runtime/examples/**' + - 'unified-runtime/scripts/**' + - 'unified-runtime/test/**' + - 'unified-runtime/third_party/**' + - 'unified-runtime/tools/**' + - 'devops/scripts/benchmarks/**' + - 'devops/actions/run-tests/benchmark/**' + - '.github/workflows/sycl-ur-perf-benchmarking.yml' + +concurrency: + # Cancel a currently running workflow from the same PR, branch or tag. + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true permissions: read-all jobs: - run-clang-tidy: - # Add more conditions + detect_changes: + uses: ./.github/workflows/sycl-detect-changes.yml + + build: + name: Self build + needs: [detect_changes] + uses: ./.github/workflows/sycl-linux-build.yml + with: + build_ref: ${{ github.sha }} + build_cache_root: "/__w/" + build_cache_suffix: "default" + # Docker image has last nightly pre-installed and added to the PATH + build_image: "ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest" + cc: clang + cxx: clang++ + changes: ${{ needs.detect_changes.outputs.filters }} + + toolchain_artifact: sycl_linux_default + e2e_binaries_artifact: e2e_bin + e2e_binaries_preview_artifact: e2e_bin_preview + e2e_binaries_new_offload_model_artifact: e2e_bin_new_offload_model + + clang-tidy: + needs: detect_changes if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} + + # Build and run native cpu e2e tests separately as cannot currently + # build all the e2e tests + build_run_native_cpu_e2e_tests: + if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }} runs-on: [Linux, build] + needs: [build] container: image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest options: -u 1001:1001 steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@v6 with: sparse-checkout: | - devops/actions - devops/scripts/should_run_clang-tidy.py - - name: Register cleanup after job is finished - uses: ./devops/actions/cleanup - - - name: Check diff - id: should_run_tidy - run: | - echo "Downloading the diff" - curl -L "${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.diff" -o pr.diff + devops/ - if python3 devops/scripts/should_run_clang-tidy.py pr.diff; then - echo "run=true" >> "$GITHUB_OUTPUT" - else - echo "run=false" >> "$GITHUB_OUTPUT" - fi - - - if: steps.should_run_tidy.outputs.run == 'true' - uses: ./devops/actions/cached_checkout + # download build artefact + - name: Download toolchain + uses: actions/download-artifact@v7 with: - path: src - ref: ${{ github.sha }} - cache_path: "/__w/repo_cache/" - - name: Configure - if: steps.should_run_tidy.outputs.run == 'true' - env: - CC: gcc - CXX: g++ - CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs" - run: | - mkdir -p $GITHUB_WORKSPACE/build - cd $GITHUB_WORKSPACE/build - python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \ - -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release \ - --ci-defaults -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - - - name: Preprocess compile_commands.json - if: steps.should_run_tidy.outputs.run == 'true' - run: | - # Remove commands containing "-D__INTEL_PREVIEW_BREAKING_CHANGES" to avoid running on the same file twice. - 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 - - # Remove gcc-specific flags - perl -0777 -pe ' - s/(?:^|[ \t])\-Wno-class-memaccess(?=$|[ \t])//g; - s/(?:^|[ \t])\-Wno-dangling-reference(?=$|[ \t])//g; - s/(?:^|[ \t])\-Wno-stringop-overread(?=$|[ \t])//g; - s/[ \t]{2,}/ /g; - ' -i $GITHUB_WORKSPACE/build/compile_commands.json - - run: | - sudo apt-get update - sudo apt-get install -y strace - - name: Run clang-tidy on modified files - if: steps.should_run_tidy.outputs.run == 'true' - # Exeprimental workflow, it won't affect the pre-commit status in case of failure. - continue-on-error: true + name: sycl_linux_default + - name: Extract SYCL toolchain + shell: bash run: | - cd "$GITHUB_WORKSPACE/src" - strace -vf -s500 -o CTD.strace python3 "$GITHUB_WORKSPACE/src/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py" \ - -clang-tidy-binary "/opt/sycl/bin/clang-tidy" \ - -p 1 \ - -path "$GITHUB_WORKSPACE/build" \ - -checks "clang-analyzer-*,bugprone-*,performance-*,-bugprone-std-namespace-modification" \ - < "$GITHUB_WORKSPACE/pr.diff" - - - name: upload CTD.strace - uses: actions/upload-artifact@v6 + mkdir toolchain + tar -xf llvm_sycl.tar.zst -C toolchain + rm llvm_sycl.tar.zst + - name: Build and run E2E tests + uses: ./devops/actions/run-tests/linux/e2e with: - name: CTD.strace - path: src/CTD.strace - retention-days: 1 + ref: ${{ inputs.ref || github.sha }} + testing_mode: full + target_devices: native_cpu:cpu + sycl_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++ + extra_lit_opts: --param sycl_build_targets="native_cpu" + extra_cmake_args: -DSYCL_TEST_E2E_TARGETS="native_cpu:cpu" -DSYCL_TEST_E2E_STANDALONE=ON + + # If a PR changes CUDA adapter, run the build on Ubuntu 22.04 as well. + # Ubuntu 22.04 container has CUDA 12.1 installed while Ubuntu 24.0 image + # has CUDA 12.6.1 installed. + # The idea is to ensure that the code works with both CUDA versions. + build_ubuntu2204: + needs: [detect_changes] + if: ${{ !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur_cuda_adapter') }} + uses: ./.github/workflows/sycl-linux-build.yml + with: + build_ref: ${{ github.sha }} + build_cache_root: "/__w/" + build_cache_suffix: "ubuntu22" + build_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest" + changes: ${{ needs.detect_changes.outputs.filters }} + + toolchain_artifact: sycl_linux_ubuntu22 + + compat_read_exclude: + name: Read compatibility testing exclude list + runs-on: [Linux, aux-tasks] + outputs: + FILTER_6_2: ${{ steps.result.outputs.FILTER_6_2 }} + FILTER_6_3: ${{ steps.result.outputs.FILTER_6_3 }} + steps: + - uses: actions/checkout@v6 + with: + sparse-checkout: | + devops/ + - name: Register cleanup after job is finished + uses: ./devops/actions/cleanup + - id: result + shell: bash + run: | + # Transform to format expected by `llvm-lit --filter-out "pattern1|pattern2|..."`. + # First, remove comments/empty lines, then join lines with "|" as separator. + echo FILTER_6_2="$(grep -v '^#\|^\W*$' devops/compat_ci_exclude.sycl-rel-6_2 | paste -sd '|')" >> $GITHUB_OUTPUT + echo FILTER_6_3="$(grep -v '^#\|^\W*$' devops/compat_ci_exclude.sycl-rel-6_3 | paste -sd '|')" >> $GITHUB_OUTPUT + + E2E: + needs: [build, detect_changes, compat_read_exclude] + if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }} + permissions: + contents: write + packages: read + strategy: + fail-fast: false + matrix: + include: + - name: Intel / GEN 12 Integrated + runner: '["Linux", "gen12"]' + target_devices: level_zero:gpu;opencl:gpu;opencl:cpu + - name: NVIDIA/CUDA + runner: '["Linux", "cuda"]' + image_options: -u 1001 --gpus all --cap-add SYS_ADMIN + target_devices: cuda:gpu + - name: AMD/HIP + runner: '["Linux", "amdgpu"]' + image_options: -u 1001 --device=/dev/dri --device=/dev/kfd + target_devices: hip:gpu + extra_lit_opts: -j 1 + - name: Intel / Arc A-Series Graphics + runner: '["Linux", "arc"]' + target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu + env: '{"LIT_FILTER":"Matrix/"}' + - name: Intel / Ponte Vecchio GPU + runner: '["Linux", "pvc"]' + target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu + - name: Intel / Battlemage Graphics + runner: '["Linux", "bmg"]' + target_devices: level_zero_v1:gpu;level_zero_v2:gpu + - name: Preview Mode + runner: '["Linux", "gen12"]' + target_devices: level_zero:gpu;opencl:gpu;opencl:cpu + extra_lit_opts: --param test-preview-mode=True + binaries_artifact: e2e_bin_preview + - name: Intel / ARL with L0 v2 + runner: '["Linux", "arl"]' + target_devices: level_zero_v2:arch-intel_gpu_mtl_u + extra_lit_opts: --param test-preview-mode=True + + # We're in an ABI-breaking window, so these don't make sense for now. + - name: ABI compatibility / sycl-rel-6_2 + runner: '["Linux", "pvc"]' + image: ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_2 + target_devices: level_zero:gpu + extra_lit_opts: '--param test-preview-mode=False --filter-out "${{ needs.compat_read_exclude.outputs.FILTER_6_2 }}"' + binaries_artifact: 'in-container' + skip_run: true + - name: ABI compatibility / sycl-rel-6_3 + runner: '["Linux", "pvc"]' + image: ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_3 + target_devices: level_zero:gpu + extra_lit_opts: '--param test-preview-mode=False --filter-out "${{ needs.compat_read_exclude.outputs.FILTER_6_3 }}"' + binaries_artifact: 'in-container' + skip_run: true + + uses: ./.github/workflows/sycl-linux-run-tests.yml + with: + name: ${{ matrix.name }} + runner: ${{ matrix.runner }} + image: ${{ matrix.image }} + image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }} + target_devices: ${{ matrix.target_devices }} + extra_lit_opts: ${{ matrix.extra_lit_opts }} + repo_ref: ${{ github.sha }} + toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} + toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} + toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} + binaries_artifact: ${{ matrix.binaries_artifact || 'e2e_bin' }} + testing_mode: 'run-only' + + # Do not install drivers on AMD and CUDA runners. + install_igc_driver: >- + ${{ !contains(matrix.target_devices, 'cuda') && + !contains(matrix.target_devices, 'hip') && + contains(needs.detect_changes.outputs.filters, 'drivers') }} + skip_run: ${{ matrix.skip_run || 'false' }} + env: ${{ matrix.env || (contains(needs.detect_changes.outputs.filters, 'esimd') && '{}' || '{"LIT_FILTER_OUT":"ESIMD/"}') }} + + E2E-with-new-offload-model: + needs: [build, detect_changes] + if: | + !cancelled() && + needs.build.outputs.build_conclusion == 'success' && + contains(github.event.pull_request.labels.*.name, 'new-offload-model') + permissions: + contents: write + packages: read + strategy: + fail-fast: false + matrix: + include: + - name: Intel / GEN 12 Integrated + runner: '["Linux", "gen12"]' + target_devices: opencl:cpu;opencl:gpu + - name: Intel / Arc A-Series Graphics + runner: '["Linux", "arc"]' + target_devices: level_zero:gpu + - name: Intel / Ponte Vecchio GPU + runner: '["Linux", "pvc"]' + target_devices: level_zero:gpu + - name: Intel / Battlemage Graphics + runner: '["Linux", "bmg"]' + target_devices: level_zero_v2:gpu + - name: NVIDIA/CUDA + runner: '["Linux", "cuda"]' + image_options: -u 1001 --gpus all --cap-add SYS_ADMIN + target_devices: cuda:gpu + - name: AMD/HIP + runner: '["Linux", "amdgpu"]' + image_options: -u 1001 --device=/dev/dri --device=/dev/kfd + target_devices: hip:gpu + extra_lit_opts: -j 1 + + uses: ./.github/workflows/sycl-linux-run-tests.yml + with: + name: ${{ matrix.name }} with NewOffloadModel + runner: ${{ matrix.runner }} + image: ${{ matrix.image }} + image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }} + target_devices: ${{ matrix.target_devices }} + extra_lit_opts: ${{ matrix.extra_lit_opts }} --param enable_new_offload_model=True + repo_ref: ${{ github.sha }} + toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} + toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} + toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} + binaries_artifact: 'e2e_bin_new_offload_model' + testing_mode: 'run-only' + + + test-perf: + needs: [build, detect_changes] + permissions: + contents: write + packages: read + if: | + !cancelled() + && needs.build.outputs.build_conclusion == 'success' + && (contains(github.event.pull_request.labels.*.name, 'run-perf-tests') + || contains(needs.detect_changes.outputs.filters, 'perf-tests')) + strategy: + fail-fast: false + matrix: + include: + - name: Intel GEN12 Graphics system + runner: '["Linux", "gen12"]' + image_extra_opts: --device=/dev/dri + - name: Intel Arc A-Series Graphics system + runner: '["Linux", "arc"]' + image_extra_opts: --device=/dev/dri + - name: AMD system + runner: '["Linux", "amdgpu"]' + image_extra_opts: --device=/dev/dri --device=/dev/kfd + - name: CUDA system + runner: '["Linux", "cuda"]' + image_extra_opts: --gpus all + uses: ./.github/workflows/sycl-linux-run-tests.yml + with: + name: Perf tests on ${{ matrix.name }} + runner: ${{ matrix. runner }} + image_options: -u 1001 --privileged --cap-add SYS_ADMIN ${{ matrix.image_extra_opts }} + target_devices: all + + env: '{"LIT_FILTER":"PerformanceTests/"}' + extra_lit_opts: -a -j 1 --param enable-perf-tests=True + + repo_ref: ${{ github.sha }} + + toolchain_artifact: ${{ needs.build.outputs.toolchain_artifact }} + toolchain_artifact_filename: ${{ needs.build.outputs.toolchain_artifact_filename }} + toolchain_decompress_command: ${{ needs.build.outputs.toolchain_decompress_command }} From 5b6d8cfbd0d2a7c9efebb71429015a4ba99589fb Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 6 Feb 2026 18:19:47 +0100 Subject: [PATCH 20/22] forgot uses --- .github/workflows/sycl-linux-precommit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 2f986a96fb978..0aea94e95af71 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -71,6 +71,7 @@ jobs: clang-tidy: needs: detect_changes if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} + uses: ./.github/workflows/sycl-clang-tidy.yml # Build and run native cpu e2e tests separately as cannot currently # build all the e2e tests From ce96468e9a342c7eed776fe6e67904084fd79e99 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 6 Feb 2026 18:28:40 +0100 Subject: [PATCH 21/22] remove-needs --- .github/workflows/sycl-linux-precommit.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index 0aea94e95af71..7b871b36243a9 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -69,7 +69,6 @@ jobs: e2e_binaries_new_offload_model_artifact: e2e_bin_new_offload_model clang-tidy: - needs: detect_changes if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-lint') }} uses: ./.github/workflows/sycl-clang-tidy.yml From da566f5d1b2011b148f0b23ce4093592198eaa31 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 6 Feb 2026 18:31:54 +0100 Subject: [PATCH 22/22] checkout-scripts-folder --- .github/workflows/sycl-clang-tidy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sycl-clang-tidy.yml b/.github/workflows/sycl-clang-tidy.yml index 8791da8255e71..d258b5527e6f3 100644 --- a/.github/workflows/sycl-clang-tidy.yml +++ b/.github/workflows/sycl-clang-tidy.yml @@ -16,7 +16,7 @@ jobs: with: sparse-checkout: | devops/actions - devops/scripts/should_run_clang-tidy.py + devops/scripts - name: Register cleanup after job is finished uses: ./devops/actions/cleanup