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

Implement libfunc profiler. #946

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Implement libfunc profiler. #946

wants to merge 3 commits into from

Conversation

azteca1998
Copy link
Collaborator

@azteca1998 azteca1998 commented Nov 27, 2024

Implementation of a libfunc profiler.

For each executed libfunc, generates:

  • Number of samples.
  • Total number of ticks.
  • Average number of ticks.
  • Standard deviation.
  • Quartiles (0%, 25%, 50%, 75%, 100%).

Also implements an outlier detection system to filter out operating system noise.

Note: The x86_64 architecture handles context switches between cores correctly, but in aarch64 this is impossible. Results may not be reliable in aarch64.

Checklist

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

Copy link

github-actions bot commented Nov 27, 2024

Benchmarking results

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 11.297 ± 0.430 10.712 11.867 8.38 ± 0.32
cairo-native (embedded AOT) 3.352 ± 0.046 3.320 3.462 2.49 ± 0.03
cairo-native (embedded JIT using LLVM's ORC Engine) 3.257 ± 0.072 3.183 3.366 2.42 ± 0.05
cairo-native (standalone AOT with -march=native) 1.348 ± 0.001 1.346 1.350 1.00

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 10.947 ± 0.357 10.617 11.530 141.04 ± 4.62
cairo-native (embedded AOT) 2.887 ± 0.014 2.856 2.905 37.20 ± 0.19
cairo-native (embedded JIT using LLVM's ORC Engine) 2.683 ± 0.016 2.655 2.703 34.57 ± 0.22
cairo-native (standalone AOT with -march=native) 0.078 ± 0.000 0.077 0.078 1.00

Benchmark for program logistic_map

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.269 ± 0.030 4.223 4.319 17.61 ± 0.13
cairo-native (embedded AOT) 3.145 ± 0.026 3.085 3.178 12.97 ± 0.11
cairo-native (embedded JIT using LLVM's ORC Engine) 3.063 ± 0.033 3.009 3.119 12.63 ± 0.14
cairo-native (standalone AOT with -march=native) 0.242 ± 0.000 0.242 0.243 1.00

Copy link

github-actions bot commented Nov 27, 2024

Benchmark results Main vs HEAD.

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 3.262 ± 0.021 3.228 3.296 1.00
base factorial_2M.cairo (AOT) 3.414 ± 0.021 3.395 3.461 1.05 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
:--- ---: ---: ---: ---:
head factorial_2M.cairo (JIT) 3.282 ± 0.092 3.221 3.539 1.00
head factorial_2M.cairo (AOT) 3.434 ± 0.031 3.376 3.482 1.05 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 2.823 ± 0.043 2.766 2.919 1.00
base fib_2M.cairo (AOT) 3.020 ± 0.016 2.997 3.047 1.07 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
:--- ---: ---: ---: ---:
head fib_2M.cairo (JIT) 2.776 ± 0.021 2.751 2.806 1.00
head fib_2M.cairo (AOT) 2.973 ± 0.028 2.942 3.016 1.07 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 3.147 ± 0.027 3.100 3.175 1.00
base logistic_map.cairo (AOT) 3.212 ± 0.020 3.176 3.248 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
:--- ---: ---: ---: ---:
head logistic_map.cairo (JIT) 3.061 ± 0.028 3.036 3.123 1.00
head logistic_map.cairo (AOT) 3.138 ± 0.018 3.096 3.162 1.03 ± 0.01

@codecov-commenter
Copy link

codecov-commenter commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 87.29167% with 61 lines in your changes missing coverage. Please review.

Project coverage is 82.56%. Comparing base (2bad480) to head (e9d5922).

Files with missing lines Patch % Lines
src/libfuncs/starknet.rs 23.80% 32 Missing ⚠️
src/libfuncs/bounded_int.rs 11.11% 8 Missing ⚠️
src/libfuncs/cast.rs 72.72% 3 Missing ⚠️
src/libfuncs/int_range.rs 50.00% 3 Missing ⚠️
src/libfuncs/coupon.rs 0.00% 2 Missing ⚠️
src/libfuncs/enum.rs 66.66% 2 Missing ⚠️
src/libfuncs/bytes31.rs 75.00% 1 Missing ⚠️
src/libfuncs/sint128.rs 94.11% 1 Missing ⚠️
src/libfuncs/sint16.rs 94.44% 1 Missing ⚠️
src/libfuncs/sint32.rs 94.44% 1 Missing ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #946      +/-   ##
==========================================
+ Coverage   82.54%   82.56%   +0.01%     
==========================================
  Files         117      117              
  Lines       33516    33299     -217     
==========================================
- Hits        27666    27493     -173     
+ Misses       5850     5806      -44     

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

@azteca1998 azteca1998 marked this pull request as ready for review December 5, 2024 14:25
@JulianGCalderon JulianGCalderon added the review-ready A PR that is ready for review label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-ready A PR that is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants