ENH: Add performance benchmark CI builds#612
ENH: Add performance benchmark CI builds#612thewtex wants to merge 2 commits intoInsightSoftwareConsortium:mainfrom
Conversation
6a32231 to
ce113c5
Compare
|
Speechless. Awesome. |
71f2cc5 to
111d88b
Compare
c0f2bbb to
289543a
Compare
fa20324 to
96b6114
Compare
96b6114 to
b1d0d43
Compare
b1d0d43 to
9cc56fa
Compare
|
Errors:
|
9cc56fa to
1e53cfb
Compare
|
Hmm. Seems we got a timeout on one of our queries. Do: check |
0948b8f to
698efc6
Compare
8e4c0f3 to
c6b6b60
Compare
|
Updated macOS version from 10.13: to macOS 11, and Python from 3.7 to 3.9: Preferred to avoid style changes to the existing parts, e.g.: Not sure if this will be enough to have this working. If Azure allows to re-use workflows, cleanest would be to relocate the performance benchmarking part to a separate file so that the macOS build part can report its status regardless of the benchmarking part. |
|
So the benchmarks add 22 minutes; If this is deemed excessive, they could be triggered e.g. once or twice a week. The next thing will be how to display those reports on a website. |
|
I started an ASV port on the ITKPerformanceBenchmarking repository. Eventually we should be able to run |
|
FWIW we ran into some minor issues with recent asv and our setups, just in case you do too -- might want to restrict for now to |
Add .github/workflows/perf-benchmark.yml, an opt-in GHA workflow
that runs the ASV-based performance regression harness hosted at
InsightSoftwareConsortium/ITKPerformanceBenchmarking on pull
requests labelled 'performance' (or via manual dispatch).
The workflow:
- Computes BASE = merge-base(PR, origin/master) and builds ITK at
both BASE and PR HEAD with Module_PerformanceBenchmarking=ON,
BUILD_EXAMPLES=ON, BUILD_TESTING=ON (required for the
ExternalData fixture fetch), and BUILD_SHARED_LIBS=OFF. The two
builds share a ccache so the second build is mostly incremental.
- Builds only the benchmark executables plus ITKBenchmarksData,
avoiding a full ITK test suite build.
- Checks out InsightSoftwareConsortium/ITKPerformanceBenchmarking
at the PERF_HARNESS_REF env var (defaults to the asv-native-
harness branch while that work is landing upstream; flip to a
merged SHA afterwards).
- Creates the 'itk-repo' symlink required by the harness's
asv.conf.json, installs the itk_perf_shim Python package, and
runs 'asv run --set-commit-hash <SHA>' against each build so
result labels track ITK history.
- 'asv compare --factor=1.10 --split' produces a markdown diff;
posted as a sticky PR comment and uploaded as an artifact along
with the 'asv publish' HTML tree.
Opt-in via the 'performance' label keeps the two-ITK-build cost
off the default PR path. No changes to any existing workflow or
Azure Pipelines file.
Replaces the intent of the long-stalled thewtex/ITK:ci-performance-
builds branch (InsightSoftwareConsortium#612), which proposed
an Azure Pipelines job targetting the retired macos-11 image and
the legacy evaluate-itk-performance.py driver.
c6b6b60 to
fbbbf29
Compare
fbbbf29 to
cfa9a3f
Compare
cfa9a3f to
c4e39a6
Compare
|
@thewtex — the rebase + To remove the in-workflow patch permanently:
|
Adds .github/workflows/perf-benchmark.yml — a GitHub Actions workflow that builds ITK twice (merge-base and PR HEAD) with the PerformanceBenchmarking remote module enabled, then drives the ASV harness from InsightSoftwareConsortium/ITKPerformanceBenchmarking#111 against each build to produce an asv compare report. Bumps the PerformanceBenchmarking remote module pin from 7950c1d76095033edbf7601a925cdacc2fe717f9 to 41bf1b9cfbaa1b146e1b3e5d3ad3571b2203ce1e (master HEAD, post-InsightSoftwareConsortium#111). The new pin carries: * asv.conf.json, benchmarks/{core,filtering,segmentation}.py, python/itk_perf_shim/ (the ASV harness). * Hardened examples/Core/itkCopyIterationBenchmark.cxx that no longer crashes on VectorImage under ITK >= 1d87efa (the VLV null-data regression; see InsightSoftwareConsortium#6087 for the parallel ITK-side defensive null-guard). Supersedes the 2019 Azure Pipelines macos-11 approach; macos-11 is retired and the older evaluate-itk-performance.py driver has been replaced by the ASV-native harness. For the very first PR (this one) the merge-base lacks the new pin, so its benchmark run is best-effort and the asv compare step is wrapped with continue-on-error. The workflow becomes fully useful for regression detection after this PR lands.
ITKPerformanceBenchmarking#113 merged as b24324f922, making the in- workflow python/json sed-patch that the earlier revision of this PR carried unnecessary. Bumping the GIT_TAG to pick up the upstream fix and reverting to thewtex's original, unpatched perf-benchmark.yml.
c4e39a6 to
2359970
Compare
|
@thewtex — ITKPerformanceBenchmarking#113 merged (b24324f922). Force-pushed tip Net diff vs the pre-rebase tip
Fresh CI kicked off; should settle similarly to the previous run ( |
|
| Filename | Overview |
|---|---|
| .github/workflows/perf-benchmark.yml | New CI workflow running ASV benchmarks on base vs HEAD; broken for workflow_dispatch due to empty github.base_ref, and has unused CMakeVersion/ExternalDataVersion env vars. |
| Modules/Remote/PerformanceBenchmarking.remote.cmake | Single-line GIT_TAG bump to pin the commit that introduced the ASV harness (asv.conf.json) required by the new workflow. |
Sequence Diagram
sequenceDiagram
participant GHA as GitHub Actions
participant Base as itk-base (merge-base)
participant Head as itk-head (PR HEAD)
participant ASV as ASV Harness
GHA->>Base: checkout @ merge-base
GHA->>Head: checkout @ PR HEAD (full history)
GHA->>Base: cmake configure + build benchmark targets
GHA->>Head: cmake configure + build benchmark targets
Note over Head: PerformanceBenchmarking module populated with asv.conf.json
GHA->>ASV: pip install harness (from itk-head)
GHA->>ASV: asv machine --yes
GHA->>ASV: asv run --quick @ merge-base SHA
Note over ASV: continue-on-error: true
GHA->>ASV: asv run --quick @ HEAD SHA
GHA->>ASV: asv compare merge-base HEAD
ASV-->>GHA: asv-compare.txt + results artifact
Reviews (1): Last reviewed commit: "COMP: Bump PerformanceBenchmarking pin t..." | Re-trigger Greptile
| HEAD_SHA=$(git rev-parse HEAD) | ||
| echo "merge_base=${MERGE_BASE}" >> "$GITHUB_OUTPUT" | ||
| echo "head=${HEAD_SHA}" >> "$GITHUB_OUTPUT" | ||
| echo "merge_base=${MERGE_BASE} head=${HEAD_SHA}" | ||
|
|
||
| - name: Checkout ITK at merge-base (shallow) | ||
| uses: actions/checkout@v4 |
There was a problem hiding this comment.
github.base_ref is empty for workflow_dispatch
When the workflow is triggered manually via workflow_dispatch, github.base_ref is an empty string. Line 58 expands to git fetch origin "", which fails immediately with fatal: couldn't find remote ref. The entire asv-compare job becomes broken for manual runs.
You either need to guard this block behind a pull_request-only condition or supply a fallback (e.g. ${{ github.base_ref || 'main' }}):
| HEAD_SHA=$(git rev-parse HEAD) | |
| echo "merge_base=${MERGE_BASE}" >> "$GITHUB_OUTPUT" | |
| echo "head=${HEAD_SHA}" >> "$GITHUB_OUTPUT" | |
| echo "merge_base=${MERGE_BASE} head=${HEAD_SHA}" | |
| - name: Checkout ITK at merge-base (shallow) | |
| uses: actions/checkout@v4 | |
| git fetch origin "${{ github.base_ref || 'main' }}" | |
| MERGE_BASE=$(git merge-base HEAD "origin/${{ github.base_ref || 'main' }}") |
| CMakeVersion: "4.0.1" | ||
| # ASV-wired targets — see Modules/Remote/PerformanceBenchmarking's python/itk_perf_shim/registry.py. |
There was a problem hiding this comment.
Declared env vars are never consumed
ExternalDataVersion: 5.4.5 and CMakeVersion: "4.0.1" are defined at the workflow level but referenced nowhere in any run step. CMakeVersion is particularly suspect: Ubuntu 24.04's default apt ships CMake 3.28, not 4.0.1. If CMake 4.x is required (e.g. for FetchContent changes in 4.0), a step to install it via pip install cmake==4.0.1 or the jwlawson/actions-setup-cmake action is missing. If they're not needed, removing them avoids confusion.
| continue-on-error: true | ||
| env: | ||
| ITK_BENCHMARK_BIN: ${{ runner.temp }}/ITK-build-base/bin | ||
| ITK_BENCHMARK_DATA: ${{ runner.temp }}/ITK-build-base/ExternalData/Modules/Remote/PerformanceBenchmarking/examples/Data/Input | ||
| ITK_BENCHMARK_SCRATCH: ${{ runner.temp }}/asv-scratch-base | ||
| run: | | ||
| mkdir -p "${ITK_BENCHMARK_SCRATCH}" | ||
| asv run --machine gha-ubuntu-24.04 \ | ||
| --set-commit-hash "${{ steps.sha.outputs.merge_base }}" --quick | ||
|
|
There was a problem hiding this comment.
--quick produces single-shot, noisy measurements
asv run --quick executes each benchmark exactly once. With no statistical averaging, the compare output will reflect OS scheduling noise as much as real code differences, making it hard to distinguish genuine regressions from measurement jitter. Consider omitting --quick (or replacing with --min-runs 3) so ASV collects a small sample and reports median-based results, which is the standard for reliable CI benchmarking.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
No description provided.