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

Serialize inputs into output segment #1770

Merged
merged 62 commits into from
May 23, 2024
Merged

Conversation

fmoletta
Copy link
Member

@fmoletta fmoletta commented May 22, 2024

Depends on #1764

  • Checks that only Array<Felt252> can be received by the program main function when running with either --proof_mode or --append_return_values.
  • Copies the input value to the output segment right after the output in the format [array_len, arr[0], arr[1],.., arr[n]].

Copy link

github-actions bot commented May 22, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 1.993 ± 0.011 1.979 2.012 1.00
head big_factorial 2.006 ± 0.026 1.981 2.062 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 1.967 ± 0.031 1.943 2.039 1.00
head big_fibonacci 1.992 ± 0.032 1.944 2.035 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.568 ± 0.365 7.325 8.553 1.00 ± 0.05
head blake2s_integration_benchmark 7.546 ± 0.153 7.422 7.873 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.103 ± 0.016 2.093 2.147 1.00
head compare_arrays_200000 2.112 ± 0.024 2.080 2.144 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.390 ± 0.013 1.377 1.416 1.00
head dict_integration_benchmark 1.402 ± 0.010 1.391 1.421 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.280 ± 0.016 1.266 1.304 1.00
head field_arithmetic_get_square_benchmark 1.295 ± 0.071 1.257 1.494 1.01 ± 0.06
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.495 ± 0.093 7.387 7.678 1.00
head integration_builtins 7.527 ± 0.202 7.369 8.036 1.00 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.704 ± 0.142 7.561 7.935 1.00
head keccak_integration_benchmark 7.805 ± 0.145 7.598 8.042 1.01 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.115 ± 0.146 2.023 2.457 1.04 ± 0.07
head linear_search 2.041 ± 0.026 2.024 2.090 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.684 ± 0.011 1.675 1.702 1.00
head math_cmp_and_pow_integration_benchmark 1.699 ± 0.028 1.672 1.739 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.582 ± 0.011 1.568 1.599 1.00
head math_integration_benchmark 1.592 ± 0.013 1.572 1.612 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.174 ± 0.019 1.164 1.225 1.00
head memory_integration_benchmark 1.186 ± 0.013 1.174 1.210 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.817 ± 0.034 1.794 1.906 1.01 ± 0.03
head operations_with_data_structures_benchmarks 1.805 ± 0.035 1.784 1.903 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 515.3 ± 6.8 510.1 532.6 1.00 ± 0.02
head pedersen 513.8 ± 4.4 509.5 523.4 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 956.5 ± 8.3 943.6 976.0 1.00
head poseidon_integration_benchmark 969.3 ± 17.3 957.1 1015.5 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.854 ± 0.021 1.835 1.905 1.00
head secp_integration_benchmark 1.864 ± 0.031 1.843 1.946 1.01 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 639.9 ± 4.6 635.2 649.3 1.00 ± 0.01
head set_integration_benchmark 637.1 ± 1.5 634.8 639.7 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.153 ± 0.057 4.084 4.292 1.00 ± 0.02
head uint256_integration_benchmark 4.147 ± 0.054 4.072 4.220 1.00

@fmoletta fmoletta changed the title [WIP] Serialize inputs into output segment Serialize inputs into output segment May 22, 2024
Base automatically changed from serialize-array-to-output-segment to main May 22, 2024 21:10
Copy link

github-actions bot commented May 22, 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 ± σ):     27.032 s ±  0.001 s    [User: 26.198 s, System: 0.832 s]
  Range (min … max):   27.032 s … 27.033 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     27.060 s ±  0.010 s    [User: 26.250 s, System: 0.807 s]
  Range (min … max):   27.053 s … 27.066 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 ± σ):     14.721 s ±  0.002 s    [User: 26.874 s, System: 0.741 s]
  Range (min … max):   14.719 s … 14.722 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     15.007 s ±  0.379 s    [User: 27.067 s, System: 0.799 s]
  Range (min … max):   14.739 s … 15.275 s    2 runs
 
Summary
  'hyper_threading_main threads: 2' ran
    1.02 ± 0.03 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 ± σ):     10.645 s ±  0.009 s    [User: 38.891 s, System: 0.947 s]
  Range (min … max):   10.639 s … 10.652 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.949 s ±  0.053 s    [User: 38.802 s, System: 0.957 s]
  Range (min … max):   10.912 s … 10.987 s    2 runs
 
Summary
  'hyper_threading_main threads: 4' ran
    1.03 ± 0.01 times faster than 'hyper_threading_pr 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 ± σ):     10.828 s ±  0.356 s    [User: 38.995 s, System: 1.007 s]
  Range (min … max):   10.576 s … 11.079 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.867 s ±  0.006 s    [User: 38.861 s, System: 1.024 s]
  Range (min … max):   10.862 s … 10.871 s    2 runs
 
Summary
  'hyper_threading_main threads: 6' ran
    1.00 ± 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 ± σ):     10.596 s ±  0.141 s    [User: 39.416 s, System: 0.991 s]
  Range (min … max):   10.496 s … 10.696 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.581 s ±  0.140 s    [User: 39.427 s, System: 0.976 s]
  Range (min … max):   10.482 s … 10.680 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 ± σ):     10.563 s ±  0.200 s    [User: 39.609 s, System: 1.067 s]
  Range (min … max):   10.422 s … 10.704 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.487 s ±  0.181 s    [User: 39.795 s, System: 1.010 s]
  Range (min … max):   10.359 s … 10.614 s    2 runs
 
Summary
  'hyper_threading_pr threads: 16' ran
    1.01 ± 0.03 times faster than 'hyper_threading_main threads: 16'


@fmoletta fmoletta marked this pull request as ready for review May 22, 2024 21:49
Copy link

codecov bot commented May 23, 2024

Codecov Report

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

Project coverage is 94.78%. Comparing base (a30e5c8) to head (e6bae58).

Files Patch % Lines
cairo1-run/src/cairo_run.rs 86.13% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1770      +/-   ##
==========================================
- Coverage   94.79%   94.78%   -0.01%     
==========================================
  Files         101      101              
  Lines       38889    38972      +83     
==========================================
+ Hits        36863    36939      +76     
- Misses       2026     2033       +7     

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

Copy link
Member

@juanbono juanbono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@pefontana pefontana added this pull request to the merge queue May 23, 2024
Merged via the queue into main with commit 5c5d1f2 May 23, 2024
71 of 72 checks passed
@pefontana pefontana deleted the serialize-inputs-to-output-segment branch May 23, 2024 19:17
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.

None yet

3 participants