Skip to content

Commit 8439eac

Browse files
vezenovmTomAFrench
andauthored
chore(ci): Memory reports for execution (#6907)
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
1 parent e7600a8 commit 8439eac

File tree

2 files changed

+113
-25
lines changed

2 files changed

+113
-25
lines changed

.github/workflows/reports.yml

Lines changed: 105 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,24 @@ jobs:
217217
./memory_report.sh
218218
mv memory_report.json ../memory_report.json
219219
220-
- name: Upload memory report
220+
- name: Upload compilation memory report
221221
uses: actions/upload-artifact@v4
222222
with:
223-
name: in_progress_memory_report
223+
name: in_progress_compilation_mem_report
224+
path: memory_report.json
225+
retention-days: 3
226+
overwrite: true
227+
228+
- name: Generate execution memory report
229+
working-directory: ./test_programs
230+
run: |
231+
./memory_report.sh 0 1
232+
mv memory_report.json ../memory_report.json
233+
234+
- name: Upload execution memory report
235+
uses: actions/upload-artifact@v4
236+
with:
237+
name: in_progress_execution_mem_report
224238
path: memory_report.json
225239
retention-days: 3
226240
overwrite: true
@@ -428,11 +442,11 @@ jobs:
428442
429443
- name: Parse compilation report
430444
id: compilation_report
431-
uses: noir-lang/noir-bench-report@e408e131e96c3615b4f820d7d642360fb4d6e2f4
445+
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
432446
with:
433447
report: compilation_report.json
434448
header: |
435-
# Compilation Report
449+
Compilation Report
436450
memory_report: false
437451

438452
- name: Add memory report to sticky comment
@@ -489,32 +503,55 @@ jobs:
489503
path: test-repo
490504
ref: ${{ matrix.project.ref }}
491505

492-
- name: Generate compilation report
506+
- name: Generate compilation memory report
493507
working-directory: ./test-repo/${{ matrix.project.path }}
494508
run: |
495509
mv /home/runner/work/noir/noir/scripts/test_programs/memory_report.sh ./memory_report.sh
496-
chmod +x ./memory_report.sh
497510
./memory_report.sh 1
511+
# Rename the memory report as the execution report is about to write to the same file
512+
cp memory_report.json compilation_memory_report.json
513+
514+
- name: Generate execution memory report
515+
working-directory: ./test-repo/${{ matrix.project.path }}
516+
run: |
517+
./memory_report.sh 1 1
498518
499519
- name: Move compilation report
500-
id: report
520+
id: compilation_mem_report
521+
shell: bash
522+
run: |
523+
PACKAGE_NAME=${{ matrix.project.path }}
524+
PACKAGE_NAME=$(basename $PACKAGE_NAME)
525+
mv ./test-repo/${{ matrix.project.path }}/compilation_memory_report.json ./memory_report_$PACKAGE_NAME.json
526+
echo "memory_report_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
527+
528+
- name: Upload compilation memory report
529+
uses: actions/upload-artifact@v4
530+
with:
531+
name: compilation_mem_report_${{ steps.compilation_mem_report.outputs.memory_report_name }}
532+
path: memory_report_${{ steps.compilation_mem_report.outputs.memory_report_name }}.json
533+
retention-days: 3
534+
overwrite: true
535+
536+
- name: Move execution report
537+
id: execution_mem_report
501538
shell: bash
502539
run: |
503540
PACKAGE_NAME=${{ matrix.project.path }}
504541
PACKAGE_NAME=$(basename $PACKAGE_NAME)
505542
mv ./test-repo/${{ matrix.project.path }}/memory_report.json ./memory_report_$PACKAGE_NAME.json
506543
echo "memory_report_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
507544
508-
- name: Upload memory report
545+
- name: Upload execution memory report
509546
uses: actions/upload-artifact@v4
510547
with:
511-
name: memory_report_${{ steps.report.outputs.memory_report_name }}
512-
path: memory_report_${{ steps.report.outputs.memory_report_name }}.json
548+
name: execution_mem_report_${{ steps.execution_mem_report.outputs.memory_report_name }}
549+
path: memory_report_${{ steps.execution_mem_report.outputs.memory_report_name }}.json
513550
retention-days: 3
514551
overwrite: true
515552

516-
upload_memory_report:
517-
name: Upload memory report
553+
upload_compilation_memory_report:
554+
name: Upload compilation memory report
518555
needs: [generate_memory_report, external_repo_memory_report]
519556
# We want this job to run even if one variation of the matrix in `external_repo_memory_report` fails
520557
if: always()
@@ -528,34 +565,80 @@ jobs:
528565
- name: Download initial memory report
529566
uses: actions/download-artifact@v4
530567
with:
531-
name: in_progress_memory_report
568+
name: in_progress_compilation_mem_report
532569

533570
- name: Download matrix memory reports
534571
uses: actions/download-artifact@v4
535572
with:
536-
pattern: memory_report_*
573+
pattern: compilation_mem_report_*
537574
path: ./reports
538575

539576
- name: Merge memory reports using jq
540577
run: |
541578
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
542579
./merge-bench-reports.sh memory_report
543580
544-
- name: Parse memory report
545-
id: memory_report
546-
uses: noir-lang/noir-bench-report@e408e131e96c3615b4f820d7d642360fb4d6e2f4
581+
- name: Parse compilation memory report
582+
id: compilation_mem_report
583+
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
547584
with:
548585
report: memory_report.json
549586
header: |
550-
# Memory Report
587+
Compilation Memory Report
551588
memory_report: true
552589

553590
- name: Add memory report to sticky comment
554591
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
555592
uses: marocchino/sticky-pull-request-comment@v2
556593
with:
557-
header: memory
558-
message: ${{ steps.memory_report.outputs.markdown }}
594+
header: compilation_memory
595+
message: ${{ steps.compilation_mem_report.outputs.markdown }}
596+
597+
upload_execution_memory_report:
598+
name: Upload execution memory report
599+
needs: [generate_memory_report, external_repo_memory_report]
600+
# We want this job to run even if one variation of the matrix in `external_repo_memory_report` fails
601+
if: always()
602+
runs-on: ubuntu-latest
603+
permissions:
604+
pull-requests: write
605+
606+
steps:
607+
- uses: actions/checkout@v4
608+
609+
- name: Download initial memory report
610+
uses: actions/download-artifact@v4
611+
with:
612+
name: in_progress_execution_mem_report
613+
614+
- name: Download matrix memory reports
615+
uses: actions/download-artifact@v4
616+
with:
617+
pattern: execution_mem_report_*
618+
path: ./reports
619+
620+
- name: Merge memory reports using jq
621+
run: |
622+
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
623+
./merge-bench-reports.sh memory_report
624+
# Rename the memory report as to not clash with the compilation memory report file name
625+
cp memory_report.json execution_memory_report.json
626+
627+
- name: Parse execution memory report
628+
id: execution_mem_report
629+
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
630+
with:
631+
report: execution_memory_report.json
632+
header: |
633+
Execution Memory Report
634+
memory_report: true
635+
636+
- name: Add execution memory report to sticky comment
637+
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
638+
uses: marocchino/sticky-pull-request-comment@v2
639+
with:
640+
header: execution_memory
641+
message: ${{ steps.execution_mem_report.outputs.markdown }}
559642

560643
upload_execution_report:
561644
name: Upload execution report
@@ -587,11 +670,11 @@ jobs:
587670
588671
- name: Parse execution report
589672
id: execution_report
590-
uses: noir-lang/noir-bench-report@e408e131e96c3615b4f820d7d642360fb4d6e2f4
673+
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
591674
with:
592675
report: execution_report.json
593676
header: |
594-
# Execution Report
677+
Execution Report
595678
execution_report: true
596679

597680
- name: Add memory report to sticky comment

test_programs/memory_report.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ current_dir=$(pwd)
1212
base_path="$current_dir/execution_success"
1313

1414
# If there is an argument that means we want to generate a report for only the current directory
15-
if [ "$#" -ne 0 ]; then
15+
if [ "$1" == "1" ]; then
1616
base_path="$current_dir"
1717
tests_to_profile=(".")
1818
fi
@@ -31,11 +31,16 @@ for test_name in ${tests_to_profile[@]}; do
3131
echo " ," >> $current_dir"/memory_report.json"
3232
fi
3333

34-
if [ "$#" -ne 0 ]; then
34+
if [ "$1" == "1" ]; then
3535
test_name=$(basename $current_dir)
3636
fi
3737

38-
heaptrack --output $current_dir/$test_name"_heap" $NARGO compile --force
38+
COMMAND="compile --force --silence-warnings"
39+
if [ "$2" == "1" ]; then
40+
COMMAND="execute --silence-warnings"
41+
fi
42+
43+
heaptrack --output $current_dir/$test_name"_heap" $NARGO $COMMAND
3944
if test -f $current_dir/$test_name"_heap.gz";
4045
then
4146
heaptrack --analyze $current_dir/$test_name"_heap.gz" > $current_dir/$test_name"_heap_analysis.txt"

0 commit comments

Comments
 (0)