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

Fix modulo builtin test #1831

Closed JulianGCalderon closed 2 months ago

JulianGCalderon commented 2 months ago

TITLE

Description

Description of the pull request changes and motivation.

Checklist

github-actions[bot] commented 2 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 ± σ):     25.325 s ±  0.038 s    [User: 24.529 s, System: 0.794 s]
  Range (min … max):   25.298 s … 25.352 s    2 runs

Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     26.083 s ±  0.014 s    [User: 25.348 s, System: 0.734 s]
  Range (min … max):   26.073 s … 26.092 s    2 runs

Summary
  'hyper_threading_main threads: 1' ran
    1.03 ± 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.524 s ±  0.039 s    [User: 25.410 s, System: 0.814 s]
  Range (min … max):   14.497 s … 14.552 s    2 runs

Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.320 s ±  0.034 s    [User: 25.461 s, System: 0.770 s]
  Range (min … max):   14.296 s … 14.343 s    2 runs

Summary
  'hyper_threading_pr threads: 2' ran
    1.01 ± 0.00 times faster than 'hyper_threading_main 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.898 s ±  0.085 s    [User: 37.552 s, System: 0.964 s]
  Range (min … max):   10.837 s … 10.958 s    2 runs

Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.731 s ±  0.422 s    [User: 37.926 s, System: 0.988 s]
  Range (min … max):   10.432 s … 11.030 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 ± σ):     10.609 s ±  0.343 s    [User: 37.773 s, System: 0.981 s]
  Range (min … max):   10.367 s … 10.852 s    2 runs

Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.706 s ±  0.095 s    [User: 37.948 s, System: 0.961 s]
  Range (min … max):   10.639 s … 10.773 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.365 s ±  0.174 s    [User: 38.574 s, System: 1.061 s]
  Range (min … max):   10.241 s … 10.488 s    2 runs

Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.413 s ±  0.209 s    [User: 38.519 s, System: 0.951 s]
  Range (min … max):   10.265 s … 10.560 s    2 runs

Summary
  'hyper_threading_main threads: 8' ran
    1.00 ± 0.03 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.757 s ±  0.113 s    [User: 39.307 s, System: 1.094 s]
  Range (min … max):   10.677 s … 10.837 s    2 runs

Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.347 s ±  0.114 s    [User: 38.985 s, System: 1.068 s]
  Range (min … max):   10.266 s … 10.428 s    2 runs

Summary
  'hyper_threading_pr threads: 16' ran
    1.04 ± 0.02 times faster than 'hyper_threading_main threads: 16'
codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 80.00000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 94.89%. Comparing base (59953d2) to head (2a4213f). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
vm/src/vm/runners/builtin_runner/modulo.rs 0.00% 3 Missing :warning:
vm/src/vm/runners/cairo_pie.rs 80.00% 1 Missing :warning:
vm/src/vm/runners/cairo_runner.rs 75.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1831 +/- ## ========================================== - Coverage 94.90% 94.89% -0.01% ========================================== Files 102 102 Lines 40288 40305 +17 ========================================== + Hits 38234 38247 +13 - Misses 2054 2058 +4 ```

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

github-actions[bot] commented 2 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 1.988 ± 0.012 1.966 2.006 1.00
head big_factorial 2.062 ± 0.047 2.030 2.181 1.04 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 1.944 ± 0.013 1.926 1.959 1.00
head big_fibonacci 2.035 ± 0.080 1.990 2.257 1.05 ± 0.04
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.546 ± 0.707 7.204 9.532 1.00
head blake2s_integration_benchmark 7.563 ± 0.094 7.414 7.701 1.00 ± 0.09
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.068 ± 0.025 2.031 2.118 1.00
head compare_arrays_200000 2.170 ± 0.053 2.099 2.254 1.05 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.357 ± 0.010 1.344 1.378 1.00
head dict_integration_benchmark 1.419 ± 0.028 1.395 1.480 1.05 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.169 ± 0.009 1.161 1.185 1.00
head field_arithmetic_get_square_benchmark 1.219 ± 0.013 1.201 1.239 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.310 ± 0.071 7.265 7.500 1.00
head integration_builtins 7.616 ± 0.100 7.471 7.748 1.04 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.635 ± 0.235 7.468 8.230 1.00
head keccak_integration_benchmark 8.073 ± 0.725 7.700 10.123 1.06 ± 0.10
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.055 ± 0.018 2.032 2.092 1.00
head linear_search 2.109 ± 0.020 2.089 2.142 1.03 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.460 ± 0.017 1.443 1.500 1.00
head math_cmp_and_pow_integration_benchmark 1.501 ± 0.030 1.470 1.547 1.03 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.393 ± 0.014 1.378 1.428 1.00
head math_integration_benchmark 1.442 ± 0.023 1.419 1.483 1.04 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.148 ± 0.016 1.134 1.191 1.00
head memory_integration_benchmark 1.190 ± 0.032 1.165 1.257 1.04 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.505 ± 0.026 1.489 1.577 1.00
head operations_with_data_structures_benchmarks 1.551 ± 0.012 1.529 1.573 1.03 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 516.3 ± 5.6 511.4 530.9 1.00
head pedersen 522.9 ± 2.6 519.1 527.6 1.01 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 760.0 ± 2.5 755.9 765.2 1.00
head poseidon_integration_benchmark 770.4 ± 11.0 758.7 798.8 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.792 ± 0.021 1.777 1.843 1.00
head secp_integration_benchmark 1.849 ± 0.028 1.823 1.912 1.03 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 609.0 ± 2.8 605.5 614.4 1.00
head set_integration_benchmark 643.2 ± 6.1 637.0 659.8 1.06 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.044 ± 0.062 3.983 4.173 1.00
head uint256_integration_benchmark 4.206 ± 0.053 4.147 4.286 1.04 ± 0.02