From 58a705a8c5b2ec4beff4182fa90416a216bd99b1 Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Mon, 18 May 2026 16:16:07 -0700 Subject: [PATCH 1/7] [CI] Add SPIRV-focused PR CI workflow for amd-staging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors the SPIRV CI structure on ROCm/SPIRV-LLVM-Translator amd-staging: a top-level dispatcher (spirv-ci.yml) that calls per- platform reusable workflows (spirv-ci-linux.yml, spirv-ci-windows.yml). Each platform builds LLVM/Clang/LLD + amd-llvm-spirv translator + device-libs + Comgr in one job, uploads the build trees as a single artifact, and fans out to parallel test jobs that consume it: Linux::release / Build (required) Linux::release / Test SPIRV translator lit Linux::release / Test LLVM SPIRV codegen Linux::release / Test Comgr Windows::release / Build Windows::release / Test SPIRV translator lit Windows::release / Test LLVM SPIRV codegen Windows::release / Test Comgr The translator-lit test job re-runs lit twice (PR head + amd-staging baseline) and gates on new-failures-only — Khronos upstream breaks ~1 translator lit test per week, so without baseline-diffing the suite would block unrelated PRs on those days. Pre-existing baseline failures don't gate. Goal: catch breakage in compiler / SPIRV translator that would fail downstream Comgr / HIP testing without paying the cost of a full TheRock build. Test categories will grow over time (rocm-examples, HIP-tests SPIRV mode, etc.) — they slot in as new jobs in the per-platform workflows. This is the llvm-project mirror of the workflows on ROCm/SPIRV-LLVM-Translator amd-staging. Two intentional divergences from the translator copy: 1. No sticky PR comment on the translator-lit test job. The translator copy posts a per-PR comment partitioning translator- lit failures into new / fixed / pre-existing. On llvm-project PRs (which mostly touch llvm/clang/lld, not the SPIRV translator) that comment would just be noise. The failing-check signal in the PR header is enough; the gate step still fails the job on real regressions and prints the failing test list to the log. pull-requests: write permission dropped accordingly. 2. No rocm-examples test job (yet). That work is under review on the translator side first (ROCm/SPIRV-LLVM-Translator#208); it will be brought over here once stable. Replaces 13 incremental prototype commits with a single squash so the diff matches the current intended state. The translator side is the source of truth for these workflows going forward; bumps from there will be replicated here. --- .github/workflows/spirv-ci-linux.yml | 334 ++++++++++++++++++++++ .github/workflows/spirv-ci-windows.yml | 374 +++++++++++++++++++++++++ .github/workflows/spirv-ci.yml | 29 ++ 3 files changed, 737 insertions(+) create mode 100644 .github/workflows/spirv-ci-linux.yml create mode 100644 .github/workflows/spirv-ci-windows.yml create mode 100644 .github/workflows/spirv-ci.yml diff --git a/.github/workflows/spirv-ci-linux.yml b/.github/workflows/spirv-ci-linux.yml new file mode 100644 index 0000000000000..b4c092309ba39 --- /dev/null +++ b/.github/workflows/spirv-ci-linux.yml @@ -0,0 +1,334 @@ +# Linux variant of the SPIRV CI: builds LLVM/Clang/translator/Comgr in +# one job and runs SPIRV-relevant test suites in parallel test jobs that +# consume a GHA artifact uploaded by the build job. + +name: SPIRV Compiler CI - Linux + +on: + workflow_call: + +jobs: + # ===================================================================== + # Build LLVM + Clang + amd-llvm-spirv + device-libs + Comgr. + # Strip binaries and upload the build trees as a single artifact for + # the test jobs to consume. + # ===================================================================== + build: + name: Build + runs-on: azure-linux-scale-rocm + timeout-minutes: 120 + container: + image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:702a5133851e6d1daf1207d2c9fbb01c2667914a5b6dc5a01faeb3ce66ea6421 + outputs: + llvm_project_sha: ${{ steps.resolve_llvm_sha.outputs.sha }} + + steps: + # ---- Checkout --------------------------------------------------------- + # llvm-project at amd-staging tip provides the host LLVM/Clang/LLD plus + # the amd/ subprojects (device-libs, comgr). The SPIRV translator PR + # head is overlaid in-tree under llvm/projects/. + - name: Checkout llvm-project (amd-staging) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: ROCm/llvm-project + ref: amd-staging + path: llvm-project + fetch-depth: 1 + persist-credentials: false + + # Capture the resolved amd-staging SHA so test jobs can pin to the + # exact commit this build used. Without this, test jobs re-resolve + # `amd-staging` and may land on a newer commit if upstream merged + # mid-run, triggering a cascade rebuild against an older build.ninja. + - name: Resolve llvm-project SHA + id: resolve_llvm_sha + run: | + SHA=$(git -C llvm-project rev-parse HEAD) + echo "sha=$SHA" >> "$GITHUB_OUTPUT" + echo "Pinned llvm-project SHA for test jobs: $SHA" + + - name: Checkout SPIRV-LLVM-Translator (PR head) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: llvm-project/llvm/projects/SPIRV-LLVM-Translator + fetch-depth: 1 + persist-credentials: false + + # ---- Build LLVM + Clang + LLD + in-tree SPIRV translator -------------- + - name: Configure LLVM + run: | + cmake -G Ninja -S llvm-project/llvm -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_ENABLE_ASSERTIONS=ON \ + -DLLVM_ENABLE_PROJECTS="clang;lld" \ + -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86;SPIRV" \ + -DLLVM_INCLUDE_TESTS=ON \ + -DLLVM_INSTALL_GTEST=ON \ + -DLLVM_LIT_ARGS="-sv --no-progress-bar" + + - name: Build LLVM + Clang + amd-llvm-spirv + test deps + # *-test-depends pull in all tools needed for lit (FileCheck, not, + # llc, llvm-*, clang, opt, etc.) and stay current with upstream. + run: ninja -C build llvm-test-depends clang-test-depends amd-llvm-spirv + + # ---- Build device-libs (standalone, against built LLVM) -------------- + - name: Configure device-libs + run: | + cmake -G Ninja -S llvm-project/amd/device-libs -B build-device-libs \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=$PWD/build \ + -DLLVM_DIR=$PWD/build/lib/cmake/llvm + + - name: Build device-libs + run: ninja -C build-device-libs + + # ---- Build Comgr (standalone, against built LLVM + device-libs) ------ + - name: Configure Comgr + # LLVM_EXTERNAL_SPIRV_LLVM_TRANSLATOR_SOURCE_DIR points Comgr at + # the in-tree translator headers so COMGR_SPIRV_TRANSLATOR_AVAILABLE + # turns ON (otherwise translator-dependent lit tests are UNSUPPORTED). + run: | + cmake -G Ninja -S llvm-project/amd/comgr -B build-comgr \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH="$PWD/build;$PWD/build-device-libs" \ + -DLLVM_DIR=$PWD/build/lib/cmake/llvm \ + -DLLVM_EXTERNAL_SPIRV_LLVM_TRANSLATOR_SOURCE_DIR=$PWD/llvm-project/llvm/projects/SPIRV-LLVM-Translator \ + -DBUILD_TESTING=ON + + - name: Build Comgr + run: ninja -C build-comgr amd_comgr + + # ---- Strip + upload artifact ----------------------------------------- + # Strip binaries to keep the artifact under GHA's 10GB cap and shorten + # upload/download time. Tests don't need debug symbols. `--strip-unneeded` + # preserves dynamic symbols needed at link/load time. + - name: Strip binaries + run: | + find build build-comgr build-device-libs \ + -type f \( -executable -o -name '*.so*' -o -name '*.a' \) \ + -exec strip --strip-unneeded {} + 2>/dev/null || true + + # Tar before upload: actions/upload-artifact@v4 strips +x bits and + # excludes hidden files (loses FetchContent .git dirs). + - name: Tar build trees + run: tar -cf linux-build-tree.tar build build-comgr build-device-libs + + - name: Upload build tree artifact + uses: actions/upload-artifact@v4 + with: + name: linux-build-tree + path: linux-build-tree.tar + retention-days: 1 + compression-level: 6 + if-no-files-found: error + + # ===================================================================== + # Test - SPIRV translator lit (with PR-head vs amd-staging baseline diff) + # ===================================================================== + # Non-blocking: upstream Khronos breaks ~1 translator lit test per week + # (spirv-val drift, LLVM IR changes vs DebugInfo tests, DCE). Their fixes + # typically land within a day; our daily upstream-merge cron pulls them + # in. Blocking here would gate unrelated PRs during those windows. The + # baseline run partitions failures into new / fixed / pre-existing so + # AMD-side regressions stay visible. + test_translator_lit: + name: Test SPIRV translator lit + needs: build + runs-on: azure-linux-scale-rocm + timeout-minutes: 30 + container: + image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:702a5133851e6d1daf1207d2c9fbb01c2667914a5b6dc5a01faeb3ce66ea6421 + permissions: + contents: read + + steps: + - name: Checkout llvm-project (pinned to Build job SHA) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: ROCm/llvm-project + ref: ${{ needs.build.outputs.llvm_project_sha }} + path: llvm-project + fetch-depth: 1 + persist-credentials: false + + - name: Checkout SPIRV-LLVM-Translator (PR head) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: llvm-project/llvm/projects/SPIRV-LLVM-Translator + fetch-depth: 1 + persist-credentials: false + + - name: Download build tree artifact + uses: actions/download-artifact@v4 + with: + name: linux-build-tree + + # touch build.ninja so it's newer than CMakeCache.txt — without it + # tar -m's per-file mtimes can trigger a cmake regen + cascade rebuild. + - name: Untar build trees + run: | + tar -xmf linux-build-tree.tar + touch build/build.ninja build-comgr/build.ninja build-device-libs/build.ninja + + - name: Test - SPIRV Translator (check-amd-llvm-spirv) [PR head] + id: check_spirv_xlator + continue-on-error: true + run: | + set -o pipefail + ninja -C build check-amd-llvm-spirv 2>&1 | tee build/check-amd-llvm-spirv.log + + - name: Capture PR head translator failures + if: always() + run: | + grep -oE '^FAIL: LLVM_SPIRV :: \S+' build/check-amd-llvm-spirv.log \ + | sort -u > build/spirv-fails-pr.txt || true + echo "PR head failures:"; cat build/spirv-fails-pr.txt + + - name: Switch translator to amd-staging tip for baseline + if: always() + run: | + cd llvm-project/llvm/projects/SPIRV-LLVM-Translator + git fetch --depth=1 origin amd-staging + git checkout FETCH_HEAD + + - name: Test - SPIRV Translator [baseline amd-staging] + # Re-run the lit suite with the translator at amd-staging tip so the + # comment script can compute the per-PR delta (new vs fixed vs + # pre-existing). Incremental rebuild — only translator objects change. + if: always() + id: check_spirv_baseline + continue-on-error: true + run: | + set -o pipefail + # Re-configure to pick up any CMakeLists / file-list changes in the swap + cmake -G Ninja -S llvm-project/llvm -B build + ninja -C build check-amd-llvm-spirv 2>&1 \ + | tee build/check-amd-llvm-spirv-baseline.log + + - name: Capture baseline translator failures + # Split from the lit step so a non-zero ninja exit (lit failures + + # set -o pipefail under bash -e) doesn't skip this grep. + if: always() + run: | + grep -oE '^FAIL: LLVM_SPIRV :: \S+' build/check-amd-llvm-spirv-baseline.log \ + | sort -u > build/spirv-fails-baseline.txt || true + echo "Baseline failures:"; cat build/spirv-fails-baseline.txt + + # Fail the job on real regressions (PR head FAILs that aren't on + # amd-staging baseline). Pre-existing baseline failures don't block. + - name: Gate - new translator lit failures + if: always() + run: | + if [ ! -f build/spirv-fails-pr.txt ] || [ ! -f build/spirv-fails-baseline.txt ]; then + echo "::warning::Could not compute new-failure delta (missing pr.txt or baseline.txt); not gating." + exit 0 + fi + new=$(comm -23 build/spirv-fails-pr.txt build/spirv-fails-baseline.txt) + if [ -n "$new" ]; then + count=$(printf '%s\n' "$new" | wc -l) + echo "::error::$count new translator lit failure(s) introduced by this PR:" + printf '%s\n' "$new" | sed 's/^/::error:: /' + exit 1 + fi + echo "No new translator lit failures vs amd-staging baseline." + + # ===================================================================== + # Test - LLVM SPIRV codegen lit suite + # ===================================================================== + test_codegen: + name: Test LLVM SPIRV codegen + needs: build + runs-on: azure-linux-scale-rocm + timeout-minutes: 15 + container: + image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:702a5133851e6d1daf1207d2c9fbb01c2667914a5b6dc5a01faeb3ce66ea6421 + + steps: + - name: Checkout llvm-project (pinned to Build job SHA) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: ROCm/llvm-project + ref: ${{ needs.build.outputs.llvm_project_sha }} + path: llvm-project + fetch-depth: 1 + persist-credentials: false + + - name: Checkout SPIRV-LLVM-Translator (PR head) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: llvm-project/llvm/projects/SPIRV-LLVM-Translator + fetch-depth: 1 + persist-credentials: false + + - name: Download build tree artifact + uses: actions/download-artifact@v4 + with: + name: linux-build-tree + + # touch build.ninja so it's newer than CMakeCache.txt — without it + # tar -m's per-file mtimes can trigger a cmake regen + cascade rebuild. + - name: Untar build trees + run: | + tar -xmf linux-build-tree.tar + touch build/build.ninja build-comgr/build.ninja build-device-libs/build.ninja + + - name: Test - LLVM SPIRV backend (check-llvm-codegen-spirv) + run: ninja -C build check-llvm-codegen-spirv + + # ===================================================================== + # Test - Comgr (lit + gtest + ctest) + # ===================================================================== + test_comgr: + name: Test Comgr + needs: build + runs-on: azure-linux-scale-rocm + timeout-minutes: 30 + container: + image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:702a5133851e6d1daf1207d2c9fbb01c2667914a5b6dc5a01faeb3ce66ea6421 + + steps: + - name: Checkout llvm-project (pinned to Build job SHA) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: ROCm/llvm-project + ref: ${{ needs.build.outputs.llvm_project_sha }} + path: llvm-project + fetch-depth: 1 + persist-credentials: false + + - name: Checkout SPIRV-LLVM-Translator (PR head) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: llvm-project/llvm/projects/SPIRV-LLVM-Translator + fetch-depth: 1 + persist-credentials: false + + - name: Download build tree artifact + uses: actions/download-artifact@v4 + with: + name: linux-build-tree + + # touch build.ninja so it's newer than CMakeCache.txt — without it + # tar -m's per-file mtimes can trigger a cmake regen + cascade rebuild. + - name: Untar build trees + run: | + tar -xmf linux-build-tree.tar + touch build/build.ninja build-comgr/build.ninja build-device-libs/build.ninja + + - name: Test - Comgr (check-comgr) + # check-comgr depends on test-lit (runs lit suite) and test-unit + # (runs gtest binaries via its COMMAND block), then runs ctest for + # the legacy C tests. Single target = all three test layers. + id: check_comgr + run: ninja -C build-comgr check-comgr + + - name: Show failed Comgr ctest output + # check-comgr invokes ctest without --output-on-failure, so failures + # show "***Failed" with no stderr. Re-run any failed cases verbosely + # and redirect comgr's internal log buffer to stderr so clang errors + # from inside amd_comgr_do_action() surface (otherwise comgr just + # returns AMD_COMGR_STATUS_ERROR with no detail). + if: failure() && steps.check_comgr.conclusion == 'failure' + env: + AMD_COMGR_REDIRECT_LOGS: stderr + run: ctest --test-dir build-comgr --output-on-failure --rerun-failed diff --git a/.github/workflows/spirv-ci-windows.yml b/.github/workflows/spirv-ci-windows.yml new file mode 100644 index 0000000000000..64afbecc354fc --- /dev/null +++ b/.github/workflows/spirv-ci-windows.yml @@ -0,0 +1,374 @@ +# Windows variant of the SPIRV CI: builds LLVM/Clang/translator/Comgr in +# one job and runs SPIRV-relevant test suites in parallel test jobs that +# consume a GHA artifact uploaded by the build job. Mirrors spirv-ci-linux.yml +# in shape; differs in runner, MSVC env setup, no container, no strip. + +name: SPIRV Compiler CI - Windows + +on: + workflow_call: + +jobs: + # ===================================================================== + # Build LLVM + Clang + amd-llvm-spirv + device-libs + Comgr. + # ===================================================================== + build: + name: Build + runs-on: azure-windows-scale-rocm + timeout-minutes: 180 + defaults: + run: + shell: bash + outputs: + llvm_project_sha: ${{ steps.resolve_llvm_sha.outputs.sha }} + + steps: + # Long path support for the deep llvm-project tree under runner workspace. + - name: Enable git long paths + run: git config --global core.longpaths true + + # Pinned ninja 1.12.1 — TheRock pins this version because 1.13.0 has a bug. + - name: Install ninja + run: choco install -y ninja --version 1.12.1 + + # MSVC environment so cmake -GNinja can find cl.exe + link.exe. + - name: Configure MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + + # zstd dev libs for clang-offload-bundler compression support. Two + # vcpkg installs exist on this runner: C:\vcpkg (classic mode, what + # `vcpkg` in PATH resolves to) and the MSVC-bundled one at $VCPKG_ROOT + # (manifest-mode only — no `vcpkg install ` support). We use + # C:\vcpkg for both install and toolchain lookup so they match. + - name: Install zstd via vcpkg + run: vcpkg install zstd:x64-windows + + - name: Checkout llvm-project (amd-staging) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: ROCm/llvm-project + ref: amd-staging + path: llvm-project + fetch-depth: 1 + persist-credentials: false + + # Capture the resolved amd-staging SHA so test jobs can pin to the + # exact commit this build used. Without this, test jobs re-resolve + # `amd-staging` and may land on a newer commit if upstream merged + # mid-run, triggering a cascade rebuild against an older build.ninja. + - name: Resolve llvm-project SHA + id: resolve_llvm_sha + run: | + SHA=$(git -C llvm-project rev-parse HEAD) + echo "sha=$SHA" >> "$GITHUB_OUTPUT" + echo "Pinned llvm-project SHA for test jobs: $SHA" + + - name: Checkout SPIRV-LLVM-Translator (PR head) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: llvm-project/llvm/projects/SPIRV-LLVM-Translator + fetch-depth: 1 + persist-credentials: false + + # CMAKE_TOOLCHAIN_FILE points cmake at the C:\vcpkg find_package + # shims so LLVM_ENABLE_ZSTD=FORCE_ON locates the vcpkg-installed + # zstd. FORCE_ON makes the configure fail loudly if zstd is missing + # rather than silently building clang-offload-bundler without + # compression. + - name: Configure LLVM + run: | + cmake -G Ninja -S llvm-project/llvm -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" \ + -DLLVM_ENABLE_ASSERTIONS=ON \ + -DLLVM_ENABLE_PROJECTS="clang;lld" \ + -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86;SPIRV" \ + -DLLVM_ENABLE_ZSTD=FORCE_ON \ + -DLLVM_INCLUDE_TESTS=ON \ + -DLLVM_INSTALL_GTEST=ON \ + -DLLVM_LIT_ARGS="-sv --no-progress-bar" + + - name: Build LLVM + Clang + amd-llvm-spirv + test deps + run: ninja -C build llvm-test-depends clang-test-depends amd-llvm-spirv + + # Use $(pwd -W) for cmake -D paths: in MSYS bash $PWD is Unix-style + # (/c/...) which cmake's find_package can't traverse on Windows. + # pwd -W returns Windows-style with forward slashes (C:/...). + # Pass CMAKE_TOOLCHAIN_FILE here too: LLVM exports LLVMSupport + # linking against zstd::libzstd_shared, and consumers like + # find_package(LLVM) in device-libs/Comgr need the vcpkg toolchain + # loaded so that imported zstd target is defined. + - name: Configure device-libs + run: | + PWD_WIN=$(pwd -W) + cmake -G Ninja -S llvm-project/amd/device-libs -B build-device-libs \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" \ + -DCMAKE_PREFIX_PATH=$PWD_WIN/build \ + -DLLVM_DIR=$PWD_WIN/build/lib/cmake/llvm + + - name: Build device-libs + run: ninja -C build-device-libs + + - name: Configure Comgr + run: | + PWD_WIN=$(pwd -W) + cmake -G Ninja -S llvm-project/amd/comgr -B build-comgr \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" \ + -DCMAKE_PREFIX_PATH="$PWD_WIN/build;$PWD_WIN/build-device-libs" \ + -DLLVM_DIR=$PWD_WIN/build/lib/cmake/llvm \ + -DAMDDeviceLibs_DIR=$PWD_WIN/build-device-libs/lib/cmake/AMDDeviceLibs \ + -DLLVM_EXTERNAL_SPIRV_LLVM_TRANSLATOR_SOURCE_DIR=$PWD_WIN/llvm-project/llvm/projects/SPIRV-LLVM-Translator \ + -DBUILD_TESTING=ON + + - name: Build Comgr + run: ninja -C build-comgr amd_comgr + + # No strip on Windows: PE/COFF debug info lives in separate .pdb files + # rather than embedded in the .exe/.dll, so the binaries themselves are + # already stripped. Tar directly. + - name: Tar build trees + run: tar -cf windows-build-tree.tar build build-comgr build-device-libs + + - name: Upload build tree artifact + uses: actions/upload-artifact@v4 + with: + name: windows-build-tree + path: windows-build-tree.tar + retention-days: 1 + compression-level: 6 + if-no-files-found: error + + # ===================================================================== + # Test - SPIRV translator lit (with PR-head vs amd-staging baseline diff) + # ===================================================================== + test_translator_lit: + name: Test SPIRV translator lit + needs: build + runs-on: azure-windows-scale-rocm + timeout-minutes: 30 + permissions: + contents: read + defaults: + run: + shell: bash + + steps: + - name: Enable git long paths + run: git config --global core.longpaths true + + - name: Install ninja + run: choco install -y ninja --version 1.12.1 + + - name: Configure MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + + # zstd must be present at the same C:\vcpkg path the build job used, + # because build.ninja embeds C:/vcpkg/installed/.../zstd.lib as a + # build-edge input that ninja validates at planning time. + - name: Install zstd via vcpkg + run: vcpkg install zstd:x64-windows + + - name: Checkout llvm-project (pinned to Build job SHA) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: ROCm/llvm-project + ref: ${{ needs.build.outputs.llvm_project_sha }} + path: llvm-project + fetch-depth: 1 + persist-credentials: false + + - name: Checkout SPIRV-LLVM-Translator (PR head) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: llvm-project/llvm/projects/SPIRV-LLVM-Translator + fetch-depth: 1 + persist-credentials: false + + - name: Download build tree artifact + uses: actions/download-artifact@v4 + with: + name: windows-build-tree + + # touch build.ninja so it's newer than CMakeCache.txt — without it + # tar -m's per-file mtimes can trigger a cmake regen + cascade rebuild. + - name: Untar build trees + run: | + tar -xmf windows-build-tree.tar + touch build/build.ninja build-comgr/build.ninja build-device-libs/build.ninja + + - name: Test - SPIRV Translator (check-amd-llvm-spirv) [PR head] + id: check_spirv_xlator + continue-on-error: true + run: | + set -o pipefail + ninja -C build check-amd-llvm-spirv 2>&1 | tee build/check-amd-llvm-spirv.log + + - name: Capture PR head translator failures + if: always() + run: | + grep -oE '^FAIL: LLVM_SPIRV :: \S+' build/check-amd-llvm-spirv.log \ + | sort -u > build/spirv-fails-pr.txt || true + echo "PR head failures:"; cat build/spirv-fails-pr.txt + + - name: Switch translator to amd-staging tip for baseline + if: always() + run: | + cd llvm-project/llvm/projects/SPIRV-LLVM-Translator + git fetch --depth=1 origin amd-staging + git checkout FETCH_HEAD + + - name: Test - SPIRV Translator [baseline amd-staging] + if: always() + id: check_spirv_baseline + continue-on-error: true + run: | + set -o pipefail + cmake -G Ninja -S llvm-project/llvm -B build + ninja -C build check-amd-llvm-spirv 2>&1 \ + | tee build/check-amd-llvm-spirv-baseline.log + + - name: Capture baseline translator failures + if: always() + run: | + grep -oE '^FAIL: LLVM_SPIRV :: \S+' build/check-amd-llvm-spirv-baseline.log \ + | sort -u > build/spirv-fails-baseline.txt || true + echo "Baseline failures:"; cat build/spirv-fails-baseline.txt + + - name: Gate - new translator lit failures + if: always() + run: | + if [ ! -f build/spirv-fails-pr.txt ] || [ ! -f build/spirv-fails-baseline.txt ]; then + echo "::warning::Could not compute new-failure delta (missing pr.txt or baseline.txt); not gating." + exit 0 + fi + new=$(comm -23 build/spirv-fails-pr.txt build/spirv-fails-baseline.txt) + if [ -n "$new" ]; then + count=$(printf '%s\n' "$new" | wc -l) + echo "::error::$count new translator lit failure(s) introduced by this PR (Windows):" + printf '%s\n' "$new" | sed 's/^/::error:: /' + exit 1 + fi + echo "No new translator lit failures vs amd-staging baseline." + + # ===================================================================== + # Test - LLVM SPIRV codegen lit suite + # ===================================================================== + test_codegen: + name: Test LLVM SPIRV codegen + needs: build + runs-on: azure-windows-scale-rocm + timeout-minutes: 15 + defaults: + run: + shell: bash + + steps: + - name: Enable git long paths + run: git config --global core.longpaths true + + - name: Install ninja + run: choco install -y ninja --version 1.12.1 + + - name: Configure MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + + # zstd must be present at the same C:\vcpkg path the build job used, + # because build.ninja embeds C:/vcpkg/installed/.../zstd.lib as a + # build-edge input that ninja validates at planning time. + - name: Install zstd via vcpkg + run: vcpkg install zstd:x64-windows + + - name: Checkout llvm-project (pinned to Build job SHA) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: ROCm/llvm-project + ref: ${{ needs.build.outputs.llvm_project_sha }} + path: llvm-project + fetch-depth: 1 + persist-credentials: false + + - name: Checkout SPIRV-LLVM-Translator (PR head) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: llvm-project/llvm/projects/SPIRV-LLVM-Translator + fetch-depth: 1 + persist-credentials: false + + - name: Download build tree artifact + uses: actions/download-artifact@v4 + with: + name: windows-build-tree + + # touch build.ninja so it's newer than CMakeCache.txt — without it + # tar -m's per-file mtimes can trigger a cmake regen + cascade rebuild. + - name: Untar build trees + run: | + tar -xmf windows-build-tree.tar + touch build/build.ninja build-comgr/build.ninja build-device-libs/build.ninja + + - name: Test - LLVM SPIRV backend (check-llvm-codegen-spirv) + run: ninja -C build check-llvm-codegen-spirv + + # ===================================================================== + # Test - Comgr (lit + gtest + ctest) + # ===================================================================== + test_comgr: + name: Test Comgr + needs: build + runs-on: azure-windows-scale-rocm + timeout-minutes: 30 + defaults: + run: + shell: bash + + steps: + - name: Enable git long paths + run: git config --global core.longpaths true + + - name: Install ninja + run: choco install -y ninja --version 1.12.1 + + - name: Configure MSVC + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + + # zstd must be present at the same C:\vcpkg path the build job used, + # because build.ninja embeds C:/vcpkg/installed/.../zstd.lib as a + # build-edge input that ninja validates at planning time. + - name: Install zstd via vcpkg + run: vcpkg install zstd:x64-windows + + - name: Checkout llvm-project (pinned to Build job SHA) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: ROCm/llvm-project + ref: ${{ needs.build.outputs.llvm_project_sha }} + path: llvm-project + fetch-depth: 1 + persist-credentials: false + + - name: Checkout SPIRV-LLVM-Translator (PR head) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: llvm-project/llvm/projects/SPIRV-LLVM-Translator + fetch-depth: 1 + persist-credentials: false + + - name: Download build tree artifact + uses: actions/download-artifact@v4 + with: + name: windows-build-tree + + # touch build.ninja so it's newer than CMakeCache.txt — without it + # tar -m's per-file mtimes can trigger a cmake regen + cascade rebuild. + - name: Untar build trees + run: | + tar -xmf windows-build-tree.tar + touch build/build.ninja build-comgr/build.ninja build-device-libs/build.ninja + + - name: Test - Comgr (check-comgr) + id: check_comgr + env: + AMD_COMGR_REDIRECT_LOGS: stderr + run: ninja -C build-comgr check-comgr diff --git a/.github/workflows/spirv-ci.yml b/.github/workflows/spirv-ci.yml new file mode 100644 index 0000000000000..ed1a393b16aa4 --- /dev/null +++ b/.github/workflows/spirv-ci.yml @@ -0,0 +1,29 @@ +# Top-level dispatcher for the SPIRV-focused CI on amd-staging. +# Dispatches to per-platform reusable workflows. Add Windows by adding +# a windows_release job + spirv-ci-windows.yml. + +name: SPIRV Compiler CI + +on: + pull_request: + branches: [amd-staging] + types: [opened, synchronize, reopened, labeled] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + +jobs: + linux_release: + name: Linux::release + uses: ./.github/workflows/spirv-ci-linux.yml + secrets: inherit + + windows_release: + name: Windows::release + uses: ./.github/workflows/spirv-ci-windows.yml + secrets: inherit From 7f9bf1d6085faed73b11eb658f5949b8845da89a Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Mon, 18 May 2026 16:27:06 -0700 Subject: [PATCH 2/7] [CI] Qualify SPIRV translator checkout to ROCm/SPIRV-LLVM-Translator The "Checkout SPIRV-LLVM-Translator" steps had no repository/ref set, so on llvm-project (where this workflow now lives) they defaulted to the workflow's own repo and checked out llvm-project content into the translator's path. Build then failed with "ninja: error: unknown target 'amd-llvm-spirv'" because LLVM's projects/ CMake didn't find a real translator there. Qualify all 8 occurrences (build + 3 test jobs across Linux + Windows) to pull ROCm/SPIRV-LLVM-Translator @ amd-staging. llvm-project PRs don't change the translator, so amd-staging tip is the right ref. Step name updated from "(PR head)" to "(amd-staging)" to reflect the new semantics. --- .github/workflows/spirv-ci-linux.yml | 32 ++++++++++++++++++++++---- .github/workflows/spirv-ci-windows.yml | 32 ++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/.github/workflows/spirv-ci-linux.yml b/.github/workflows/spirv-ci-linux.yml index b4c092309ba39..a4031f08cb9e3 100644 --- a/.github/workflows/spirv-ci-linux.yml +++ b/.github/workflows/spirv-ci-linux.yml @@ -47,9 +47,15 @@ jobs: echo "sha=$SHA" >> "$GITHUB_OUTPUT" echo "Pinned llvm-project SHA for test jobs: $SHA" - - name: Checkout SPIRV-LLVM-Translator (PR head) + - name: Checkout SPIRV-LLVM-Translator (amd-staging) + # Pinned to amd-staging because llvm-project PRs don't change + # the translator. Without an explicit repository/ref, checkout + # defaults to the workflow's own repo (llvm-project) and clobbers + # the translator path with llvm-project content. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + repository: ROCm/SPIRV-LLVM-Translator + ref: amd-staging path: llvm-project/llvm/projects/SPIRV-LLVM-Translator fetch-depth: 1 persist-credentials: false @@ -151,9 +157,15 @@ jobs: fetch-depth: 1 persist-credentials: false - - name: Checkout SPIRV-LLVM-Translator (PR head) + - name: Checkout SPIRV-LLVM-Translator (amd-staging) + # Pinned to amd-staging because llvm-project PRs don't change + # the translator. Without an explicit repository/ref, checkout + # defaults to the workflow's own repo (llvm-project) and clobbers + # the translator path with llvm-project content. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + repository: ROCm/SPIRV-LLVM-Translator + ref: amd-staging path: llvm-project/llvm/projects/SPIRV-LLVM-Translator fetch-depth: 1 persist-credentials: false @@ -253,9 +265,15 @@ jobs: fetch-depth: 1 persist-credentials: false - - name: Checkout SPIRV-LLVM-Translator (PR head) + - name: Checkout SPIRV-LLVM-Translator (amd-staging) + # Pinned to amd-staging because llvm-project PRs don't change + # the translator. Without an explicit repository/ref, checkout + # defaults to the workflow's own repo (llvm-project) and clobbers + # the translator path with llvm-project content. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + repository: ROCm/SPIRV-LLVM-Translator + ref: amd-staging path: llvm-project/llvm/projects/SPIRV-LLVM-Translator fetch-depth: 1 persist-credentials: false @@ -296,9 +314,15 @@ jobs: fetch-depth: 1 persist-credentials: false - - name: Checkout SPIRV-LLVM-Translator (PR head) + - name: Checkout SPIRV-LLVM-Translator (amd-staging) + # Pinned to amd-staging because llvm-project PRs don't change + # the translator. Without an explicit repository/ref, checkout + # defaults to the workflow's own repo (llvm-project) and clobbers + # the translator path with llvm-project content. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + repository: ROCm/SPIRV-LLVM-Translator + ref: amd-staging path: llvm-project/llvm/projects/SPIRV-LLVM-Translator fetch-depth: 1 persist-credentials: false diff --git a/.github/workflows/spirv-ci-windows.yml b/.github/workflows/spirv-ci-windows.yml index 64afbecc354fc..21398be061073 100644 --- a/.github/workflows/spirv-ci-windows.yml +++ b/.github/workflows/spirv-ci-windows.yml @@ -63,9 +63,15 @@ jobs: echo "sha=$SHA" >> "$GITHUB_OUTPUT" echo "Pinned llvm-project SHA for test jobs: $SHA" - - name: Checkout SPIRV-LLVM-Translator (PR head) + - name: Checkout SPIRV-LLVM-Translator (amd-staging) + # Pinned to amd-staging because llvm-project PRs don't change + # the translator. Without an explicit repository/ref, checkout + # defaults to the workflow's own repo (llvm-project) and clobbers + # the translator path with llvm-project content. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + repository: ROCm/SPIRV-LLVM-Translator + ref: amd-staging path: llvm-project/llvm/projects/SPIRV-LLVM-Translator fetch-depth: 1 persist-credentials: false @@ -179,9 +185,15 @@ jobs: fetch-depth: 1 persist-credentials: false - - name: Checkout SPIRV-LLVM-Translator (PR head) + - name: Checkout SPIRV-LLVM-Translator (amd-staging) + # Pinned to amd-staging because llvm-project PRs don't change + # the translator. Without an explicit repository/ref, checkout + # defaults to the workflow's own repo (llvm-project) and clobbers + # the translator path with llvm-project content. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + repository: ROCm/SPIRV-LLVM-Translator + ref: amd-staging path: llvm-project/llvm/projects/SPIRV-LLVM-Translator fetch-depth: 1 persist-credentials: false @@ -289,9 +301,15 @@ jobs: fetch-depth: 1 persist-credentials: false - - name: Checkout SPIRV-LLVM-Translator (PR head) + - name: Checkout SPIRV-LLVM-Translator (amd-staging) + # Pinned to amd-staging because llvm-project PRs don't change + # the translator. Without an explicit repository/ref, checkout + # defaults to the workflow's own repo (llvm-project) and clobbers + # the translator path with llvm-project content. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + repository: ROCm/SPIRV-LLVM-Translator + ref: amd-staging path: llvm-project/llvm/projects/SPIRV-LLVM-Translator fetch-depth: 1 persist-credentials: false @@ -348,9 +366,15 @@ jobs: fetch-depth: 1 persist-credentials: false - - name: Checkout SPIRV-LLVM-Translator (PR head) + - name: Checkout SPIRV-LLVM-Translator (amd-staging) + # Pinned to amd-staging because llvm-project PRs don't change + # the translator. Without an explicit repository/ref, checkout + # defaults to the workflow's own repo (llvm-project) and clobbers + # the translator path with llvm-project content. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + repository: ROCm/SPIRV-LLVM-Translator + ref: amd-staging path: llvm-project/llvm/projects/SPIRV-LLVM-Translator fetch-depth: 1 persist-credentials: false From fcc97ac98c7ebb051b6d68e2f19fe6c82b090fdb Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Mon, 18 May 2026 16:35:08 -0700 Subject: [PATCH 3/7] [CI] Test PR head; swap llvm-project (not translator) for baseline diff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two coupled fixes for the llvm-project copy of the workflow: 1. Build job was checking out llvm-project at amd-staging tip (leftover from the translator-copy semantics) so PR content was never being tested. Changed all llvm-project checkouts in Build + 3 test jobs (per platform) to pull the PR head SHA from the head repo. Uses github.event.pull_request.head.{sha,repo.full_name} with workflow_dispatch fallbacks to github.{sha,repository}. Removes the now-unneeded Build job output llvm_project_sha and the Resolve LLVM SHA step — github.event.pull_request.head.sha is stable for the whole workflow run, so test jobs can use it directly. 2. translator-lit baseline-diff was swapping the translator to amd-staging tip for the baseline run. That made sense on the translator side (PRs change the translator); on llvm-project, PRs change llvm/clang/lld so the swap target is llvm-project. Baseline run now: cd llvm-project + git fetch+checkout amd-staging from explicit upstream URL (origin may be a fork on PR runs), then reconfigure + incremental rebuild of changed LLVM libs + relink translator + rerun lit. Diff isolates failures introduced by this PR's llvm changes. The baseline rebuild cost scales with how many LLVM libs the PR touches; small PRs incur minutes, broad refactors more. --- .github/workflows/spirv-ci-linux.yml | 67 ++++++++++++-------------- .github/workflows/spirv-ci-windows.yml | 55 ++++++++++----------- 2 files changed, 58 insertions(+), 64 deletions(-) diff --git a/.github/workflows/spirv-ci-linux.yml b/.github/workflows/spirv-ci-linux.yml index a4031f08cb9e3..1d82dc34f5d25 100644 --- a/.github/workflows/spirv-ci-linux.yml +++ b/.github/workflows/spirv-ci-linux.yml @@ -19,34 +19,22 @@ jobs: timeout-minutes: 120 container: image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:702a5133851e6d1daf1207d2c9fbb01c2667914a5b6dc5a01faeb3ce66ea6421 - outputs: - llvm_project_sha: ${{ steps.resolve_llvm_sha.outputs.sha }} - steps: # ---- Checkout --------------------------------------------------------- - # llvm-project at amd-staging tip provides the host LLVM/Clang/LLD plus - # the amd/ subprojects (device-libs, comgr). The SPIRV translator PR - # head is overlaid in-tree under llvm/projects/. - - name: Checkout llvm-project (amd-staging) + # llvm-project at PR head (this repo) provides LLVM/Clang/LLD + amd/ + # subprojects (device-libs, comgr). The SPIRV translator is pinned to + # amd-staging and overlaid in-tree under llvm/projects/. + - name: Checkout llvm-project (PR head) + # On pull_request events: PR head from the (possibly fork) head repo. + # On workflow_dispatch: the branch the dispatch was on. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - repository: ROCm/llvm-project - ref: amd-staging + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} path: llvm-project fetch-depth: 1 persist-credentials: false - # Capture the resolved amd-staging SHA so test jobs can pin to the - # exact commit this build used. Without this, test jobs re-resolve - # `amd-staging` and may land on a newer commit if upstream merged - # mid-run, triggering a cascade rebuild against an older build.ninja. - - name: Resolve llvm-project SHA - id: resolve_llvm_sha - run: | - SHA=$(git -C llvm-project rev-parse HEAD) - echo "sha=$SHA" >> "$GITHUB_OUTPUT" - echo "Pinned llvm-project SHA for test jobs: $SHA" - - name: Checkout SPIRV-LLVM-Translator (amd-staging) # Pinned to amd-staging because llvm-project PRs don't change # the translator. Without an explicit repository/ref, checkout @@ -148,11 +136,13 @@ jobs: contents: read steps: - - name: Checkout llvm-project (pinned to Build job SHA) + - name: Checkout llvm-project (PR head) + # On pull_request events: PR head from the (possibly fork) head repo. + # On workflow_dispatch: the branch the dispatch was on. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - repository: ROCm/llvm-project - ref: ${{ needs.build.outputs.llvm_project_sha }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} path: llvm-project fetch-depth: 1 persist-credentials: false @@ -196,17 +186,20 @@ jobs: | sort -u > build/spirv-fails-pr.txt || true echo "PR head failures:"; cat build/spirv-fails-pr.txt - - name: Switch translator to amd-staging tip for baseline + - name: Switch llvm-project to amd-staging tip for baseline + # PRs on llvm-project change llvm/clang/lld, not the translator, so the + # baseline-diff swap target is llvm-project. Use explicit upstream URL + # because `origin` may be a fork on PR runs. if: always() run: | - cd llvm-project/llvm/projects/SPIRV-LLVM-Translator - git fetch --depth=1 origin amd-staging + cd llvm-project + git fetch --depth=1 https://github.com/ROCm/llvm-project.git amd-staging git checkout FETCH_HEAD - name: Test - SPIRV Translator [baseline amd-staging] - # Re-run the lit suite with the translator at amd-staging tip so the - # comment script can compute the per-PR delta (new vs fixed vs - # pre-existing). Incremental rebuild — only translator objects change. + # Re-run the lit suite with llvm-project at amd-staging tip to compute + # the per-PR delta vs PR-head failures. Incremental rebuild — only + # changed LLVM libs are recompiled and the translator is relinked. if: always() id: check_spirv_baseline continue-on-error: true @@ -256,11 +249,13 @@ jobs: image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:702a5133851e6d1daf1207d2c9fbb01c2667914a5b6dc5a01faeb3ce66ea6421 steps: - - name: Checkout llvm-project (pinned to Build job SHA) + - name: Checkout llvm-project (PR head) + # On pull_request events: PR head from the (possibly fork) head repo. + # On workflow_dispatch: the branch the dispatch was on. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - repository: ROCm/llvm-project - ref: ${{ needs.build.outputs.llvm_project_sha }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} path: llvm-project fetch-depth: 1 persist-credentials: false @@ -305,11 +300,13 @@ jobs: image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:702a5133851e6d1daf1207d2c9fbb01c2667914a5b6dc5a01faeb3ce66ea6421 steps: - - name: Checkout llvm-project (pinned to Build job SHA) + - name: Checkout llvm-project (PR head) + # On pull_request events: PR head from the (possibly fork) head repo. + # On workflow_dispatch: the branch the dispatch was on. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - repository: ROCm/llvm-project - ref: ${{ needs.build.outputs.llvm_project_sha }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} path: llvm-project fetch-depth: 1 persist-credentials: false diff --git a/.github/workflows/spirv-ci-windows.yml b/.github/workflows/spirv-ci-windows.yml index 21398be061073..7c0a43f8c5728 100644 --- a/.github/workflows/spirv-ci-windows.yml +++ b/.github/workflows/spirv-ci-windows.yml @@ -19,9 +19,6 @@ jobs: defaults: run: shell: bash - outputs: - llvm_project_sha: ${{ steps.resolve_llvm_sha.outputs.sha }} - steps: # Long path support for the deep llvm-project tree under runner workspace. - name: Enable git long paths @@ -43,26 +40,17 @@ jobs: - name: Install zstd via vcpkg run: vcpkg install zstd:x64-windows - - name: Checkout llvm-project (amd-staging) + - name: Checkout llvm-project (PR head) + # On pull_request events: PR head from the (possibly fork) head repo. + # On workflow_dispatch: the branch the dispatch was on. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - repository: ROCm/llvm-project - ref: amd-staging + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} path: llvm-project fetch-depth: 1 persist-credentials: false - # Capture the resolved amd-staging SHA so test jobs can pin to the - # exact commit this build used. Without this, test jobs re-resolve - # `amd-staging` and may land on a newer commit if upstream merged - # mid-run, triggering a cascade rebuild against an older build.ninja. - - name: Resolve llvm-project SHA - id: resolve_llvm_sha - run: | - SHA=$(git -C llvm-project rev-parse HEAD) - echo "sha=$SHA" >> "$GITHUB_OUTPUT" - echo "Pinned llvm-project SHA for test jobs: $SHA" - - name: Checkout SPIRV-LLVM-Translator (amd-staging) # Pinned to amd-staging because llvm-project PRs don't change # the translator. Without an explicit repository/ref, checkout @@ -176,11 +164,13 @@ jobs: - name: Install zstd via vcpkg run: vcpkg install zstd:x64-windows - - name: Checkout llvm-project (pinned to Build job SHA) + - name: Checkout llvm-project (PR head) + # On pull_request events: PR head from the (possibly fork) head repo. + # On workflow_dispatch: the branch the dispatch was on. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - repository: ROCm/llvm-project - ref: ${{ needs.build.outputs.llvm_project_sha }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} path: llvm-project fetch-depth: 1 persist-credentials: false @@ -224,11 +214,14 @@ jobs: | sort -u > build/spirv-fails-pr.txt || true echo "PR head failures:"; cat build/spirv-fails-pr.txt - - name: Switch translator to amd-staging tip for baseline + - name: Switch llvm-project to amd-staging tip for baseline + # PRs on llvm-project change llvm/clang/lld, not the translator, so the + # baseline-diff swap target is llvm-project. Use explicit upstream URL + # because `origin` may be a fork on PR runs. if: always() run: | - cd llvm-project/llvm/projects/SPIRV-LLVM-Translator - git fetch --depth=1 origin amd-staging + cd llvm-project + git fetch --depth=1 https://github.com/ROCm/llvm-project.git amd-staging git checkout FETCH_HEAD - name: Test - SPIRV Translator [baseline amd-staging] @@ -292,11 +285,13 @@ jobs: - name: Install zstd via vcpkg run: vcpkg install zstd:x64-windows - - name: Checkout llvm-project (pinned to Build job SHA) + - name: Checkout llvm-project (PR head) + # On pull_request events: PR head from the (possibly fork) head repo. + # On workflow_dispatch: the branch the dispatch was on. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - repository: ROCm/llvm-project - ref: ${{ needs.build.outputs.llvm_project_sha }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} path: llvm-project fetch-depth: 1 persist-credentials: false @@ -357,11 +352,13 @@ jobs: - name: Install zstd via vcpkg run: vcpkg install zstd:x64-windows - - name: Checkout llvm-project (pinned to Build job SHA) + - name: Checkout llvm-project (PR head) + # On pull_request events: PR head from the (possibly fork) head repo. + # On workflow_dispatch: the branch the dispatch was on. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - repository: ROCm/llvm-project - ref: ${{ needs.build.outputs.llvm_project_sha }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} path: llvm-project fetch-depth: 1 persist-credentials: false From af6463b26874f3c1e9f2243679a822e472a439de Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Wed, 27 May 2026 10:41:52 -0700 Subject: [PATCH 4/7] Rename spirv-ci-linux.yml to spirv-ci-linux-amd-staging.yml --- .../{spirv-ci-linux.yml => spirv-ci-linux-amd-staging.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{spirv-ci-linux.yml => spirv-ci-linux-amd-staging.yml} (100%) diff --git a/.github/workflows/spirv-ci-linux.yml b/.github/workflows/spirv-ci-linux-amd-staging.yml similarity index 100% rename from .github/workflows/spirv-ci-linux.yml rename to .github/workflows/spirv-ci-linux-amd-staging.yml From e8d94f8a1e7634af89e6753df65e0853a8e8098d Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Wed, 27 May 2026 10:42:35 -0700 Subject: [PATCH 5/7] Apply suggestion from @lamb-j --- .github/workflows/spirv-ci-linux-amd-staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spirv-ci-linux-amd-staging.yml b/.github/workflows/spirv-ci-linux-amd-staging.yml index 1d82dc34f5d25..eb4d305c28742 100644 --- a/.github/workflows/spirv-ci-linux-amd-staging.yml +++ b/.github/workflows/spirv-ci-linux-amd-staging.yml @@ -2,7 +2,7 @@ # one job and runs SPIRV-relevant test suites in parallel test jobs that # consume a GHA artifact uploaded by the build job. -name: SPIRV Compiler CI - Linux +name: SPIRV Compiler CI - Linux - amd-staging on: workflow_call: From e420af1ac5e64540ba5f3f4417a66929bb41e967 Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Wed, 27 May 2026 10:49:26 -0700 Subject: [PATCH 6/7] [CI] Append branch name to SPIRV CI workflow files and names Per CI team convention, workflow files and names targeting a specific branch should carry that branch in the filename and the workflow name. - Rename spirv-ci-windows.yml -> spirv-ci-windows-amd-staging.yml - Update workflow names: - SPIRV Compiler CI -> SPIRV Compiler CI - amd-staging - SPIRV Compiler CI - Windows -> SPIRV Compiler CI - Windows - amd-staging - Update dispatcher 'uses:' paths to the renamed Linux/Windows files --- ...v-ci-windows.yml => spirv-ci-windows-amd-staging.yml} | 0 .github/workflows/spirv-ci.yml | 9 ++++----- 2 files changed, 4 insertions(+), 5 deletions(-) rename .github/workflows/{spirv-ci-windows.yml => spirv-ci-windows-amd-staging.yml} (100%) diff --git a/.github/workflows/spirv-ci-windows.yml b/.github/workflows/spirv-ci-windows-amd-staging.yml similarity index 100% rename from .github/workflows/spirv-ci-windows.yml rename to .github/workflows/spirv-ci-windows-amd-staging.yml diff --git a/.github/workflows/spirv-ci.yml b/.github/workflows/spirv-ci.yml index ed1a393b16aa4..fbf28bc465173 100644 --- a/.github/workflows/spirv-ci.yml +++ b/.github/workflows/spirv-ci.yml @@ -1,8 +1,7 @@ # Top-level dispatcher for the SPIRV-focused CI on amd-staging. -# Dispatches to per-platform reusable workflows. Add Windows by adding -# a windows_release job + spirv-ci-windows.yml. +# Dispatches to per-platform reusable workflows. -name: SPIRV Compiler CI +name: SPIRV Compiler CI - amd-staging on: pull_request: @@ -20,10 +19,10 @@ concurrency: jobs: linux_release: name: Linux::release - uses: ./.github/workflows/spirv-ci-linux.yml + uses: ./.github/workflows/spirv-ci-linux-amd-staging.yml secrets: inherit windows_release: name: Windows::release - uses: ./.github/workflows/spirv-ci-windows.yml + uses: ./.github/workflows/spirv-ci-windows-amd-staging.yml secrets: inherit From 18e8f40e63bdd1a8bb28cccbdc97e07d6e741ac9 Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Wed, 27 May 2026 10:49:43 -0700 Subject: [PATCH 7/7] [CI] Update Windows workflow name and header reference Missed in prior commit: - name: SPIRV Compiler CI - Windows -> SPIRV Compiler CI - Windows - amd-staging - Header comment now references spirv-ci-linux-amd-staging.yml --- .github/workflows/spirv-ci-windows-amd-staging.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spirv-ci-windows-amd-staging.yml b/.github/workflows/spirv-ci-windows-amd-staging.yml index 7c0a43f8c5728..abb4c962c701b 100644 --- a/.github/workflows/spirv-ci-windows-amd-staging.yml +++ b/.github/workflows/spirv-ci-windows-amd-staging.yml @@ -1,9 +1,9 @@ # Windows variant of the SPIRV CI: builds LLVM/Clang/translator/Comgr in # one job and runs SPIRV-relevant test suites in parallel test jobs that -# consume a GHA artifact uploaded by the build job. Mirrors spirv-ci-linux.yml +# consume a GHA artifact uploaded by the build job. Mirrors spirv-ci-linux-amd-staging.yml # in shape; differs in runner, MSVC env setup, no container, no strip. -name: SPIRV Compiler CI - Windows +name: SPIRV Compiler CI - Windows - amd-staging on: workflow_call: