Skip to content

Commit 155a013

Browse files
authored
[SPIR-V] Add pre-commit CI workflow (#74092)
Add a pre-commit CI workflow for the experimental SPIR-V backend. This action should only run when SPIR-V target or test files are modified. The `codegen-spirv` tests don't run as part of `check-all` because the SPIR-V backend is still experimental. Depends on #73371 (for a green tree)
1 parent d40eb0a commit 155a013

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

.github/workflows/llvm-project-tests.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
required: false
1111
projects:
1212
required: false
13+
extra_cmake_args:
14+
required: false
15+
os_list:
16+
required: false
17+
default: '["ubuntu-latest", "windows-2019", "macOS-11"]'
1318
workflow_call:
1419
inputs:
1520
build_target:
@@ -20,6 +25,19 @@ on:
2025
required: true
2126
type: string
2227

28+
extra_cmake_args:
29+
required: false
30+
type: string
31+
32+
os_list:
33+
required: false
34+
type: string
35+
# Use windows-2019 due to:
36+
# https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
37+
# We're using a specific version of macOS due to:
38+
# https://github.com/actions/virtual-environments/issues/5900
39+
default: '["ubuntu-latest", "windows-2019", "macOS-11"]'
40+
2341
concurrency:
2442
# Skip intermediate builds: always.
2543
# Cancel intermediate builds: only if it is a pull request build.
@@ -35,14 +53,7 @@ jobs:
3553
strategy:
3654
fail-fast: false
3755
matrix:
38-
os:
39-
- ubuntu-latest
40-
# Use windows-2019 due to:
41-
# https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
42-
- windows-2019
43-
# We're using a specific version of macOS due to:
44-
# https://github.com/actions/virtual-environments/issues/5900
45-
- macOS-11
56+
os: ${{ fromJSON(inputs.os_list) }}
4657
steps:
4758
- name: Setup Windows
4859
if: startsWith(matrix.os, 'windows')
@@ -85,7 +96,7 @@ jobs:
8596
# This should be a no-op for non-mac OSes
8697
PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
8798
with:
88-
cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache'
99+
cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ${{ inputs.extra_cmake_args }}'
89100
build_target: '${{ inputs.build_target }}'
90101

91102
- name: Build and Test libclc

.github/workflows/spirv-tests.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: SPIR-V Tests
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
paths:
10+
- 'llvm/lib/Target/SPIRV/**'
11+
- 'llvm/test/CodeGen/SPIRV/**'
12+
- '.github/workflows/spirv-tests.yml'
13+
14+
concurrency:
15+
# Skip intermediate builds: always.
16+
# Cancel intermediate builds: only if it is a pull request build.
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
19+
20+
jobs:
21+
check_spirv:
22+
if: github.repository_owner == 'llvm'
23+
name: Test SPIR-V
24+
uses: ./.github/workflows/llvm-project-tests.yml
25+
with:
26+
build_target: check-llvm-codegen-spirv
27+
projects:
28+
extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV"'
29+
os_list: '["ubuntu-latest"]'

0 commit comments

Comments
 (0)