|
| 1 | +name: 'Aggregate compute-benchmark results and produce historical averages' |
| 2 | + |
| 3 | +# The benchmarking workflow in sycl-linux-run-tests.yml passes or fails based on |
| 4 | +# how the benchmark results compare to a historical average: This historical |
| 5 | +# average is calculated in this composite workflow, which aggregates historical |
| 6 | +# data and produces measures of central tendency (median in this case) used for |
| 7 | +# this purpose. |
| 8 | +# |
| 9 | +# This action assumes that /devops has been checked out in ./devops. This action |
| 10 | +# also assumes that GITHUB_TOKEN was properly set in env, because according to |
| 11 | +# Github, that's apparently the recommended way to pass a secret into a github |
| 12 | +# action: |
| 13 | +# |
| 14 | +# https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#accessing-your-secrets |
| 15 | +# |
| 16 | + |
| 17 | +inputs: |
| 18 | + lookback_days: |
| 19 | + type: number |
| 20 | + required: true |
| 21 | + |
| 22 | +runs: |
| 23 | + using: "composite" |
| 24 | + steps: |
| 25 | + - name: Obtain oldest timestamp allowed for data in aggregation |
| 26 | + shell: bash |
| 27 | + run: | |
| 28 | + # DO NOT use inputs.lookback_days directly, only use SANITIZED_TIMESTAMP. |
| 29 | + SANITIZED_LOOKBACK_DAYS="$(echo '${{ inputs.lookback_days }}' | grep -oE '^[0-9]+$')" |
| 30 | + if [ -z "$SANITIZED_LOOKBACK_DAYS" ]; then |
| 31 | + echo "Please ensure inputs.lookback_days is a number." |
| 32 | + exit 1 |
| 33 | + fi |
| 34 | + SANITIZED_TIMESTAMP="$(date -d "$SANITIZED_LOOKBACK_DAYS days ago" +%Y%m%d_%H%M%S)" |
| 35 | + if [ -z "$(echo "$SANITIZED_TIMESTAMP" | grep -oE '^[0-9]{8}_[0-9]{6}$' )" ]; then |
| 36 | + echo "Invalid timestamp generated: is inputs.lookback_days valid?" |
| 37 | + exit 1 |
| 38 | + fi |
| 39 | + echo "SANITIZED_TIMESTAMP=$SANITIZED_TIMESTAMP" >> $GITHUB_ENV |
| 40 | + - name: Load benchmarking configuration |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + $(python ./devops/scripts/benchmarking/load_config.py ./devops constants) |
| 44 | + echo "SANITIZED_PERF_RES_GIT_REPO=$SANITIZED_PERF_RES_GIT_REPO" >> $GITHUB_ENV |
| 45 | + echo "SANITIZED_PERF_RES_GIT_BRANCH=$SANITIZED_PERF_RES_GIT_BRANCH" >> $GITHUB_ENV |
| 46 | + - name: Checkout historical performance results repository |
| 47 | + shell: bash |
| 48 | + run: | |
| 49 | + if [ ! -d ./llvm-ci-perf-results ]; then |
| 50 | + git clone -b "$SANITIZED_PERF_RES_GIT_BRANCH" "https://github.com/$SANITIZED_PERF_RES_GIT_REPO" ./llvm-ci-perf-results |
| 51 | + fi |
| 52 | + - name: Run aggregator on historical results |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + # The current format of the historical results respository is: |
| 56 | + # |
| 57 | + # /<ONEAPI_DEVICE_SELECTOR>/<runner>/<test name> |
| 58 | + # |
| 59 | + # Thus, a min/max depth of 3 is used to enumerate all test cases in the |
| 60 | + # repository. Test name is also derived from here. |
| 61 | + find ./llvm-ci-perf-results -mindepth 3 -maxdepth 3 -type d ! -path '*.git*' | |
| 62 | + while read -r dir; do |
| 63 | + test_name="$(basename "$dir")" |
| 64 | + python ./devops/scripts/benchmarking/aggregate.py ./devops "$test_name" "$dir" "$SANITIZED_TIMESTAMP" |
| 65 | + done |
| 66 | + - name: Upload average to the repo |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + cd ./llvm-ci-perf-results |
| 70 | + git config user.name "SYCL Benchmarking Bot" |
| 71 | + git config user.email "[email protected]" |
| 72 | + git pull |
| 73 | + # Make sure changes have been made |
| 74 | + if git diff --quiet && git diff --cached --quiet; then |
| 75 | + echo "No changes to median, skipping push." |
| 76 | + else |
| 77 | + git add . |
| 78 | + git commit -m "[GHA] Aggregate median data from $SANITIZED_TIMESTAMP to $(date +%Y%m%d_%H%M%S)" |
| 79 | + git push "https://[email protected]/$SANITIZED_PERF_RES_GIT_REPO.git" "$SANITIZED_PERF_RES_GIT_BRANCH" |
| 80 | + fi |
| 81 | + - name: Find aggregated average results artifact here |
| 82 | + if: always() |
| 83 | + shell: bash |
| 84 | + run: | |
| 85 | + cat << EOF |
| 86 | + # |
| 87 | + # Artifact link for aggregated averages here: |
| 88 | + # |
| 89 | + EOF |
| 90 | + - name: Archive new medians |
| 91 | + if: always() |
| 92 | + uses: actions/upload-artifact@v4 |
| 93 | + with: |
| 94 | + name: llvm-ci-perf-results new medians |
| 95 | + path: ./llvm-ci-perf-results/**/*-median.csv |
0 commit comments