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

Remove CairoRunError::CairoPieValidation error #1750

Closed pefontana closed 4 months ago

pefontana commented 5 months ago

Remove CairoRunError::CairoPieValidation error

Remove CairoRunError::CairoPieValidation error and replace it with RunnerError::CairoPieValidation

These changes try to address the performance regressions in #1720

Description of the pull request changes and motivation.

Checklist

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 ± σ):     27.088 s ±  0.041 s    [User: 26.283 s, System: 0.804 s]
  Range (min … max):   27.059 s … 27.117 s    2 runs

Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     27.346 s ±  0.005 s    [User: 26.556 s, System: 0.788 s]
  Range (min … max):   27.342 s … 27.350 s    2 runs

Summary
  'hyper_threading_main threads: 1' ran
    1.01 ± 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.574 s ±  0.030 s    [User: 26.824 s, System: 0.814 s]
  Range (min … max):   14.553 s … 14.596 s    2 runs

Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.692 s ±  0.056 s    [User: 27.429 s, System: 0.842 s]
  Range (min … max):   14.653 s … 14.732 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 ± σ):     10.816 s ±  0.061 s    [User: 38.795 s, System: 0.938 s]
  Range (min … max):   10.773 s … 10.859 s    2 runs

Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.616 s ±  0.089 s    [User: 39.338 s, System: 1.019 s]
  Range (min … max):   10.553 s … 10.679 s    2 runs

Summary
  'hyper_threading_pr threads: 4' ran
    1.02 ± 0.01 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 ± σ):     10.736 s ±  0.236 s    [User: 38.835 s, System: 0.984 s]
  Range (min … max):   10.570 s … 10.903 s    2 runs

Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.888 s ±  0.130 s    [User: 39.021 s, System: 0.994 s]
  Range (min … max):   10.796 s … 10.980 s    2 runs

Summary
  'hyper_threading_main threads: 6' ran
    1.01 ± 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.548 s ±  0.060 s    [User: 39.366 s, System: 1.003 s]
  Range (min … max):   10.505 s … 10.590 s    2 runs

Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.632 s ±  0.142 s    [User: 39.272 s, System: 0.977 s]
  Range (min … max):   10.531 s … 10.733 s    2 runs

Summary
  'hyper_threading_main threads: 8' ran
    1.01 ± 0.01 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 ± σ):     10.616 s ±  0.102 s    [User: 39.496 s, System: 1.118 s]
  Range (min … max):   10.543 s … 10.688 s    2 runs

Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.624 s ±  0.036 s    [User: 39.326 s, System: 1.073 s]
  Range (min … max):   10.598 s … 10.650 s    2 runs

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

Codecov Report

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

Project coverage is 94.76%. Comparing base (b25dae7) to head (1b8840d).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1750 +/- ## ======================================= Coverage 94.76% 94.76% ======================================= Files 101 101 Lines 38826 38827 +1 ======================================= + Hits 36795 36796 +1 Misses 2031 2031 ```

: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 2.091 ± 0.008 2.075 2.099 1.01 ± 0.03
head big_factorial 2.074 ± 0.057 2.031 2.230 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.044 ± 0.019 2.017 2.073 1.03 ± 0.01
head big_fibonacci 1.982 ± 0.014 1.964 2.010 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.783 ± 0.142 7.615 8.128 1.03 ± 0.06
head blake2s_integration_benchmark 7.570 ± 0.417 7.364 8.748 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.175 ± 0.022 2.155 2.216 1.01 ± 0.02
head compare_arrays_200000 2.150 ± 0.046 2.100 2.263 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.467 ± 0.011 1.454 1.486 1.00
head dict_integration_benchmark 1.480 ± 0.034 1.457 1.573 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.339 ± 0.057 1.301 1.500 1.04 ± 0.05
head field_arithmetic_get_square_benchmark 1.292 ± 0.011 1.276 1.317 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.781 ± 0.052 7.686 7.851 1.02 ± 0.03
head integration_builtins 7.593 ± 0.235 7.381 8.236 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.055 ± 0.046 7.976 8.098 1.05 ± 0.01
head keccak_integration_benchmark 7.688 ± 0.061 7.598 7.803 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.160 ± 0.023 2.123 2.201 1.02 ± 0.01
head linear_search 2.111 ± 0.015 2.094 2.142 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.742 ± 0.014 1.716 1.755 1.01 ± 0.01
head math_cmp_and_pow_integration_benchmark 1.725 ± 0.017 1.705 1.762 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.652 ± 0.012 1.637 1.669 1.01 ± 0.01
head math_integration_benchmark 1.634 ± 0.019 1.615 1.677 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.260 ± 0.013 1.237 1.282 1.03 ± 0.02
head memory_integration_benchmark 1.220 ± 0.024 1.199 1.283 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.879 ± 0.010 1.863 1.893 1.02 ± 0.01
head operations_with_data_structures_benchmarks 1.834 ± 0.019 1.808 1.875 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 525.6 ± 3.4 521.8 533.1 1.00
head pedersen 526.8 ± 8.3 518.4 546.0 1.00 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 979.0 ± 6.2 973.5 992.6 1.01 ± 0.01
head poseidon_integration_benchmark 971.8 ± 5.1 964.3 979.1 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.881 ± 0.040 1.856 1.989 1.01 ± 0.02
head secp_integration_benchmark 1.868 ± 0.021 1.853 1.918 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 649.9 ± 3.2 646.4 657.3 1.00 ± 0.02
head set_integration_benchmark 647.2 ± 10.8 638.7 675.0 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.273 ± 0.015 4.255 4.310 1.04 ± 0.01
head uint256_integration_benchmark 4.122 ± 0.037 4.072 4.213 1.00