Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): Execution time report #6827

Merged
merged 64 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
2b0b91e
script for execution time reports and initial job
vezenovm Dec 16, 2024
7ba4e0a
update index chmod=+x
vezenovm Dec 16, 2024
3a63dd3
update report we want to parse
vezenovm Dec 16, 2024
2ba58b1
include external repos
vezenovm Dec 16, 2024
dfdf06c
include missing dep for upload_execution_report
vezenovm Dec 16, 2024
fd7e4e1
check something
vezenovm Dec 16, 2024
d874989
more debug
vezenovm Dec 16, 2024
c116c0f
more debug
vezenovm Dec 16, 2024
aceefe7
initial switch to downloading compilation artifacts for basic executi…
vezenovm Dec 16, 2024
5814373
remove working dir in compilation report artifact upload
vezenovm Dec 16, 2024
b3981ed
correct path to target
vezenovm Dec 16, 2024
2428d65
one more path fix
vezenovm Dec 16, 2024
a6b01c8
check dir
vezenovm Dec 16, 2024
c419609
use -r
vezenovm Dec 16, 2024
5512b73
make artifacts dir
vezenovm Dec 16, 2024
bbb8a88
generate artifact for execution report with some debug info
vezenovm Dec 16, 2024
cda758c
syntax err
vezenovm Dec 17, 2024
84bc54c
make target dir
vezenovm Dec 17, 2024
f2e9053
generate compilation artifacts for extneral repo execution reports
vezenovm Dec 17, 2024
3b29959
use target dir artifacts to get package name
vezenovm Dec 17, 2024
4d838a2
correct deps
vezenovm Dec 17, 2024
37bdb80
artifact pattern not name
vezenovm Dec 17, 2024
0602ac0
remove target creation
vezenovm Dec 17, 2024
5c7c89f
debug cmds
vezenovm Dec 17, 2024
b874bd5
try if statement
vezenovm Dec 17, 2024
87e8e45
use == not -eq
vezenovm Dec 17, 2024
a07d475
actually check against name from matrix
vezenovm Dec 17, 2024
17c5005
remove old ls cmd
vezenovm Dec 17, 2024
b917155
just ls the working dir
vezenovm Dec 17, 2024
d3ac7ba
also ls in the previous step
vezenovm Dec 17, 2024
991372c
extract name further from artifact
vezenovm Dec 17, 2024
1f96772
try just moving
vezenovm Dec 17, 2024
4fdfcf4
renaming one more time
vezenovm Dec 17, 2024
8b60f58
remove cd
vezenovm Dec 17, 2024
af5106e
fixup names
vezenovm Dec 17, 2024
67b37c5
go back to what works for now
vezenovm Dec 17, 2024
e4dc52d
switch to use correct package name for artifact
vezenovm Dec 17, 2024
abb5e32
see why artifact is not uploading
vezenovm Dec 17, 2024
e1efa4c
use correct step id
vezenovm Dec 17, 2024
e5c7106
cleanup reports
vezenovm Dec 17, 2024
7602e2a
remove another cat
vezenovm Dec 17, 2024
db2bbcb
remove unnecessary ls
vezenovm Dec 17, 2024
e318efb
inline execution report into comp report
vezenovm Dec 17, 2024
e65d217
mark the otherprojects libraries
vezenovm Dec 17, 2024
094a8ab
try without external report
vezenovm Dec 17, 2024
1747645
remove old dep
vezenovm Dec 17, 2024
f8f938e
add back external_repo_compilation_and_execution_report
vezenovm Dec 17, 2024
162807d
switch to string
vezenovm Dec 17, 2024
f398958
try against with flag don't know why it didn't work before
vezenovm Dec 17, 2024
94d2e4b
remove comment
vezenovm Dec 17, 2024
7c92151
no is_library flag
vezenovm Dec 17, 2024
9c94444
finding syntax error in comp and exec report
vezenovm Dec 17, 2024
ebb966a
bring back checkout of report and execution
vezenovm Dec 17, 2024
5bc0ab1
move execution reports
vezenovm Dec 17, 2024
1603e07
clashing ids
vezenovm Dec 17, 2024
3752925
upload execution report
vezenovm Dec 17, 2024
2d0fbd3
cleanup diff
vezenovm Dec 17, 2024
cbaca05
use correct ids when uploading
vezenovm Dec 17, 2024
7184e40
bring back is library flag
vezenovm Dec 17, 2024
dc02e94
uncomment check
vezenovm Dec 17, 2024
3ed1fdf
add [ ]
vezenovm Dec 17, 2024
22e1a68
move execution report only if not library
vezenovm Dec 17, 2024
25d2fdb
move cond to job directly
vezenovm Dec 18, 2024
21f8c32
cond in other part of job
vezenovm Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 105 additions & 11 deletions .github/workflows/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ jobs:
retention-days: 3
overwrite: true

generate_compilation_report:
name: Compilation time
generate_compilation_and_execution_report:
name: Compilation and execution time
needs: [build-nargo]
runs-on: ubuntu-22.04
permissions:
Expand All @@ -253,34 +253,47 @@ jobs:
working-directory: ./test_programs
run: |
./compilation_report.sh
cat compilation_report.json
mv compilation_report.json ../compilation_report.json

- name: Generate Execution report
working-directory: ./test_programs
run: |
./execution_report.sh
mv execution_report.json ../execution_report.json

- name: Upload compilation report
uses: actions/upload-artifact@v4
with:
name: in_progress_compilation_report
path: compilation_report.json
retention-days: 3
overwrite: true

- name: Upload execution report
uses: actions/upload-artifact@v4
with:
name: in_progress_execution_report
path: execution_report.json
retention-days: 3
overwrite: true

external_repo_compilation_report:
external_repo_compilation_and_execution_report:
needs: [build-nargo]
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-contracts }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-contracts, is_library: "true" }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/parity-root }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-inner }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-tail }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-reset }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/rollup-base-private }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/rollup-base-public }

name: External repo compilation report - ${{ matrix.project.repo }}/${{ matrix.project.path }}
name: External repo compilation and execution reports - ${{ matrix.project.repo }}/${{ matrix.project.path }}
steps:
- name: Download nargo binary
uses: actions/download-artifact@v4
Expand All @@ -302,6 +315,13 @@ jobs:
sparse-checkout: |
test_programs/compilation_report.sh
sparse-checkout-cone-mode: false

- uses: actions/checkout@v4
with:
path: scripts
sparse-checkout: |
test_programs/execution_report.sh
sparse-checkout-cone-mode: false

- name: Checkout
uses: actions/checkout@v4
Expand All @@ -316,28 +336,57 @@ jobs:
mv /home/runner/work/noir/noir/scripts/test_programs/compilation_report.sh ./compilation_report.sh
chmod +x ./compilation_report.sh
./compilation_report.sh 1

- name: Generate execution report
working-directory: ./test-repo/${{ matrix.project.path }}
run: |
mv /home/runner/work/noir/noir/scripts/test_programs/execution_report.sh ./execution_report.sh
IS_LIBRARY=${{ matrix.project.is_library }}
if [[ "$IS_LIBRARY" != "true" ]]; then
./execution_report.sh 1
fi

- name: Move compilation report
id: report
id: compilation_report
shell: bash
run: |
PACKAGE_NAME=${{ matrix.project.path }}
PACKAGE_NAME=$(basename $PACKAGE_NAME)
mv ./test-repo/${{ matrix.project.path }}/compilation_report.json ./compilation_report_$PACKAGE_NAME.json
echo "compilation_report_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT

- name: Move execution report
id: execution_report
shell: bash
run: |
IS_LIBRARY=${{ matrix.project.is_library }}
if [[ "$IS_LIBRARY" != "true" ]]; then
vezenovm marked this conversation as resolved.
Show resolved Hide resolved
PACKAGE_NAME=${{ matrix.project.path }}
PACKAGE_NAME=$(basename $PACKAGE_NAME)
mv ./test-repo/${{ matrix.project.path }}/execution_report.json ./execution_report_$PACKAGE_NAME.json
echo "execution_report_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
fi

- name: Upload compilation report
uses: actions/upload-artifact@v4
with:
name: compilation_report_${{ steps.report.outputs.compilation_report_name }}
path: compilation_report_${{ steps.report.outputs.compilation_report_name }}.json
name: compilation_report_${{ steps.compilation_report.outputs.compilation_report_name }}
path: compilation_report_${{ steps.compilation_report.outputs.compilation_report_name }}.json
retention-days: 3
overwrite: true

- name: Upload execution report
uses: actions/upload-artifact@v4
with:
name: execution_report_${{ steps.execution_report.outputs.execution_report_name }}
path: execution_report_${{ steps.execution_report.outputs.execution_report_name }}.json
retention-days: 3
overwrite: true

upload_compilation_report:
name: Upload compilation report
needs: [generate_compilation_report, external_repo_compilation_report]
# We want this job to run even if one variation of the matrix in `external_repo_compilation_report` fails
needs: [generate_compilation_and_execution_report, external_repo_compilation_and_execution_report]
# We want this job to run even if one variation of the matrix in `external_repo_compilation_and_execution_report` fails
if: always()
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -490,3 +539,48 @@ jobs:
with:
header: memory
message: ${{ steps.memory_report.outputs.markdown }}

upload_execution_report:
name: Upload execution report
needs: [generate_compilation_and_execution_report, external_repo_compilation_and_execution_report]
# We want this job to run even if one variation of the matrix in `external_repo_compilation_and_execution_report` fails
if: always()
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- uses: actions/checkout@v4

- name: Download initial execution report
uses: actions/download-artifact@v4
with:
name: in_progress_execution_report

- name: Download matrix execution reports
uses: actions/download-artifact@v4
with:
pattern: execution_report_*
path: ./reports

- name: Merge execution reports using jq
run: |
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
./merge-bench-reports.sh execution_report

- name: Parse execution report
id: execution_report
uses: noir-lang/noir-bench-report@0954121203ee55dcda5c7397b9c669c439a20922
with:
report: execution_report.json
header: |
# Execution Report
execution_report: true

- name: Add memory report to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: execution_time
message: ${{ steps.execution_report.outputs.markdown }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ gates_report.json
gates_report_brillig.json
gates_report_brillig_execution.json
compilation_report.json
execution_report.json

# Github Actions scratch space
# This gives a location to download artifacts into the repository in CI without making git dirty.
Expand Down
59 changes: 59 additions & 0 deletions test_programs/execution_report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
set -e

current_dir=$(pwd)
base_path="$current_dir/execution_success"

# Tests to be profiled for execution report
tests_to_profile=("sha256_regression" "regression_4709" "ram_blowup_regression")

echo "{\"execution_reports\": [ " > $current_dir/execution_report.json

# If there is an argument that means we want to generate a report for only the current directory
if [ "$#" -ne 0 ]; then
base_path="$current_dir"
tests_to_profile=(".")
fi

ITER="1"
NUM_ARTIFACTS=${#tests_to_profile[@]}

for dir in ${tests_to_profile[@]}; do
if [[ " ${excluded_dirs[@]} " =~ " ${dir} " ]]; then
continue
fi

if [[ ${CI-false} = "true" ]] && [[ " ${ci_excluded_dirs[@]} " =~ " ${dir} " ]]; then
continue
fi

cd $base_path/$dir

# The default package to run is the supplied list hardcoded at the top of the script
PACKAGE_NAME=$dir
# Otherwise default to the current directory as the package we want to run
if [ "$#" -ne 0 ]; then
PACKAGE_NAME=$(basename $current_dir)
fi

# Check whether a compilation artifact exists.
# Any programs part of this benchmark should already be compiled.
# We want to make sure that compilation time is not included in the execution time.
if [ ! -e ./target/*.json ]; then
echo "Missing compilation artifact for $PACKAGE_NAME"
exit 1
fi

COMPILE_TIME=$((time nargo execute --silence-warnings) 2>&1 | grep real | grep -oE '[0-9]+m[0-9]+.[0-9]+s')
echo -e " {\n \"artifact_name\":\"$PACKAGE_NAME\",\n \"time\":\"$COMPILE_TIME\"" >> $current_dir/execution_report.json

if (($ITER == $NUM_ARTIFACTS)); then
echo "}" >> $current_dir/execution_report.json
else
echo "}, " >> $current_dir/execution_report.json
fi

ITER=$(( $ITER + 1 ))
done

echo "]}" >> $current_dir/execution_report.json
Loading