diff --git a/.github/workflows/sycl_detect_changes.yml b/.github/workflows/sycl_detect_changes.yml new file mode 100644 index 0000000000000..9c5bb2447fa78 --- /dev/null +++ b/.github/workflows/sycl_detect_changes.yml @@ -0,0 +1,50 @@ +name: Identify impacted LIT tests +# Outlined into a separate reusable workflow to ease testing for new rules. + +on: + workflow_call: + outputs: + filters: + description: Matched filters + value: ${{ jobs.need_check.outputs.filters }} + +jobs: + need_check: + name: Decide which tests could be affected by the changes + # Github's ubuntu-* runners are slow to allocate. Use our CUDA runner since + # we don't use it for anything right now. + runs-on: cuda + timeout-minutes: 3 + outputs: + filters: ${{ steps.changes.outputs.changes }} + steps: + - name: Check file changes + uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 + id: changes + with: + filters: | + llvm: &llvm + - 'llvm/**' + llvm_spirv: &llvm_spirv + - *llvm + - 'llvm-spirv/**' + clang: &clang + - *llvm + - 'clang/**' + sycl_fusion: &sycl-fusion + - *llvm + - 'sycl-fusion/**' + xptifw: &xptifw + - 'xptifw/**' + libclc: &libclc + - *llvm_spirv + - *clang + - 'libclc/**' + sycl: + - *clang + - *sycl-fusion + - *llvm_spirv + - *xptifw + - *libclc + - 'sycl/*' + - 'sycl/!(test-e2e)/**' diff --git a/.github/workflows/sycl_linux_build_and_test.yml b/.github/workflows/sycl_linux_build_and_test.yml index 1c953699e21d3..93eadd1faa533 100644 --- a/.github/workflows/sycl_linux_build_and_test.yml +++ b/.github/workflows/sycl_linux_build_and_test.yml @@ -64,34 +64,11 @@ on: type: string required: false default: 'SYCL-2020' - check_llvm: + check_filters: type: string + description: 'Filter matches for the changed files in the PR' + default: '[llvm, clang, sycl, llvm_spirv, xptifw, libclc, libdevice]' required: false - default: 'true' - check_clang: - type: string - required: false - default: 'true' - check_sycl: - type: string - required: false - default: 'true' - check_llvm_spirv: - type: string - required: false - default: 'true' - check_xptifw: - type: string - required: false - default: 'true' - check_libclc: - type: string - required: false - default: 'true' - check_libdevice: - type: string - required: false - default: 'true' jobs: build: @@ -136,36 +113,36 @@ jobs: - name: Compile id: build run: cmake --build $GITHUB_WORKSPACE/build - # TODO allow to optionally disable in-tree checks - name: check-llvm - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm == 'true' }} + if: always() && !cancelled() && contains(inputs.check_filters, 'llvm') run: | cmake --build $GITHUB_WORKSPACE/build --target check-llvm - name: check-clang - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_clang == 'true' }} + if: always() && !cancelled() && contains(inputs.check_filters, 'clang') run: | + # Can we move this to Dockerfile? Hopefully, noop on Windows. export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache cmake --build $GITHUB_WORKSPACE/build --target check-clang - name: check-sycl - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_sycl == 'true' }} + if: always() && !cancelled() && contains(inputs.check_filters, 'sycl') run: | - # TODO consider moving this to Dockerfile + # TODO consider moving this to Dockerfile. export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH cmake --build $GITHUB_WORKSPACE/build --target check-sycl - name: check-llvm-spirv - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm_spirv == 'true' }} + if: always() && !cancelled() && contains(inputs.check_filters, 'llvm_spirv') run: | cmake --build $GITHUB_WORKSPACE/build --target check-llvm-spirv - name: check-xptifw - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_xptifw == 'true' }} + if: always() && !cancelled() && contains(inputs.check_filters, 'xptifw') run: | cmake --build $GITHUB_WORKSPACE/build --target check-xptifw - name: check-libclc - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_libclc == 'true' }} + if: always() && !cancelled() && contains(inputs.check_filters, 'libclc') run: | cmake --build $GITHUB_WORKSPACE/build --target check-libclc - name: check-libdevice - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_libdevice == 'true' }} + if: always() && !cancelled() && contains(inputs.check_filters, 'libdevice') run: | cmake --build $GITHUB_WORKSPACE/build --target check-libdevice - name: Install diff --git a/.github/workflows/sycl_precommit.yml b/.github/workflows/sycl_precommit.yml index 5bb13cf395dfa..64fe2e1253549 100644 --- a/.github/workflows/sycl_precommit.yml +++ b/.github/workflows/sycl_precommit.yml @@ -27,53 +27,8 @@ permissions: contents: read jobs: - need_check: - name: Decide which tests could be affected by the changes - runs-on: ubuntu-22.04 - timeout-minutes: 3 - outputs: - llvm: ${{ steps.changes.outputs.llvm == 'true' }} - llvm_spirv: ${{ steps.changes.outputs.llvm_spirv == 'true' }} - clang: ${{ steps.changes.outputs.clang == 'true' }} - xptifw: ${{ steps.changes.outputs.xptifw == 'true' }} - libclc: ${{ steps.changes.outputs.libclc == 'true' }} - sycl: ${{ steps.changes.outputs.sycl == 'true' }} - steps: - - name: Check file changes - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 - id: changes - with: - filters: | - llvm: &llvm - - 'llvm/**' - llvm_spirv: &llvm_spirv - - *llvm - - 'llvm-spirv/**' - clang: &clang - - *llvm - - 'clang/**' - sycl_fusion: &sycl-fusion - - *llvm - - 'sycl-fusion/**' - xptifw: &xptifw - - 'xptifw/**' - libclc: &libclc - - *llvm_spirv - - *clang - - 'libclc/**' - libdevice: &libdevice - - *llvm_spirv - - *clang - - 'libdevice/**' - sycl: - - *clang - - *sycl-fusion - - *llvm_spirv - - *xptifw - - *libclc - - *libdevice - - 'sycl/*' - - 'sycl/!(test-e2e)/**' + detect_changes: + uses: ./.github/workflows/sycl_detect_changes.yml lint: runs-on: ubuntu-22.04 @@ -102,7 +57,7 @@ jobs: name: Linux # Only build and test patches, that have passed all linter checks, because # the next commit is likely to be a follow-up on that job. - needs: [lint, test_matrix, need_check] + needs: [lint, test_matrix, detect_changes] if: always() && (success() || contains(github.event.pull_request.labels.*.name, 'ignore-lint')) uses: ./.github/workflows/sycl_linux_build_and_test.yml secrets: inherit @@ -114,24 +69,14 @@ jobs: build_cache_suffix: "default" lts_matrix: ${{ needs.test_matrix.outputs.lts_lx_matrix }} lts_aws_matrix: ${{ needs.test_matrix.outputs.lts_aws_matrix }} - check_llvm: ${{ needs.need_check.outputs.llvm }} - check_llvm_spirv: ${{ needs.need_check.outputs.llvm_spirv }} - check_clang: ${{ needs.need_check.outputs.clang }} - check_xptifw: ${{ needs.need_check.outputs.xptifw }} - check_libclc: ${{ needs.need_check.outputs.libclc }} - check_sycl: ${{ needs.need_check.outputs.sycl }} + check_filters: ${{ needs.detect_changes.outputs.filters }} windows_default: name: Windows - needs: [lint, test_matrix, need_check] + needs: [lint, test_matrix, detect_changes] if: github.repository == 'intel/llvm' uses: ./.github/workflows/sycl_windows_build_and_test.yml with: lts_matrix: ${{ needs.test_matrix.outputs.lts_wn_matrix }} build_ref: ${{ github.event.pull_request.head.sha }} - check_llvm: ${{ needs.need_check.outputs.llvm }} - check_llvm_spirv: ${{ needs.need_check.outputs.llvm_spirv }} - check_clang: ${{ needs.need_check.outputs.clang }} - check_xptifw: ${{ needs.need_check.outputs.xptifw }} - check_libclc: ${{ needs.need_check.outputs.libclc }} - check_sycl: ${{ needs.need_check.outputs.sycl }} + check_filters: ${{ needs.detect_changes.outputs.filters }} diff --git a/.github/workflows/sycl_windows_build_and_test.yml b/.github/workflows/sycl_windows_build_and_test.yml index d9e7e4642d386..4759ae23ffdb3 100644 --- a/.github/workflows/sycl_windows_build_and_test.yml +++ b/.github/workflows/sycl_windows_build_and_test.yml @@ -18,34 +18,11 @@ on: type: string required: false default: "" - check_llvm: + check_filters: type: string + description: 'Filter matches for the changed files in the PR' + default: '[llvm, clang, sycl, llvm_spirv, xptifw, libclc, libdevice]' required: false - default: 'true' - check_clang: - type: string - required: false - default: 'true' - check_sycl: - type: string - required: false - default: 'true' - check_llvm_spirv: - type: string - required: false - default: 'true' - check_xptifw: - type: string - required: false - default: 'true' - check_libclc: - type: string - required: false - default: 'true' - check_libdevice: - type: string - required: false - default: 'true' jobs: build: @@ -94,33 +71,27 @@ jobs: run: | cmake --build build --target sycl-toolchain - name: check-llvm - shell: bash - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm == 'true' }} + if: always() && !cancelled() && contains(inputs.check_filters, 'llvm') run: | cmake --build build --target check-llvm - name: check-clang - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_clang == 'true' }} - shell: bash + if: always() && !cancelled() && contains(inputs.check_filters, 'clang') run: | cmake --build build --target check-clang - name: check-sycl - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_sycl == 'true' }} - shell: bash + if: always() && !cancelled() && contains(inputs.check_filters, 'sycl') run: | cmake --build build --target check-sycl - name: check-llvm-spirv - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm_spirv == 'true' }} - shell: bash + if: always() && !cancelled() && contains(inputs.check_filters, 'llvm_spirv') run: | cmake --build build --target check-llvm-spirv - name: check-xptifw - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_xptifw == 'true' }} - shell: bash + if: always() && !cancelled() && contains(inputs.check_filters, 'xptifw') run: | cmake --build build --target check-xptifw - name: check-libdevice - if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_libdevice == 'true' }} - shell: bash + if: always() && !cancelled() && contains(inputs.check_filters, 'libdevice') run: | cmake --build build --target check-libdevice - name: Install