[llvm] [libc++] Add a workflow to run libc++ benchmarks on historical commits (PR #208080)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 12:53:34 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

This allows triggering a workflow that benchmarks a given commit on both macOS and Linux, and optionally submits the results to a LNT instance (by default lnt.llvm.org).

Triggering this workflow requires write access to the LLVM monorepo, so the inputs can be trusted to a large extent.

The intent is for this workflow to be triggered semi-automatically by a combination of scripts and manual intervention. For example, we can reuse a script like libcxx/utils/ci/lnt/commit-watch to automatically trigger the workflow on new commits, while also requesting new commits when bisecting regressions, etc. Since workflows can be dispatched via the Github API, this should easily be scriptable.

A few important improvements are currently missing from this workflow and left for future patches:
- The ability to select only a subset of configurations to run
- Additional configurations, such as unstable ABI, hardening, etc.

---
Full diff: https://github.com/llvm/llvm-project/pull/208080.diff


1 Files Affected:

- (added) .github/workflows/libcxx-benchmark-commit.yml (+110) 


``````````diff
diff --git a/.github/workflows/libcxx-benchmark-commit.yml b/.github/workflows/libcxx-benchmark-commit.yml
new file mode 100644
index 0000000000000..309fdc556451e
--- /dev/null
+++ b/.github/workflows/libcxx-benchmark-commit.yml
@@ -0,0 +1,110 @@
+# This file defines a workflow that runs the libc++ benchmarks at the given commit.
+# This workflow is intended to be triggered manually or via the Github API. As such,
+# it requires several inputs that allow customizing its behavior.
+
+name: Benchmark libc++ commit
+
+permissions:
+  contents: read
+
+on:
+  # TODO: Support dispatching only to selected configurations.
+  workflow_dispatch:
+    inputs:
+      commit:
+        description: 'The libc++ commit to benchmark'
+        required: true
+        type: string
+      benchmark-suite-version:
+        description: 'The version of the benchmark suite to use (a LLVM monorepo SHA)'
+        required: false
+        type: string
+        default: 0eefb2682bf8c04954c46e91916b5164d8424702
+      filter:
+        description: 'An optional filter to determine which benchmarks to run'
+        required: false
+        type: string
+      submit-lnt:
+        description: 'Whether to submit the results to LNT -- dry-run unless opted in'
+        required: false
+        type: boolean
+        default: false
+      lnt-url:
+        description: 'The URL of the LNT instance to submit to'
+        required: false
+        type: string
+        default: http://lnt.llvm.org
+
+jobs:
+  run-benchmarks:
+    strategy:
+      matrix:
+        include:
+          - lnt-machine: macos-26.5-arm64
+            runner: ["self-hosted", "macOS", "ARM64", "26", "26.5"]
+            cxx: clang++
+            install-python: false
+            install-macos-dependencies: true
+          - lnt-machine: linux-x86_64
+            runner: llvm-premerge-libcxx-next-runners
+            cxx: clang++-22
+            install-python: true
+            install-macos-dependencies: false
+      fail-fast: false
+    runs-on: ${{ matrix.runner }}
+    steps:
+      - name: Checkout the LLVM monorepo
+        uses: actions/checkout at de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+        with:
+          persist-credentials: false
+          # We benchmark arbitrary historical commits, which requires the full history to be available.
+          fetch-depth: 0
+          fetch-tags: true
+
+      - name: Install Python
+        if: ${{ matrix.install-python }}
+        uses: actions/setup-python at a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
+        with:
+          python-version: '3.14'
+
+      - name: Install Ninja and CMake
+        if: ${{ matrix.install-macos-dependencies }}
+        run: |
+          brew install ninja cmake
+
+      - name: Diagnose tools in use
+        run: |
+          cmake --version
+          ninja --version
+          ${{ matrix.cxx }} --version
+
+      - name: Run the benchmarks
+        env:
+          COMMIT: ${{ inputs.commit }}
+          BENCHMARK_SUITE_VERSION: ${{ inputs.benchmark-suite-version }}
+          FILTER: ${{ inputs.filter }}
+        run: |
+          filter_arg=()
+          if [ -n "${FILTER}" ]; then
+            filter_arg=(--filter "${FILTER}")
+          fi
+          libcxx/utils/ci/lnt/run-benchmarks                            \
+            --test-suite-commit "${BENCHMARK_SUITE_VERSION}"            \
+            --machine ${{ matrix.lnt-machine }}                         \
+            --compiler ${{ matrix.cxx }}                                \
+            --benchmark-commit "${COMMIT}"                              \
+            "${filter_arg[@]}"                                          \
+            --output "${COMMIT}.json"
+
+          cat "${COMMIT}.json"
+
+      - name: Submit to LNT
+        if: ${{ inputs.submit-lnt }}
+        env:
+          COMMIT: ${{ inputs.commit }}
+          LNT_URL: ${{ inputs.lnt-url }}
+        run: |
+          libcxx/utils/ci/lnt/submit-benchmarks             \
+            --lnt-url "${LNT_URL}"                          \
+            --test-suite libcxx2                            \
+            "${COMMIT}.json"

``````````

</details>


https://github.com/llvm/llvm-project/pull/208080


More information about the llvm-commits mailing list