Skip to content

Commit f713a06

Browse files
authored
[CI][Bench] Add a filter to comparison scripts (#18852)
The nightly SYCL benchmarking CI currently fails on any benchmark. However, not all benchmarks are specific to SYCL. This PR adds a filter and sets the nightly SYCL CI to only fail on compute benchmark tests marked with `_sycl`. **Note** to llvm-reviewers-benchmarking: Observe that changes to the code here are disconnected from the main benchmarking scripts. This PR should functionally have no effect on the main benchmarking scripts.
1 parent 8d5cb0d commit f713a06

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

devops/actions/run-tests/benchmark/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ runs:
161161
python3 ./devops/scripts/benchmarks/compare.py to_hist \
162162
--name "$SAVE_NAME" \
163163
--compare-file "./llvm-ci-perf-results/results/${SAVE_NAME}_${SAVE_TIMESTAMP}.json" \
164-
--results-dir "./llvm-ci-perf-results/results/"
164+
--results-dir "./llvm-ci-perf-results/results/" \
165+
--regression-filter '^[a-z_]_sycl '
165166
echo "-----"
166167

167168
- name: Cache changes to benchmark folder for archival purposes

devops/scripts/benchmarks/compare.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from options import options
55

66
import os
7+
import re
78
import sys
89
import json
910
import argparse
@@ -319,6 +320,12 @@ def to_hist(
319320
help="Timestamp (in YYYYMMDD_HHMMSS) of oldest result to include in historic average calculation",
320321
default="20000101_010101",
321322
)
323+
parser_avg.add_argument(
324+
"--regression-filter",
325+
type=str,
326+
help="If provided, only regressions matching provided regex will cause exit status 1.",
327+
default=None,
328+
)
322329

323330
args = parser.parse_args()
324331

@@ -333,24 +340,40 @@ def to_hist(
333340
"median", args.name, args.compare_file, args.results_dir, args.cutoff
334341
)
335342

343+
# Not all regressions are of concern: if a filter is provided, filter
344+
# regressions using filter
345+
regressions_ignored = []
346+
regressions_of_concern = []
347+
if args.regression_filter is not None:
348+
filter_pattern = re.compile(args.regression_filter)
349+
for test in regressions:
350+
if filter_pattern.search(test["name"]):
351+
regressions_of_concern.append(test)
352+
else:
353+
regressions_ignored.append(test)
354+
336355
def print_regression(entry: dict):
337356
"""Print an entry outputted from Compare.to_hist"""
338357
print(f"Test: {entry['name']}")
339358
print(f"-- Historic {entry['avg_type']}: {entry['hist_avg']}")
340-
print(f"-- Run result: {test['value']}")
341-
print(f"-- Delta: {test['delta']}")
359+
print(f"-- Run result: {entry['value']}")
360+
print(f"-- Delta: {entry['delta']}")
342361
print("")
343362

344363
if improvements:
345364
print("#\n# Improvements:\n#\n")
346365
for test in improvements:
347366
print_regression(test)
348-
if regressions:
367+
if regressions_ignored:
368+
print("#\n# Regressions (filtered out by regression-filter):\n#\n")
369+
for test in regressions_ignored:
370+
print_regression(test)
371+
if regressions_of_concern:
349372
print("#\n# Regressions:\n#\n")
350-
for test in regressions:
373+
for test in regressions_of_concern:
351374
print_regression(test)
352375
exit(1) # Exit 1 to trigger github test failure
353-
print("\nNo regressions found!")
376+
print("\nNo unexpected regressions found!")
354377
else:
355378
print("Unsupported operation: exiting.")
356379
exit(1)

0 commit comments

Comments
 (0)