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

Natalie Chouinard via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 11:14:12 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/2] [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 3fefc0907a14028aa1ce12d7ccbc744a77a12550 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/2] Address review feedback

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

diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml
index 0c84558d87fdb..8f9a2f6b98476 100644
--- a/.github/workflows/llvm-project-tests.yml
+++ b/.github/workflows/llvm-project-tests.yml
@@ -10,7 +10,9 @@ on:
         required: false
       projects:
         required: false
-      experimental_targets:
+      extra_cmake_args:
+        required: false
+      runs_on:
         required: false
   workflow_call:
     inputs:
@@ -22,7 +24,11 @@ on:
         required: true
         type: string
 
-      experimental_targets:
+      extra_cmake_args:
+        required: false
+        type: string
+
+      runs_on:
         required: false
         type: string
 
@@ -37,7 +43,7 @@ concurrency:
 jobs:
   lit-tests:
     name: Lit Tests
-    runs-on: ${{ matrix.os }}
+    runs-on: ${{ inputs.runs_on == '' ? matrix.os : fromJSON(inputs.runs_on) }}
     strategy:
       fail-fast: false
       matrix:
@@ -91,7 +97,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..e9d5a9033796b 100644
--- a/.github/workflows/spirv-tests.yml
+++ b/.github/workflows/spirv-tests.yml
@@ -24,5 +24,6 @@ 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"'
+      runs_on: '["ubuntu-latest"]'



More information about the llvm-commits mailing list