[llvm] [SPIR-V] Add pre-commit CI workflow (PR #74092)

Natalie Chouinard via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 13:15:18 PST 2023


https://github.com/sudonatalie updated https://github.com/llvm/llvm-project/pull/74092

>From bc79e3a14fb04c191abe4e203911fc899be298c1 Mon Sep 17 00:00:00 2001
From: Natalie Chouinard <chouinard at google.com>
Date: Fri, 1 Dec 2023 15:14:59 +0000
Subject: [PATCH 1/3] [SPIR-V] Add pre-commit CI workflow

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)
---
 .github/workflows/llvm-project-tests.yml |  8 ++++++-
 .github/workflows/spirv-tests.yml        | 28 ++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 .github/workflows/spirv-tests.yml

diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml
index 996cfe41f047f..0c84558d87fdb 100644
--- a/.github/workflows/llvm-project-tests.yml
+++ b/.github/workflows/llvm-project-tests.yml
@@ -10,6 +10,8 @@ on:
         required: false
       projects:
         required: false
+      experimental_targets:
+        required: false
   workflow_call:
     inputs:
       build_target:
@@ -20,6 +22,10 @@ on:
         required: true
         type: string
 
+      experimental_targets:
+        required: false
+        type: string
+
 concurrency:
   # Skip intermediate builds: always.
   # Cancel intermediate builds: only if it is a pull request build.
@@ -85,7 +91,7 @@ jobs:
           # This should be a no-op for non-mac OSes
           PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
         with:
-          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'
+          cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${{ inputs.experimental_targets }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache'
           build_target: '${{ inputs.build_target }}'
 
       - name: Build and Test libclc
diff --git a/.github/workflows/spirv-tests.yml b/.github/workflows/spirv-tests.yml
new file mode 100644
index 0000000000000..92a7c5ad7849b
--- /dev/null
+++ b/.github/workflows/spirv-tests.yml
@@ -0,0 +1,28 @@
+name: SPIR-V Tests
+
+permissions:
+  contents: read
+
+on:
+  workflow_dispatch:
+  pull_request:
+    paths:
+      - 'llvm/lib/Target/SPIRV/**'
+      - 'llvm/test/CodeGen/SPIRV/**'
+      - '.github/workflows/spirv-tests.yml'
+
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+jobs:
+  check_spirv:
+    if: github.repository_owner == 'llvm'
+    name: Test SPIR-V
+    uses: ./.github/workflows/llvm-project-tests.yml
+    with:
+      build_target: check-llvm-codegen-spirv
+      projects: clang
+      experimental_targets: SPIRV

>From 467b1ceb5b0781d563bf6f8cfeeba432d092acbf Mon Sep 17 00:00:00 2001
From: Natalie Chouinard <chouinard at google.com>
Date: Tue, 5 Dec 2023 16:13:42 +0000
Subject: [PATCH 2/3] Address review feedback

---
 .github/workflows/llvm-project-tests.yml | 6 +++---
 .github/workflows/spirv-tests.yml        | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml
index 0c84558d87fdb..f3549907e79b0 100644
--- a/.github/workflows/llvm-project-tests.yml
+++ b/.github/workflows/llvm-project-tests.yml
@@ -10,7 +10,7 @@ on:
         required: false
       projects:
         required: false
-      experimental_targets:
+      extra_cmake_args:
         required: false
   workflow_call:
     inputs:
@@ -22,7 +22,7 @@ on:
         required: true
         type: string
 
-      experimental_targets:
+      extra_cmake_args:
         required: false
         type: string
 
@@ -91,7 +91,7 @@ jobs:
           # This should be a no-op for non-mac OSes
           PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
         with:
-          cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${{ inputs.experimental_targets }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache'
+          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 }}'
           build_target: '${{ inputs.build_target }}'
 
       - name: Build and Test libclc
diff --git a/.github/workflows/spirv-tests.yml b/.github/workflows/spirv-tests.yml
index 92a7c5ad7849b..b345ddca50590 100644
--- a/.github/workflows/spirv-tests.yml
+++ b/.github/workflows/spirv-tests.yml
@@ -24,5 +24,5 @@ jobs:
     uses: ./.github/workflows/llvm-project-tests.yml
     with:
       build_target: check-llvm-codegen-spirv
-      projects: clang
-      experimental_targets: SPIRV
+      projects:
+      extra_cmake_args: '-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV"'

>From 3499fb2472b6cc7372428b33b207c67028ea8363 Mon Sep 17 00:00:00 2001
From: Natalie Chouinard <chouinard at google.com>
Date: Tue, 5 Dec 2023 21:11:21 +0000
Subject: [PATCH 3/3] Disable other targets

---
 .github/workflows/spirv-tests.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/spirv-tests.yml b/.github/workflows/spirv-tests.yml
index b345ddca50590..a91cb2288ed94 100644
--- a/.github/workflows/spirv-tests.yml
+++ b/.github/workflows/spirv-tests.yml
@@ -25,4 +25,4 @@ jobs:
     with:
       build_target: check-llvm-codegen-spirv
       projects:
-      extra_cmake_args: '-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV"'
+      extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV"'



More information about the llvm-commits mailing list