[llvm] Add pre-merge workflow for HLSL testing (PR #122184)

Chris B via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 15:28:37 PST 2025


https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/122184

>From a6c0375f85d7eb89aeb49b042e52d0f4c6afdd07 Mon Sep 17 00:00:00 2001
From: Chris Bieneman <chris.bieneman at me.com>
Date: Wed, 8 Jan 2025 16:45:10 -0600
Subject: [PATCH 1/4] Add pre-merge workflow for HLSL testing

This adds a workflow for running HLSL tests on PRs that modify HLSL and
DirectX code.
---
 .github/workflows/hlsl-macos.yaml    |  26 ++++
 .github/workflows/hlsl/hlsl-all.yaml | 177 +++++++++++++++++++++++++++
 2 files changed, 203 insertions(+)
 create mode 100644 .github/workflows/hlsl-macos.yaml
 create mode 100644 .github/workflows/hlsl/hlsl-all.yaml

diff --git a/.github/workflows/hlsl-macos.yaml b/.github/workflows/hlsl-macos.yaml
new file mode 100644
index 00000000000000..f63888a8b9beff
--- /dev/null
+++ b/.github/workflows/hlsl-macos.yaml
@@ -0,0 +1,26 @@
+name: HLSL Tests - macOS
+
+permissions:
+  contents: read
+  checks: write
+
+on:
+  workflow_dispatch:
+  pull_request:
+    branches:
+      - main
+    paths:
+      - 'llvm/**/DirectX/**'
+      - '.github/workflows/hlsl*'
+      - clang/*HLSL*/**/*
+      - clang/**/*HLSL*
+      - llvm/**/Frontend/HLSL/**/*
+
+jobs:
+  macOS-Metal-Clang:
+    uses: ./.github/workflows/hlsl/hlsl-all.yaml
+    with:
+      OS: macOS
+      SKU: hlsl-metal
+      TestTarget: check-hlsl-clang-mtl
+      LLVM-branch: ${{ github.ref }}
diff --git a/.github/workflows/hlsl/hlsl-all.yaml b/.github/workflows/hlsl/hlsl-all.yaml
new file mode 100644
index 00000000000000..6195891a4ec0e7
--- /dev/null
+++ b/.github/workflows/hlsl/hlsl-all.yaml
@@ -0,0 +1,177 @@
+name: HLSL Test
+
+permissions:
+  contents: read
+  checks: write
+
+on:
+  workflow_dispatch:
+    inputs:
+      LLVM-Ref:
+        description: 'Test Suite Branch'
+        required: false
+        default: 'main'
+        type: string
+      LLVM-branch:
+        description: 'LLVM Branch'
+        required: false
+        default: 'main'
+        type: string
+      LLVM-fork:
+        description: 'LLVM fork'
+        required: false
+        default: 'llvm'
+        type: string
+      DXC-branch:
+        description: 'DXC Branch'
+        required: false
+        default: 'main'
+        type: string
+      BuildType:
+        description: 'Build Type'
+        required: false
+        default: 'Release'
+        type: choice
+        options:
+        - Release
+        - RelWithDebInfo
+        - Debug
+      TestTarget:
+        required: false
+        default: 'check-hlsl'
+        type: string
+      Test-Clang:
+        required: true
+        type: choice
+        options:
+        - On
+        - Off
+      OS:
+        required: true
+        type: choice
+        options:
+        - macOS
+        - windows
+      SKU:
+        required: true
+        type: choice
+        options:
+        - hlsl-metal
+      LLVM-ExtraCMakeArgs:
+        description: 'Extra CMake Args for LLVM'
+        required: false
+        default: ''
+        type: string
+  workflow_call:
+    inputs:
+      OffloadTest-branch:
+        description: 'Test Suite Branch'
+        required: false
+        default: 'main'
+        type: string
+      LLVM-branch:
+        description: 'LLVM Branch'
+        required: false
+        default: 'main'
+        type: string
+      LLVM-fork:
+        description: 'LLVM For'
+        required: false
+        default: 'llvm'
+        type: string
+      DXC-branch:
+        description: 'DXC Branch'
+        required: false
+        default: 'main'
+        type: string
+      OS:
+        required: true
+        type: string
+      SKU:
+        required: true
+        type: string
+      BuildType:
+        description: 'DXC Branch'
+        required: false
+        default: 'Release'
+        type: string
+      Test-Clang:
+        required: false
+        default: 'On'
+        type: string
+      TestTarget:
+        required: false
+        default: 'check-hlsl'
+        type: string
+      LLVM-ExtraCMakeArgs:
+        description: 'Extra CMake Args for LLVM'
+        required: false
+        default: ''
+        type: string
+
+jobs:
+  build:
+    runs-on: [self-hosted, "${{ inputs.SKU }}"]
+    steps:
+      - name: Checkout DXC
+        uses: actions/checkout at v4
+        with:
+          repository: Microsoft/DirectXShaderCompiler
+          ref: ${{ inputs.DXC-branch }}
+          path: DXC
+          fetch-depth: 1
+          submodules: true
+      - name: Checkout LLVM
+        uses: actions/checkout at v4
+        with:
+          repository: ${{ inputs.LLVM-fork }}/llvm-project
+          ref: ${{ inputs.LLVM-branch }}
+          path: llvm-project
+          fetch-depth: 1
+      - name: Checkout OffloadTest
+        uses: actions/checkout at v4
+        with:
+          repository: llvm-beanz/offload-test-suite
+          ref: ${{ inputs.OffloadTest-branch }}
+          path: OffloadTest
+          fetch-depth: 1
+      - name: Checkout Golden Images
+        uses: actions/checkout at v4
+        with:
+          repository: llvm-beanz/offload-golden-images
+          ref: main
+          path: golden-images
+          fetch-depth: 1
+      - name: Setup Windows
+        if: inputs.OS == 'windows'
+        uses: llvm/actions/setup-windows at main
+        with:
+          arch: amd64
+      - name: Build DXC
+        run: |
+            cd DXC
+            mkdir build
+            cd build
+            cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On ${{ github.workspace }}/DXC/
+            ninja
+      - name: Build LLVM
+        run: |
+            cd llvm-project
+            mkdir build
+            cd build
+            cmake -G Ninja ${{ inputs.LLVM-ExtraCMakeArgs }} -DDXIL_DIS=${{ github.workspace }}/DXC/build/bin/llvm-dis -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -C ${{ github.workspace }}/llvm-project/clang/cmake/caches/HLSL.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DDXC_DIR=${{ github.workspace }}/DXC/build/bin -DLLVM_EXTERNAL_OFFLOADTEST_SOURCE_DIR=${{ github.workspace }}/OffloadTest -DLLVM_EXTERNAL_PROJECTS="OffloadTest" -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v" -DOFFLOADTEST_TEST_CLANG=${{ inputs.Test-Clang }} -DGOLDENIMAGE_DIR=${{ github.workspace }}/golden-images ${{ github.workspace }}/llvm-project/llvm/
+            ninja hlsl-test-depends llvm-test-depends clang-test-depends
+      - name: Run HLSL Tests
+        run: |
+            cd llvm-project
+            cd build
+            ninja check-llvm
+            ninja check-clang
+            ninja check-hlsl-unit
+            ninja ${{ inputs.TestTarget }}
+      - name: Publish Test Results
+        uses: EnricoMi/publish-unit-test-result-action/macos at v2
+        if: always() && inputs.OS == 'macOS'
+        with:
+          comment_mode: off
+          files: llvm-project/build/**/testresults.xunit.xml

>From b2cee9e26db1f46f0cd55d9e5034c5891003e1e2 Mon Sep 17 00:00:00 2001
From: Chris Bieneman <chris.bieneman at me.com>
Date: Wed, 8 Jan 2025 17:11:33 -0600
Subject: [PATCH 2/4] Update paths

---
 .github/workflows/hlsl-macos.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/hlsl-macos.yaml b/.github/workflows/hlsl-macos.yaml
index f63888a8b9beff..83bd853829b220 100644
--- a/.github/workflows/hlsl-macos.yaml
+++ b/.github/workflows/hlsl-macos.yaml
@@ -12,6 +12,7 @@ on:
     paths:
       - 'llvm/**/DirectX/**'
       - '.github/workflows/hlsl*'
+      - '.github/workflows/hlsl/*'
       - clang/*HLSL*/**/*
       - clang/**/*HLSL*
       - llvm/**/Frontend/HLSL/**/*

>From e7372f7284ae847c5b8a052367f818c6fc9ba391 Mon Sep 17 00:00:00 2001
From: Chris Bieneman <chris.bieneman at me.com>
Date: Wed, 8 Jan 2025 17:13:20 -0600
Subject: [PATCH 3/4] Trying to get the paths right to trigger

---
 .github/workflows/hlsl-macos.yaml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/hlsl-macos.yaml b/.github/workflows/hlsl-macos.yaml
index 83bd853829b220..99611618228bd0 100644
--- a/.github/workflows/hlsl-macos.yaml
+++ b/.github/workflows/hlsl-macos.yaml
@@ -10,15 +10,15 @@ on:
     branches:
       - main
     paths:
-      - 'llvm/**/DirectX/**'
-      - '.github/workflows/hlsl*'
-      - '.github/workflows/hlsl/*'
+      - llvm/**/DirectX/**
+      - .github/workflows/hlsl*
+      - .github/workflows/hlsl/*
       - clang/*HLSL*/**/*
       - clang/**/*HLSL*
       - llvm/**/Frontend/HLSL/**/*
 
 jobs:
-  macOS-Metal-Clang:
+  HLSL-macOS:
     uses: ./.github/workflows/hlsl/hlsl-all.yaml
     with:
       OS: macOS

>From 12f924faa20d3ee885653102da11fa66dade011c Mon Sep 17 00:00:00 2001
From: Chris Bieneman <chris.bieneman at me.com>
Date: Wed, 8 Jan 2025 17:28:17 -0600
Subject: [PATCH 4/4] Trying again...

---
 .github/workflows/hlsl-macos.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/hlsl-macos.yaml b/.github/workflows/hlsl-macos.yaml
index 99611618228bd0..5defbd569b7d74 100644
--- a/.github/workflows/hlsl-macos.yaml
+++ b/.github/workflows/hlsl-macos.yaml
@@ -11,7 +11,7 @@ on:
       - main
     paths:
       - llvm/**/DirectX/**
-      - .github/workflows/hlsl*
+      - .github/workflows/hlsl-macos.yaml
       - .github/workflows/hlsl/*
       - clang/*HLSL*/**/*
       - clang/**/*HLSL*



More information about the llvm-commits mailing list