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
514 stars 144 forks source link

Add `recursive_with_poseidon` layout #1724

Closed fmoletta closed 5 months ago

fmoletta commented 5 months ago

Adds recursive_with_poseidon layout Testing done by compare_factorial_outputs_all_layouts workflow

github-actions[bot] commented 5 months 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 ± σ):     23.516 s ±  0.050 s    [User: 22.840 s, System: 0.674 s]
  Range (min … max):   23.481 s … 23.551 s    2 runs

Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     23.766 s ±  0.266 s    [User: 23.077 s, System: 0.687 s]
  Range (min … max):   23.578 s … 23.954 s    2 runs

Summary
  'hyper_threading_main threads: 1' ran
    1.01 ± 0.01 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.253 s ±  0.022 s    [User: 23.141 s, System: 0.680 s]
  Range (min … max):   12.237 s … 12.268 s    2 runs

Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     12.330 s ±  0.032 s    [User: 23.215 s, System: 0.688 s]
  Range (min … max):   12.308 s … 12.352 s    2 runs

Summary
  'hyper_threading_main threads: 2' ran
    1.01 ± 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.707 s ±  0.361 s    [User: 34.654 s, System: 0.906 s]
  Range (min … max):    9.452 s …  9.962 s    2 runs

Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):      9.723 s ±  0.111 s    [User: 34.950 s, System: 0.843 s]
  Range (min … max):    9.645 s …  9.801 s    2 runs

Summary
  'hyper_threading_main threads: 4' ran
    1.00 ± 0.04 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 ± σ):      9.744 s ±  0.252 s    [User: 34.502 s, System: 0.936 s]
  Range (min … max):    9.566 s …  9.922 s    2 runs

Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):      9.665 s ±  0.098 s    [User: 34.952 s, System: 0.952 s]
  Range (min … max):    9.596 s …  9.734 s    2 runs

Summary
  'hyper_threading_pr threads: 6' ran
    1.01 ± 0.03 times faster than 'hyper_threading_main 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.470 s ±  0.153 s    [User: 35.086 s, System: 0.923 s]
  Range (min … max):    9.362 s …  9.578 s    2 runs

Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):      9.522 s ±  0.028 s    [User: 35.239 s, System: 0.969 s]
  Range (min … max):    9.502 s …  9.542 s    2 runs

Summary
  'hyper_threading_main threads: 8' ran
    1.01 ± 0.02 times faster than 'hyper_threading_pr 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.353 s ±  0.018 s    [User: 35.126 s, System: 1.036 s]
  Range (min … max):    9.341 s …  9.366 s    2 runs

Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):      9.438 s ±  0.100 s    [User: 35.691 s, System: 1.007 s]
  Range (min … max):    9.367 s …  9.509 s    2 runs

Summary
  'hyper_threading_main threads: 16' ran
    1.01 ± 0.01 times faster than 'hyper_threading_pr threads: 16'
codecov[bot] commented 5 months ago

Codecov Report

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

Project coverage is 94.87%. Comparing base (932986c) to head (1378dd5).

Files Patch % Lines
...ypes/instance_definitions/builtins_instance_def.rs 0.00% 15 Missing :warning:
vm/src/types/layout.rs 0.00% 9 Missing :warning:
vm/src/vm/runners/cairo_runner.rs 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1724 +/- ## ========================================== - Coverage 94.93% 94.87% -0.07% ========================================== Files 99 99 Lines 38147 38174 +27 ========================================== + Hits 36216 36218 +2 - Misses 1931 1956 +25 ```

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

github-actions[bot] commented 5 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 1.907 ± 0.044 1.882 2.026 1.01 ± 0.02
head big_factorial 1.895 ± 0.006 1.886 1.907 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 1.848 ± 0.009 1.833 1.861 1.00
head big_fibonacci 1.860 ± 0.056 1.833 2.019 1.01 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 6.479 ± 0.097 6.370 6.600 1.00
head blake2s_integration_benchmark 6.495 ± 0.122 6.380 6.735 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 1.899 ± 0.010 1.881 1.917 1.00
head compare_arrays_200000 1.900 ± 0.006 1.893 1.909 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.304 ± 0.018 1.288 1.349 1.01 ± 0.01
head dict_integration_benchmark 1.287 ± 0.003 1.280 1.292 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.161 ± 0.010 1.149 1.181 1.01 ± 0.01
head field_arithmetic_get_square_benchmark 1.149 ± 0.007 1.139 1.161 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 6.542 ± 0.078 6.432 6.656 1.00 ± 0.02
head integration_builtins 6.532 ± 0.067 6.453 6.615 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 6.681 ± 0.138 6.591 7.056 1.00
head keccak_integration_benchmark 6.686 ± 0.068 6.588 6.779 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base linear_search 1.915 ± 0.013 1.896 1.942 1.00
head linear_search 1.922 ± 0.013 1.905 1.944 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.652 ± 0.006 1.644 1.664 1.00 ± 0.00
head math_cmp_and_pow_integration_benchmark 1.647 ± 0.004 1.641 1.653 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.435 ± 0.008 1.422 1.453 1.00 ± 0.01
head math_integration_benchmark 1.431 ± 0.010 1.420 1.450 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.112 ± 0.005 1.101 1.120 1.00
head memory_integration_benchmark 1.117 ± 0.011 1.100 1.134 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.743 ± 0.014 1.731 1.770 1.00 ± 0.01
head operations_with_data_structures_benchmarks 1.736 ± 0.004 1.731 1.741 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 501.2 ± 3.5 495.2 505.1 1.01 ± 0.01
head pedersen 498.6 ± 3.8 488.9 501.5 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 934.5 ± 8.8 923.1 949.8 1.00 ± 0.01
head poseidon_integration_benchmark 933.3 ± 7.8 924.4 944.7 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.726 ± 0.035 1.703 1.804 1.01 ± 0.02
head secp_integration_benchmark 1.709 ± 0.011 1.691 1.727 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 677.5 ± 3.0 674.0 682.3 1.00 ± 0.01
head set_integration_benchmark 676.6 ± 3.2 670.6 679.8 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 3.726 ± 0.026 3.694 3.773 1.00
head uint256_integration_benchmark 3.736 ± 0.020 3.709 3.770 1.00 ± 0.01