lambdaclass / cairo-vm

cairo-vm is a Rust implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
https://lambdaclass.github.io/cairo-vm
Apache License 2.0
522 stars 150 forks source link

Add_missing_builtins_to_pie_metadata_serialization #1868

Closed YairVaknin-starkware closed 1 week ago

YairVaknin-starkware commented 2 weeks ago

TITLE

Add_missing_builtins_to_pie_metadata_serialization - BUGFIX

Description

Description of the pull request changes and motivation. Currently, the new 3 builtins' segments are not being serialized to the output pie's metadata. This PR fixes that issue by adding them to the serializing func.

Checklist

github-actions[bot] commented 2 weeks ago
**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 ± σ):     33.114 s ±  0.256 s    [User: 32.383 s, System: 0.730 s]
  Range (min … max):   32.933 s … 33.295 s    2 runs

Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     33.064 s ±  0.023 s    [User: 32.270 s, System: 0.792 s]
  Range (min … max):   33.048 s … 33.080 s    2 runs

Summary
  'hyper_threading_pr threads: 1' ran
    1.00 ± 0.01 times faster than 'hyper_threading_main 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 ± σ):     17.670 s ±  0.014 s    [User: 30.872 s, System: 0.822 s]
  Range (min … max):   17.660 s … 17.680 s    2 runs

Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     17.725 s ±  0.054 s    [User: 31.019 s, System: 0.812 s]
  Range (min … max):   17.686 s … 17.763 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 ± σ):     12.288 s ±  0.645 s    [User: 43.965 s, System: 0.929 s]
  Range (min … max):   11.832 s … 12.745 s    2 runs

Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     12.035 s ±  0.063 s    [User: 44.038 s, System: 1.006 s]
  Range (min … max):   11.990 s … 12.079 s    2 runs

Summary
  'hyper_threading_pr threads: 4' ran
    1.02 ± 0.05 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 ± σ):     11.942 s ±  0.197 s    [User: 43.915 s, System: 0.987 s]
  Range (min … max):   11.803 s … 12.081 s    2 runs

Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     12.219 s ±  0.045 s    [User: 43.817 s, System: 0.972 s]
  Range (min … max):   12.187 s … 12.251 s    2 runs

Summary
  'hyper_threading_main threads: 6' ran
    1.02 ± 0.02 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 ± σ):     12.182 s ±  0.182 s    [User: 44.297 s, System: 0.948 s]
  Range (min … max):   12.054 s … 12.311 s    2 runs

Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     12.126 s ±  0.114 s    [User: 44.344 s, System: 0.988 s]
  Range (min … max):   12.046 s … 12.206 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 ± σ):     11.859 s ±  0.048 s    [User: 44.442 s, System: 1.120 s]
  Range (min … max):   11.825 s … 11.893 s    2 runs

Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     11.848 s ±  0.127 s    [User: 44.553 s, System: 1.108 s]
  Range (min … max):   11.758 s … 11.938 s    2 runs

Summary
  'hyper_threading_pr threads: 16' ran
    1.00 ± 0.01 times faster than 'hyper_threading_main threads: 16'
github-actions[bot] commented 2 weeks ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.489 ± 0.046 2.441 2.558 1.00
head big_factorial 2.511 ± 0.059 2.454 2.632 1.01 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.448 ± 0.040 2.400 2.502 1.01 ± 0.02
head big_fibonacci 2.431 ± 0.033 2.396 2.492 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 9.111 ± 0.163 8.980 9.462 1.00 ± 0.02
head blake2s_integration_benchmark 9.066 ± 0.075 9.012 9.244 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.568 ± 0.022 2.529 2.601 1.00
head compare_arrays_200000 2.611 ± 0.083 2.524 2.809 1.02 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.716 ± 0.064 1.654 1.838 1.03 ± 0.04
head dict_integration_benchmark 1.663 ± 0.017 1.645 1.692 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.427 ± 0.019 1.405 1.468 1.00
head field_arithmetic_get_square_benchmark 1.432 ± 0.038 1.401 1.533 1.00 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 9.222 ± 0.171 9.030 9.594 1.00
head integration_builtins 9.350 ± 0.271 9.064 9.927 1.01 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 9.495 ± 0.194 9.337 10.008 1.01 ± 0.02
head keccak_integration_benchmark 9.429 ± 0.077 9.335 9.532 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.567 ± 0.068 2.504 2.752 1.01 ± 0.03
head linear_search 2.542 ± 0.053 2.498 2.678 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.721 ± 0.016 1.708 1.745 1.00
head math_cmp_and_pow_integration_benchmark 1.722 ± 0.015 1.692 1.739 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.688 ± 0.017 1.663 1.716 1.00 ± 0.01
head math_integration_benchmark 1.682 ± 0.016 1.658 1.714 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.426 ± 0.021 1.402 1.464 1.01 ± 0.02
head memory_integration_benchmark 1.409 ± 0.028 1.394 1.483 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.806 ± 0.036 1.780 1.881 1.00 ± 0.02
head operations_with_data_structures_benchmarks 1.798 ± 0.023 1.777 1.850 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 591.2 ± 5.0 586.9 604.8 1.00
head pedersen 593.6 ± 7.3 588.0 611.2 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 699.4 ± 6.0 691.7 709.4 1.00 ± 0.02
head poseidon_integration_benchmark 698.6 ± 16.4 686.2 735.8 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.054 ± 0.018 2.032 2.085 1.00 ± 0.01
head secp_integration_benchmark 2.047 ± 0.019 2.028 2.081 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 723.4 ± 16.5 701.9 755.4 1.02 ± 0.03
head set_integration_benchmark 712.5 ± 10.8 698.9 735.0 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 5.031 ± 0.063 4.941 5.139 1.00
head uint256_integration_benchmark 5.064 ± 0.151 4.944 5.375 1.01 ± 0.03
codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.32%. Comparing base (84e513d) to head (f287173). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1868 +/- ## ======================================= Coverage 96.32% 96.32% ======================================= Files 102 102 Lines 40322 40322 ======================================= Hits 38839 38839 Misses 1483 1483 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.