Skip to content

Commit bce5229

Browse files
committed
Remove cutoff timestamp behavior for aggregate
1 parent 2951b37 commit bce5229

File tree

5 files changed

+25
-34
lines changed

5 files changed

+25
-34
lines changed

.github/workflows/sycl-benchmark-aggregate.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ name: Aggregate compute-benchmark averages from historical data
99
on:
1010
workflow_dispatch:
1111
inputs:
12-
cutoff_timestamp:
12+
lookback_days:
1313
description: |
14-
Timestamp (YYYYMMDD_HHMMSS) indicating the age limit of data used in
15-
average calculation: Any benchmark results created before this
16-
timestamp is excluded from being aggregated.
17-
type: string
14+
Number of days from today to look back in historical results for:
15+
This sets the age limit of data used in average calculation: Any
16+
benchmark results created before `lookback_days` from today is
17+
excluded from being aggregated in the historical average.
18+
type: number
1819
required: true
1920
workflow_call:
2021
inputs:
21-
cutoff_timestamp:
22-
type: string
22+
lookback_days:
23+
type: number
2324
required: true
2425

2526
permissions:
@@ -38,6 +39,6 @@ jobs:
3839
- name: Aggregate benchmark results and produce historical average
3940
uses: ./devops/actions/benchmarking/aggregate
4041
with:
41-
cutoff_timestamp: ${{ inputs.cutoff_timestamp }}
42+
lookback_days: ${{ inputs.lookback_days }}
4243
env:
43-
GITHUB_TOKEN: ${{ secrets.LLVM_SYCL_BENCHMARK_TOKEN }}
44+
GITHUB_TOKEN: ${{ secrets.LLVM_SYCL_BENCHMARK_TOKEN }}

.github/workflows/sycl-nightly.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ jobs:
242242
if: always() && !cancelled()
243243
name: Aggregate benchmark results and produce historical averages
244244
uses: ./.github/workflows/sycl-benchmark-aggregate.yml
245+
with:
246+
lookback_days: 7
245247

246248
run-sycl-benchmarks:
247249
needs: [ubuntu2204_build, aggregate_benchmark_results]

devops/actions/benchmarking/aggregate/action.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,23 @@ name: 'Aggregate compute-benchmark results and produce historical averages'
1515
#
1616

1717
inputs:
18-
cutoff_timestamp:
19-
type: string
18+
lookback_days:
19+
type: number
2020
required: true
2121

2222
runs:
2323
using: "composite"
2424
steps:
25-
- name: Sanitize provided timestamp
25+
- name: Obtain oldest timestamp allowed for data in aggregation
2626
shell: bash
2727
run: |
28-
# Sanitize the cutoff timestamp provided
29-
#
30-
# This timestamp controls which historical results are used to compute
31-
# measures of central tendency: Any files timestamped *before* this time
32-
# will be *excluded* from the central tendency calculation.
33-
34-
# Regex greps YYYYMMDD_HHMMSS
35-
TIMESTAMP_RE='^[0-9]{4}(0[1-9]|1[0-2])([0-2][0-9]|3[01])_([01][0-9]|2[0-3])([0-5][0-9])([0-5][0-9])$'
36-
37-
# Note:
38-
# - variables from input context should be surrounded with '' to prevent
39-
# remote code execution
40-
# - `-o` needs to be kept in the grep command; `-o` is exact match only,
41-
# incase user somehow manages to inject extra text, `-o` should take
42-
# care of it.
43-
# - DO NOT use input.cutoff_timestamp directly, only use SANITIZED_TIMESTAMP
44-
SANITIZED_TIMESTAMP="$(echo '${{ inputs.cutoff_timestamp }}' | grep -oE "$TIMESTAMP_RE")"
28+
# DO NOT use inputs.lookback_days directly, only use SANITIZED_TIMESTAMP.
29+
SANITIZED_LOOKBACK_DAYS ="$(echo '${{ inputs.lookback_days }}' | grep -o "^[0-9]$")"
4530
if [ -z "$SANITIZED_TIMESTAMP" ]; then
46-
echo "Please ensure input in input.cutoff_timestamp is exactly YYYYMMDD_HHMMSS."
47-
exit 1 # Terminate workflow
31+
echo "Please ensure inputs.lookback_days is a number.
32+
exit 1
4833
fi
34+
SANITIZED_TIMESTAMP="$(date -d "$SANITIZED_LOOKBACK_DAYS days ago" +%Y%m%d_%H%M%S)"
4935
echo "SANITIZED_TIMESTAMP=$SANITIZED_TIMESTAMP" >> $GITHUB_ENV
5036
- name: Load benchmarking configuration
5137
shell: bash

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ runs:
5454
git add .
5555
git commit -m "[GHA] Upload compute-benchmarks results from https://github.com/intel/llvm/actions/runs/${{ github.run_id }}"
5656
git push "https://[email protected]/$SANITIZED_PERF_RES_GIT_REPO.git" "$SANITIZED_PERF_RES_GIT_BRANCH"
57+
- shell: bash
58+
run: echo \n\#\n\# Artifact link for benchmark results here\n\#\n
5759
- name: Archive compute-benchmark results
5860
if: always()
5961
uses: actions/upload-artifact@v4
@@ -64,6 +66,6 @@ runs:
6466
if: always()
6567
uses: ./devops/actions/benchmarking/aggregate
6668
with:
67-
cutoff_timestamp: 20240101_000000
69+
lookback_days: 7
6870
env:
6971
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}

devops/scripts/benchmarking/benchmark.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ check_regression() {
8585
#
8686
# Usage: cache <relative path of output csv>
8787
cache() {
88-
mkdir -p ./artifact/passing_tests/ ./artifact/failed_tests
88+
mkdir -p "$(dirname ./artifact/passing_tests/$1)" "$(dirname ./artifact/failed_tests/$1)"
8989
cp "./artifact/failed_tests/$1" "./artifact/passing_tests/$1"
9090
mv "./artifact/failed_tests/$1" "./llvm-ci-perf-results/$1"
9191
}
@@ -112,7 +112,7 @@ process_benchmarks() {
112112
echo "Setting tests to run via cli is not currently supported."
113113
exit 1
114114
else
115-
rm ./artifact/benchmarks_errored.log ./artifact/benchmarks_failed.log
115+
rm ./artifact/benchmarks_errored.log ./artifact/benchmarks_failed.log 2> /dev/null
116116
mkdir -p ./artifact
117117
# Loop through each line of enabled_tests.conf, but ignore lines in the
118118
# test config starting with #'s:

0 commit comments

Comments
 (0)