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: add memory report into the CI #6630

Merged
merged 29 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d037756
add memory report into the CI
guipublic Nov 26, 2024
6988f2d
Merge branch 'master' into gd/issue_6604
guipublic Nov 26, 2024
7411aac
fix typo in the new workflow
guipublic Nov 26, 2024
ab7ff5e
heaptrack output is not consistent
guipublic Nov 26, 2024
1550a91
update noir-diff version
guipublic Nov 26, 2024
9781412
rename step for memory report
guipublic Nov 26, 2024
4782415
update noir-diff rev
guipublic Nov 27, 2024
9dcd040
update noir-diff rev for debugging
guipublic Nov 27, 2024
d36955c
revert gate-diff change for previous report
guipublic Nov 27, 2024
bb24b06
for debugging
guipublic Nov 27, 2024
412b55a
debug..
guipublic Nov 27, 2024
5e2e593
Merge branch 'master' into gd/issue_6604
guipublic Nov 27, 2024
b7cfc2e
debugging
guipublic Nov 27, 2024
a50d21a
debug..
guipublic Nov 27, 2024
a6b66fd
Merge branch 'master' into gd/issue_6604
guipublic Nov 28, 2024
4313b53
diff for memory report
guipublic Nov 28, 2024
4f364ac
Merge branch 'master' into gd/issue_6604
guipublic Nov 28, 2024
d6b4cf5
update noir-diff
guipublic Nov 28, 2024
9845044
update noir-diff for debugging
guipublic Nov 28, 2024
f4d635e
new noir-diff for debug
guipublic Nov 28, 2024
09228a9
update noir-diff
guipublic Nov 28, 2024
1d0727a
Merge branch 'master' into gd/issue_6604
guipublic Nov 28, 2024
04b1b82
switch to noir-bench-report repo
guipublic Nov 28, 2024
359fc94
Merge branch 'master' into gd/issue_6604
guipublic Nov 28, 2024
7c01930
Merge branch 'master' into gd/issue_6604
guipublic Nov 29, 2024
960c660
add heaptrack to the dictionary
guipublic Dec 2, 2024
ae2ed24
Merge branch 'master' into gd/issue_6604
guipublic Dec 2, 2024
7e4d0f7
Update .github/workflows/memory_report.yml
TomAFrench Dec 2, 2024
8b44696
Update .github/workflows/memory_report.yml
TomAFrench Dec 2, 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
88 changes: 88 additions & 0 deletions .github/workflows/memory_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Report Peak Memory

on:
push:
branches:
- master
pull_request:

jobs:
build-nargo:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-unknown-linux-gnu]

steps:
- name: Checkout Noir repo
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/[email protected]

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Build Nargo
run: cargo build --package nargo_cli --release

- name: Package artifacts
run: |
mkdir dist
cp ./target/release/nargo ./dist/nargo

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nargo
path: ./dist/*
retention-days: 3

generate_memory_report:
needs: [build-nargo]
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- uses: actions/checkout@v4

- name: Download nargo binary
uses: actions/download-artifact@v4
with:
name: nargo
path: ./nargo

- name: Set nargo on PATH
run: |
nargo_binary="${{ github.workspace }}/nargo/nargo"
chmod +x $nargo_binary
echo "$(dirname $nargo_binary)" >> $GITHUB_PATH
export PATH="$PATH:$(dirname $nargo_binary)"
nargo -V

- name: Generate Memory report
working-directory: ./test_programs
run: |
chmod +x memory_report.sh
./memory_report.sh
mv memory_report.json ../memory_report.json

- name: Parse memory report
id: memory_report
uses: noir-lang/noir-bench-report@d61bc78ece3c8df1e72914b3d5136bad403d5bdf
with:
report: memory_report.json
header: |
# Memory Report
memory_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: memory
message: ${{ steps.memory_report.outputs.markdown }}
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"Guillaume",
"gzipped",
"hasher",
"heaptrack",
"hexdigit",
"higher-kinded",
"Hindley-Milner",
Expand Down
48 changes: 48 additions & 0 deletions test_programs/memory_report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -e

sudo apt-get install heaptrack

NARGO="nargo"


# Tests to be profiled for memory report
tests_to_profile=("keccak256" "workspace" "regression_4709")

current_dir=$(pwd)
execution_success_path="$current_dir/execution_success"
test_dirs=$(ls $execution_success_path)

FIRST="1"

echo "{\"memory_reports\": [ " > memory_report.json


for test_name in ${tests_to_profile[@]}; do
full_path=$execution_success_path"/"$test_name
cd $full_path

if [ $FIRST = "1" ]
then
FIRST="0"
else
echo " ," >> $current_dir"/memory_report.json"
fi
heaptrack --output $current_dir/$test_name"_heap" $NARGO compile --force
if test -f $current_dir/$test_name"_heap.gz";
then
heaptrack --analyze $current_dir/$test_name"_heap.gz" > $current_dir/$test_name"_heap_analysis.txt"
rm $current_dir/$test_name"_heap.gz"
else
heaptrack --analyze $current_dir/$test_name"_heap.zst" > $current_dir/$test_name"_heap_analysis.txt"
rm $current_dir/$test_name"_heap.zst"
fi
consumption="$(grep 'peak heap memory consumption' $current_dir/$test_name'_heap_analysis.txt')"
len=${#consumption}-30
peak=${consumption:30:len}
rm $current_dir/$test_name"_heap_analysis.txt"
echo -e " {\n \"artifact_name\":\"$test_name\",\n \"peak_memory\":\"$peak\"\n }" >> $current_dir"/memory_report.json"
done

echo "]}" >> $current_dir"/memory_report.json"

Loading