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

Enable segment arena #1723

Closed
wants to merge 14 commits into from
Closed

Enable segment arena #1723

wants to merge 14 commits into from

Conversation

juanbono
Copy link
Collaborator

Enable segment arena

Description

This PR adds a new RunnerMode to reflect Cairo1 execution.
It also adds the segment arena when the CairoRunner's runnerMode is proof mode (either Cairo0 or Cairo1)

Checklist

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

Copy link

github-actions bot commented Apr 17, 2024

**Hyper Thereading Benchmark results**




hyperfine -r 2 -n "hyper_threading_main threads: 1" 'RAYON_NUM_THREADS=1 ./hyper_threading_main' -n "hyper_threading_pr threads: 1" 'RAYON_NUM_THREADS=1 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 1
  Time (mean ± σ):     23.698 s ±  0.029 s    [User: 23.003 s, System: 0.693 s]
  Range (min … max):   23.678 s … 23.719 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     23.761 s ±  0.064 s    [User: 23.101 s, System: 0.659 s]
  Range (min … max):   23.716 s … 23.806 s    2 runs
 
Summary
  'hyper_threading_main threads: 1' ran
    1.00 ± 0.00 times faster than 'hyper_threading_pr threads: 1'




hyperfine -r 2 -n "hyper_threading_main threads: 2" 'RAYON_NUM_THREADS=2 ./hyper_threading_main' -n "hyper_threading_pr threads: 2" 'RAYON_NUM_THREADS=2 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 2
  Time (mean ± σ):     12.391 s ±  0.040 s    [User: 23.235 s, System: 0.660 s]
  Range (min … max):   12.363 s … 12.419 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     12.392 s ±  0.008 s    [User: 23.234 s, System: 0.682 s]
  Range (min … max):   12.386 s … 12.398 s    2 runs
 
Summary
  'hyper_threading_main threads: 2' ran
    1.00 ± 0.00 times faster than 'hyper_threading_pr threads: 2'




hyperfine -r 2 -n "hyper_threading_main threads: 4" 'RAYON_NUM_THREADS=4 ./hyper_threading_main' -n "hyper_threading_pr threads: 4" 'RAYON_NUM_THREADS=4 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 4
  Time (mean ± σ):      9.926 s ±  0.322 s    [User: 34.543 s, System: 0.913 s]
  Range (min … max):    9.698 s … 10.153 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):      9.714 s ±  0.162 s    [User: 34.889 s, System: 0.951 s]
  Range (min … max):    9.599 s …  9.828 s    2 runs
 
Summary
  'hyper_threading_pr threads: 4' ran
    1.02 ± 0.04 times faster than 'hyper_threading_main threads: 4'




hyperfine -r 2 -n "hyper_threading_main threads: 6" 'RAYON_NUM_THREADS=6 ./hyper_threading_main' -n "hyper_threading_pr threads: 6" 'RAYON_NUM_THREADS=6 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 6
  Time (mean ± σ):      9.584 s ±  0.325 s    [User: 34.780 s, System: 0.941 s]
  Range (min … max):    9.355 s …  9.814 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):      9.757 s ±  0.025 s    [User: 35.125 s, System: 0.992 s]
  Range (min … max):    9.739 s …  9.775 s    2 runs
 
Summary
  'hyper_threading_main threads: 6' ran
    1.02 ± 0.03 times faster than 'hyper_threading_pr threads: 6'




hyperfine -r 2 -n "hyper_threading_main threads: 8" 'RAYON_NUM_THREADS=8 ./hyper_threading_main' -n "hyper_threading_pr threads: 8" 'RAYON_NUM_THREADS=8 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 8
  Time (mean ± σ):      9.524 s ±  0.105 s    [User: 35.047 s, System: 0.971 s]
  Range (min … max):    9.449 s …  9.598 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):      9.506 s ±  0.171 s    [User: 35.602 s, System: 0.982 s]
  Range (min … max):    9.386 s …  9.627 s    2 runs
 
Summary
  'hyper_threading_pr threads: 8' ran
    1.00 ± 0.02 times faster than 'hyper_threading_main threads: 8'




hyperfine -r 2 -n "hyper_threading_main threads: 16" 'RAYON_NUM_THREADS=16 ./hyper_threading_main' -n "hyper_threading_pr threads: 16" 'RAYON_NUM_THREADS=16 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 16
  Time (mean ± σ):      9.300 s ±  0.016 s    [User: 35.382 s, System: 1.018 s]
  Range (min … max):    9.289 s …  9.311 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):      9.649 s ±  0.128 s    [User: 35.793 s, System: 0.943 s]
  Range (min … max):    9.558 s …  9.740 s    2 runs
 
Summary
  'hyper_threading_main threads: 16' ran
    1.04 ± 0.01 times faster than 'hyper_threading_pr threads: 16'


Copy link

github-actions bot commented Apr 17, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 1.963 ± 0.033 1.936 2.042 1.00 ± 0.02
head big_factorial 1.960 ± 0.020 1.937 2.000 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 1.878 ± 0.011 1.867 1.907 1.00 ± 0.01
head big_fibonacci 1.877 ± 0.007 1.868 1.890 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 6.592 ± 0.078 6.500 6.746 1.00
head blake2s_integration_benchmark 6.612 ± 0.037 6.564 6.689 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 1.959 ± 0.013 1.943 1.981 1.00
head compare_arrays_200000 1.960 ± 0.013 1.938 1.976 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.338 ± 0.008 1.331 1.353 1.01 ± 0.01
head dict_integration_benchmark 1.327 ± 0.008 1.313 1.338 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.180 ± 0.010 1.170 1.202 1.00
head field_arithmetic_get_square_benchmark 1.185 ± 0.017 1.170 1.230 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 6.625 ± 0.069 6.542 6.722 1.00
head integration_builtins 6.638 ± 0.041 6.569 6.704 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 6.899 ± 0.129 6.768 7.227 1.00 ± 0.02
head keccak_integration_benchmark 6.876 ± 0.106 6.795 7.171 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 1.971 ± 0.015 1.945 1.992 1.00
head linear_search 1.982 ± 0.024 1.956 2.034 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.705 ± 0.031 1.685 1.790 1.00 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.697 ± 0.006 1.689 1.706 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.469 ± 0.010 1.449 1.488 1.00
head math_integration_benchmark 1.479 ± 0.028 1.455 1.552 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.150 ± 0.019 1.132 1.201 1.00
head memory_integration_benchmark 1.156 ± 0.015 1.138 1.194 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.791 ± 0.031 1.769 1.878 1.01 ± 0.02
head operations_with_data_structures_benchmarks 1.772 ± 0.014 1.758 1.807 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 512.5 ± 8.5 505.7 533.4 1.00 ± 0.02
head pedersen 510.1 ± 2.6 505.5 514.0 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 967.9 ± 33.3 949.1 1061.2 1.01 ± 0.04
head poseidon_integration_benchmark 959.7 ± 22.9 943.7 1019.2 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.746 ± 0.017 1.726 1.778 1.00 ± 0.01
head secp_integration_benchmark 1.743 ± 0.015 1.729 1.777 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 690.7 ± 3.3 686.4 696.5 1.00
head set_integration_benchmark 714.5 ± 6.1 708.8 730.9 1.03 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 3.950 ± 0.161 3.829 4.249 1.03 ± 0.04
head uint256_integration_benchmark 3.842 ± 0.023 3.806 3.871 1.00

Copy link

codecov bot commented Apr 17, 2024

Codecov Report

Attention: Patch coverage is 97.05882% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 94.91%. Comparing base (4b17118) to head (6b5290c).

Files Patch % Lines
cairo1-run/src/cairo_run.rs 87.50% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1723   +/-   ##
=======================================
  Coverage   94.91%   94.91%           
=======================================
  Files          98       98           
  Lines       38170    38167    -3     
=======================================
- Hits        36228    36226    -2     
+ Misses       1942     1941    -1     

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

@juanbono juanbono marked this pull request as ready for review April 17, 2024 21:22
@juanbono juanbono closed this Apr 19, 2024
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.

1 participant