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

[DNM] Trace Dump Feature #1077

Draft
wants to merge 50 commits into
base: main
Choose a base branch
from
Draft

[DNM] Trace Dump Feature #1077

wants to merge 50 commits into from

Conversation

JulianGCalderon
Copy link
Contributor

@JulianGCalderon JulianGCalderon commented Jan 30, 2025

This PR is related to #775
It updates it with recent changes but is also not mergeable until more cleanup is done

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.

azteca1998 and others added 29 commits August 28, 2024 22:44
* Impl ClassHash and SegmentArena

* Add trace dump support to compiler

* Reset workflows

* Update lock

* Implement BoundedInt

* Fix Enum trace dump

* Make gas_metadata public

* Update deps

* Fix bug

* Move deps to optional (trace dump featire)
* Add logs

* Implement Felt252Dict trace dump

* Implement nullabel for trace dump

* Print type id

* Remove print

* add convertion for Sints

* fix mispelled types

* forgot to add feature

* change Sints value to correspond to sierra-emu

* Readd feature

* Add is_infinity field to secp256 point struct (#828)

* add is_infinity to secp point

* clean

* fix

* use same deps as blockifier

* fix

* fix layout

* fix test

* remove some brittle asserts due to random initial data when adding and muling points at infinity

* fix

* remove unused dep

* fixes, missed the value entry/output

* Reset src

* Fix warnings

* Make library public

* Use debug runtime for trace dump

* fix storage's values truncations (#839)

* fix storage's values truncations

* change implementation for i8 i16 i32 i64 too

* format

* Add ptr check to felt dict entry

* Add malloc tracing and fix more memory leaks. (#833)

* Add memory tracing.

* Partial memory fixes.

* Fix arrays.

* Simplify dictionaries. Fix false positive memory leak in dictionary drops.

* Fix zero-sized allocation. Fix warnings. More mem tracing checks.

* Fix mem tracing.

* Fix memory leak in `print` libfunc.

* Fix array slice libfunc.

* Fix starknet memory leaks.

* Fix keccak syscall.

* Fix dict get double free bug.

* Lots of memory fixes.

* More fixes.

* Fix CI.

* Remove old TODOs.

* Fix CI (again).

* Remove TODOs.

* Fix test.

* Maybe fix

* Maybe fix

* Maybe fix

* Dont panic when building circuit partial outputs

* trace dump for Sha256StateHandler

* Builtin costs rework (#837)

* Update to 2.8.4, release docs, alpha

This PR updates cairo to 2.8.4, adds some release docs and updates the
version to alpha.3 to prepare for another release.

* try fix

* cleanup ci, remove panic in link

* rename from jit to from ptr, etc

* crates.io badge

* progress

* progress

* fmt2

* progress

* progress

* fix

* fix bench

* use struct

* Fix felt252 and enum deserialization bugs. (#844)

* Fix felt252 and enum deserialization bugs.

* Fix formatting.

* Also fix the runtime.

* Fix errors.

* try to fix ci

* remove unused deps

---------

Co-authored-by: Edgar Luque <git@edgarluque.com>

* Fix trace dump type conv

* fix aot contract executor not passing builtinstats (#849)

* Fix felt252 and enum deserialization bugs.

* Fix formatting.

* Also fix the runtime.

* Fix errors.

* try to fix ci

* remove unused deps

* fix aot contract executor not passing builtinstats

---------

Co-authored-by: Esteve Soler Arderiu <esteve.soler@lambdaclass.com>
Co-authored-by: Esteve Soler Arderiu <soler.arderiu@gmail.com>

* Fix bug (#851)

* Also fix felt bits in starknet syscall wrappers (#853)

* Also fix felt bits in starknet syscall wrappers

* style

* missed

* fix aot contract executor not passing builtinstats (#849)

* Fix felt252 and enum deserialization bugs.

* Fix formatting.

* Also fix the runtime.

* Fix errors.

* try to fix ci

* remove unused deps

* fix aot contract executor not passing builtinstats

---------

Co-authored-by: Esteve Soler Arderiu <esteve.soler@lambdaclass.com>
Co-authored-by: Esteve Soler Arderiu <soler.arderiu@gmail.com>

* Fix bug (#851)

* Also fix felt bits in starknet syscall wrappers (#853)

* Also fix felt bits in starknet syscall wrappers

* style

* missed

* update version to alpha 4 (#854)

* bytes31

* Better function attributes and re-enable >O1 opt (#843)

* Fix felt252 and enum deserialization bugs.

* Fix formatting.

* Also fix the runtime.

* Fix errors.

* try to fix ci

* remove unused deps

* proper function attributes

* add proper function attrs to optimize better, add some passes, run tests with atleast some opts

* dont use remi

* oops

* maybe with opt level 3 now it works

* test

* works

* readd deleted bench

* remove dbg

* Update bench-hyperfine.sh

* fixci

* comment

* Update src/ffi.rs

Co-authored-by: MrAzteca <azteca1998@users.noreply.github.com>

---------

Co-authored-by: Esteve Soler Arderiu <esteve.soler@lambdaclass.com>
Co-authored-by: Esteve Soler Arderiu <soler.arderiu@gmail.com>
Co-authored-by: MrAzteca <azteca1998@users.noreply.github.com>

* Resolve `CAIRO_NATIVE_RUNTIME_LIBRARY` relative path (#841)

* feat(ffi): resolve runtime relative path using current dir

* chore: remove mentions to old runtime variable

* fix: typo

---------

Co-authored-by: Bohdan Ohorodnii <limposfeed@gmail.com>

* Implement secp

* Fix bytes31

* try to fix ci (#858)

* update implementing libfuncs doc (#856)

* Fix bytes31 bug

* Remove unused dep

---------

Co-authored-by: FrancoGiachetta <francogiachetta27@gmail.com>
Co-authored-by: Edgar <git@edgarluque.com>
Co-authored-by: MrAzteca <azteca1998@users.noreply.github.com>
Co-authored-by: Esteve Soler Arderiu <esteve.soler@lambdaclass.com>
Co-authored-by: Esteve Soler Arderiu <soler.arderiu@gmail.com>
Co-authored-by: Rodrigo <rodrodpino@gmail.com>
Co-authored-by: Bohdan Ohorodnii <limposfeed@gmail.com>
Copy link

github-actions bot commented Jan 30, 2025

✅ Code is now correctly formatted.

@igaray igaray changed the title Update trace dump feature [DNM] Update trace dump feature Feb 6, 2025
@JulianGCalderon JulianGCalderon changed the base branch from add-trace-dump-contracts to main February 19, 2025 19:48
@JulianGCalderon JulianGCalderon changed the title [DNM] Update trace dump feature [DNM] Trace Dump Feature Feb 19, 2025
@JulianGCalderon JulianGCalderon force-pushed the trace-dump-feature branch 2 times, most recently from a47431c to 77c6815 Compare February 19, 2025 20:08
Copy link

github-actions bot commented Feb 19, 2025

Benchmark results Main vs HEAD.

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_insert.cairo (JIT) 3.858 ± 0.026 3.818 3.897 1.02 ± 0.01
base dict_insert.cairo (AOT) 3.782 ± 0.021 3.755 3.821 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_insert.cairo (JIT) 3.818 ± 0.019 3.786 3.860 1.02 ± 0.01
head dict_insert.cairo (AOT) 3.751 ± 0.015 3.713 3.765 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_snapshot.cairo (JIT) 3.745 ± 0.008 3.734 3.755 1.03 ± 0.01
base dict_snapshot.cairo (AOT) 3.642 ± 0.018 3.609 3.676 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_snapshot.cairo (JIT) 3.736 ± 0.053 3.699 3.872 1.03 ± 0.02
head dict_snapshot.cairo (AOT) 3.625 ± 0.040 3.572 3.686 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 4.144 ± 0.038 4.079 4.195 1.02 ± 0.01
base factorial_2M.cairo (AOT) 4.074 ± 0.022 4.046 4.114 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 4.053 ± 0.022 4.022 4.093 1.01 ± 0.01
head factorial_2M.cairo (AOT) 4.015 ± 0.042 3.949 4.102 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 3.641 ± 0.066 3.589 3.821 1.01 ± 0.02
base fib_2M.cairo (AOT) 3.616 ± 0.026 3.593 3.674 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 3.593 ± 0.009 3.579 3.605 1.01 ± 0.01
head fib_2M.cairo (AOT) 3.563 ± 0.017 3.542 3.603 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 3.824 ± 0.024 3.796 3.866 1.04 ± 0.01
base linear_search.cairo (AOT) 3.692 ± 0.024 3.661 3.734 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head linear_search.cairo (JIT) 3.844 ± 0.031 3.777 3.873 1.04 ± 0.01
head linear_search.cairo (AOT) 3.680 ± 0.022 3.647 3.705 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 3.929 ± 0.041 3.894 4.025 1.05 ± 0.01
base logistic_map.cairo (AOT) 3.757 ± 0.020 3.729 3.799 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 3.891 ± 0.024 3.862 3.926 1.04 ± 0.01
head logistic_map.cairo (AOT) 3.742 ± 0.035 3.697 3.820 1.00

@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 8 lines in your changes missing coverage. Please review.

Project coverage is 81.01%. Comparing base (b90af8c) to head (eefec2f).

Files with missing lines Patch % Lines
src/compiler.rs 79.48% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1077      +/-   ##
==========================================
- Coverage   81.03%   81.01%   -0.02%     
==========================================
  Files         110      110              
  Lines       30204    30241      +37     
==========================================
+ Hits        24477    24501      +24     
- Misses       5727     5740      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Feb 19, 2025

Benchmarking results

Benchmark for program dict_insert

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 20.745 ± 0.245 20.365 21.038 5.16 ± 0.14
cairo-native (embedded AOT) 4.017 ± 0.097 3.899 4.174 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 4.063 ± 0.050 3.989 4.172 1.01 ± 0.03

Benchmark for program dict_snapshot

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 6.866 ± 0.219 6.621 7.251 1.66 ± 0.06
cairo-native (embedded AOT) 4.172 ± 0.161 3.948 4.376 1.01 ± 0.04
cairo-native (embedded JIT using LLVM's ORC Engine) 4.132 ± 0.092 3.999 4.262 1.00

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 14.732 ± 0.201 14.388 14.950 3.32 ± 0.13
cairo-native (embedded AOT) 4.436 ± 0.157 4.198 4.645 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 4.696 ± 0.348 4.221 5.183 1.06 ± 0.09

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 15.769 ± 0.305 15.228 16.204 3.75 ± 0.09
cairo-native (embedded AOT) 4.288 ± 0.085 4.173 4.436 1.02 ± 0.03
cairo-native (embedded JIT using LLVM's ORC Engine) 4.204 ± 0.062 4.107 4.334 1.00

Benchmark for program linear_search

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 6.936 ± 0.232 6.578 7.252 1.61 ± 0.07
cairo-native (embedded AOT) 4.310 ± 0.108 4.143 4.533 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 4.376 ± 0.217 4.066 4.729 1.02 ± 0.06

Benchmark for program logistic_map

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 5.960 ± 0.088 5.845 6.145 1.46 ± 0.03
cairo-native (embedded AOT) 4.095 ± 0.084 4.011 4.312 1.00 ± 0.03
cairo-native (embedded JIT using LLVM's ORC Engine) 4.080 ± 0.058 3.982 4.169 1.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants