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

add workflow to measure execute time #789

Merged
merged 108 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
81fb143
add workflow for linux
FrancoGiachetta Sep 11, 2024
3be2d93
add hyperfine and comments
FrancoGiachetta Sep 11, 2024
bf136ad
add runs
FrancoGiachetta Sep 11, 2024
c68f42c
fix run
FrancoGiachetta Sep 11, 2024
e0c167c
fix run
FrancoGiachetta Sep 11, 2024
f90e24b
fix run
FrancoGiachetta Sep 11, 2024
f6660cc
fix run
FrancoGiachetta Sep 11, 2024
aceba2a
fix command
FrancoGiachetta Sep 11, 2024
3301cb2
show errors
FrancoGiachetta Sep 11, 2024
b4761e8
change how handles project building
FrancoGiachetta Sep 12, 2024
936a5ae
typo in command
FrancoGiachetta Sep 12, 2024
ec95178
forgot issue-comment-id in update comment
FrancoGiachetta Sep 12, 2024
363ef5f
better result printing
FrancoGiachetta Sep 12, 2024
b365f82
change approach
FrancoGiachetta Sep 12, 2024
1f69517
versions fix
FrancoGiachetta Sep 12, 2024
00a5fa9
build binaries correctly
FrancoGiachetta Sep 12, 2024
3a05190
require binaries to run benches
FrancoGiachetta Sep 12, 2024
41d8f85
typo
FrancoGiachetta Sep 12, 2024
d09f0ea
remove unwanted programs
FrancoGiachetta Sep 12, 2024
035aa08
fix run command
FrancoGiachetta Sep 12, 2024
263fdb4
checkout base before running
FrancoGiachetta Sep 12, 2024
5eb403e
checkout base before running
FrancoGiachetta Sep 12, 2024
f6bfffd
fix run hyperfine command
FrancoGiachetta Sep 12, 2024
951bcc7
fix run hyperfine command
FrancoGiachetta Sep 12, 2024
583fa74
typos
FrancoGiachetta Sep 12, 2024
086e1e3
fix OUTPUT_DIR env var
FrancoGiachetta Sep 12, 2024
b1c1d21
fix ROOT_DIR var
FrancoGiachetta Sep 13, 2024
4f08871
forgot to make the output's dir
FrancoGiachetta Sep 13, 2024
43d34f7
fix
FrancoGiachetta Sep 13, 2024
7912c41
fix hyperfine command
FrancoGiachetta Sep 13, 2024
bda5b3a
fix
FrancoGiachetta Sep 13, 2024
7bf0db8
change ouput's dir
FrancoGiachetta Sep 13, 2024
684a13c
change ouput's dir
FrancoGiachetta Sep 13, 2024
6f7b4b1
fix
FrancoGiachetta Sep 13, 2024
3909b03
check with one branch
FrancoGiachetta Sep 13, 2024
6894d67
check with other branch
FrancoGiachetta Sep 13, 2024
687a57b
remove checkout
FrancoGiachetta Sep 13, 2024
2bfb1a6
use checkout before running bench
FrancoGiachetta Sep 13, 2024
0b1cf75
use onw branh
FrancoGiachetta Sep 13, 2024
b802f43
create cache againt
FrancoGiachetta Sep 13, 2024
a859436
clean unwanted dir
FrancoGiachetta Sep 13, 2024
19ff237
check errors
FrancoGiachetta Sep 13, 2024
b79cb8e
change command
FrancoGiachetta Sep 13, 2024
d3f7841
Merge branch 'main' into workflow-native-vm
FrancoGiachetta Sep 13, 2024
bd6314b
remove unwanted dir
FrancoGiachetta Sep 13, 2024
5e979cf
cache program to run
FrancoGiachetta Sep 13, 2024
9a7cdea
fix caching
FrancoGiachetta Sep 13, 2024
92ee2c9
fix caching
FrancoGiachetta Sep 13, 2024
8429c15
forgot to add env var
FrancoGiachetta Sep 13, 2024
781705b
typo
FrancoGiachetta Sep 13, 2024
c141bc1
typo
FrancoGiachetta Sep 13, 2024
9ed0ac2
typo
FrancoGiachetta Sep 13, 2024
375b0a4
checkout first
FrancoGiachetta Sep 13, 2024
3a51dbd
revert
FrancoGiachetta Sep 13, 2024
f56707c
on pull_request all branches
FrancoGiachetta Sep 16, 2024
cd81630
change from base to head
FrancoGiachetta Sep 16, 2024
0d87980
show error
FrancoGiachetta Sep 16, 2024
d5f8621
make deps
FrancoGiachetta Sep 16, 2024
1e5e78c
run both branches
FrancoGiachetta Sep 16, 2024
062031d
run both branches
FrancoGiachetta Sep 16, 2024
01bed66
typo
FrancoGiachetta Sep 16, 2024
15890f9
make corrections
FrancoGiachetta Sep 16, 2024
d929846
remove unwanted dirs
FrancoGiachetta Sep 16, 2024
cd138ff
fix bench command
FrancoGiachetta Sep 17, 2024
7bded09
fix bench command
FrancoGiachetta Sep 17, 2024
15bda8f
add warmup
FrancoGiachetta Sep 17, 2024
378b582
add warmup
FrancoGiachetta Sep 17, 2024
153d447
change hyperfine command
FrancoGiachetta Sep 17, 2024
da670c5
showoutput
FrancoGiachetta Sep 17, 2024
84be3d3
add runtime library
FrancoGiachetta Sep 17, 2024
e601788
cache hits
FrancoGiachetta Sep 17, 2024
a00a73c
fix typo
FrancoGiachetta Sep 17, 2024
b8f82ae
fix typo
FrancoGiachetta Sep 17, 2024
ceb5c05
remove conditional temporarily
FrancoGiachetta Sep 17, 2024
b511c0f
typos
FrancoGiachetta Sep 17, 2024
b7bef71
debug
FrancoGiachetta Sep 17, 2024
02284a8
debug
FrancoGiachetta Sep 17, 2024
3d042d7
debug
FrancoGiachetta Sep 17, 2024
f9e0f00
debug
FrancoGiachetta Sep 17, 2024
f1a0d61
Merge branch 'main' into workflow-native-vm
FrancoGiachetta Sep 17, 2024
1ce1b59
typo
FrancoGiachetta Sep 17, 2024
8dd6db8
enable shell
FrancoGiachetta Sep 17, 2024
e8591e8
debug
FrancoGiachetta Sep 17, 2024
816fee6
debug
FrancoGiachetta Sep 17, 2024
c2c193c
debug
FrancoGiachetta Sep 17, 2024
4abd7f1
debug
FrancoGiachetta Sep 17, 2024
44d43af
typo
FrancoGiachetta Sep 17, 2024
c63871e
typo
FrancoGiachetta Sep 17, 2024
b175baf
typo
FrancoGiachetta Sep 17, 2024
2cbbff1
change cache files name
FrancoGiachetta Sep 18, 2024
de753ba
cache everything again
FrancoGiachetta Sep 18, 2024
95ab9c8
cache everything again
FrancoGiachetta Sep 18, 2024
d530bb7
debug
FrancoGiachetta Sep 18, 2024
6589170
debug
FrancoGiachetta Sep 18, 2024
b810fba
debug
FrancoGiachetta Sep 18, 2024
20034c6
debug
FrancoGiachetta Sep 18, 2024
8e43d4a
debug
FrancoGiachetta Sep 18, 2024
5ffc645
debug
FrancoGiachetta Sep 18, 2024
19b9e1b
add head variant
FrancoGiachetta Sep 18, 2024
c2eab1f
add head variant
FrancoGiachetta Sep 18, 2024
ca24a76
add head variant
FrancoGiachetta Sep 18, 2024
f5937e2
add more programs
FrancoGiachetta Sep 18, 2024
2168869
add more programs
FrancoGiachetta Sep 18, 2024
f3cbd86
add more programs
FrancoGiachetta Sep 18, 2024
68ff578
typo
FrancoGiachetta Sep 18, 2024
e732369
better title
FrancoGiachetta Sep 18, 2024
cc3cec3
better title
FrancoGiachetta Sep 18, 2024
7d00911
Merge branch 'main' into workflow-native-vm
FrancoGiachetta Sep 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
166 changes: 166 additions & 0 deletions .github/workflows/bench-hyperfine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,169 @@ jobs:
issue-number: ${{ github.event.pull_request.number }}
body-path: bench-hyperfine.md
edit-mode: replace

build-binaries:
env:
MLIR_SYS_180_PREFIX: /usr/lib/llvm-18/
LLVM_SYS_181_PREFIX: /usr/lib/llvm-18/
TABLEGEN_180_PREFIX: /usr/lib/llvm-18/
RUST_LOG: cairo_native=debug,cairo_native_test=debug
strategy:
matrix:
branch: [ base, head ]
name: Build cairo-native-run for ${{ matrix.branch }}
runs-on: ubuntu-latest
steps:
- name: Cache binary
uses: actions/cache@v3
id: cache-binary
with:
path: bin/cairo-native-run-${{ matrix.branch }}
key: binary-${{ github.event.pull_request[matrix.branch].sha }}

- name: Cache runtime-library
uses: actions/cache@v3
id: cache-library
with:
path: lib/libcairo-native-runtime-${{ matrix.branch }}.a
key: library-${{ github.event.pull_request[matrix.branch].sha }}

- name: check and free hdd space left
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' }}
run: |
echo "Listing 20 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20
df -h
sudo apt-get update
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^temurin-.*'
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
df -h

- name: Install Rust
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
uses: dtolnay/[email protected]

- name: add llvm deb repository
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
uses: myci-actions/add-deb-repo@11
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key

- name: Install LLVM
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
run: sudo apt-get update && sudo apt-get install llvm-18 llvm-18-dev llvm-18-runtime clang-18 clang-tools-18 lld-18 libpolly-18-dev libmlir-18-dev mlir-18-tools

- name: Checkout base commit
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request[matrix.branch].sha }}

- name: Fetch Rust cache
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
uses: Swatinem/rust-cache@v2

- name: Build binary
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
run: |
make build
mkdir lib bin
cp target/release/cairo-native-run bin/cairo-native-run-${{ matrix.branch }}
cp target/release/libcairo_native_runtime.a lib/libcairo-native-runtime-${{ matrix.branch }}.a

hyperfine-prs:
name: Bench PR (linux, amd64)
needs: [ build-binaries ]
runs-on: ubuntu-latest
env:
PROGRAM: fib_2M
OUTPUT_DIR: bench-outputs
steps:
- uses: actions/checkout@v4

- name: Install Hyperfine
uses: taiki-e/install-action@v2
with:
tool: [email protected]

- name: Fetch base binary
uses: actions/cache/restore@v3
with:
path: bin/cairo-native-run-base
key: binary-${{ github.event.pull_request.base.sha }}

- name: Fetch HEAD binary
uses: actions/cache/restore@v3
with:
path: bin/cairo-native-run-head
key: binary-${{ github.event.pull_request.head.sha }}

- name: Fetch base runtime-library
uses: actions/cache/restore@v3
with:
path: lib/libcairo-native-runtime-base.a
key: library-${{ github.event.pull_request.base.sha }}

- name: Fetch head runtime-library
uses: actions/cache/restore@v3
with:
path: lib/libcairo-native-runtime-head.a
key: library-${{ github.event.pull_request.head.sha }}

- name: Build Dependencies
run: make deps

- name: Run Program
run: |
mkdir $OUTPUT_DIR
cp programs/benches/*.cairo $OUTPUT_DIR
for f in $OUTPUT_DIR/*.cairo; do
hyperfine \
--export-markdown "${f%.*}.md" \
--export-json "${f%.*}.json" \
--warmup 3 \
-n "head $(basename $f) (JIT)" "./bin/cairo-native-run-head --run-mode=jit -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "base $(basename $f) (JIT)" "./bin/cairo-native-run-base --run-mode=jit -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "head $(basename $f) (AOT)" "CAIRO_NATIVE_RUNTIME_LIBRARY=lib/libcairo-native-runtime-head.a ./bin/cairo-native-run-head --run-mode=aot -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "base $(basename $f) (AOT)" "CAIRO_NATIVE_RUNTIME_LIBRARY=lib/libcairo-native-runtime-base.a ./bin/cairo-native-run-base --run-mode=aot -s $f --opt-level 3 --available-gas 18446744073709551615" \
>> /dev/stderr
done
- name: Print tables
run: |
{
echo "Benchmark results Main vs HEAD"
for f in $OUTPUT_DIR/*.md; do
echo
cat $f
done
} | tee -a comment_body.md

- name: Find Bench Comment
continue-on-error: true
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: Benchmarking

- name: Create or update bench comment
continue-on-error: true
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body-path: comment_body.md
edit-mode: replace
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ cairo-*.tar

*.ipynb
cairo-native-stress-logs.jsonl

.DS_Store
Loading