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
485 stars 133 forks source link

fix: Handle triple dereference references #1708

Closed fmoletta closed 2 months ago

fmoletta commented 2 months ago

Handles references of type [cast([[reg + off] + off], type)]

codecov[bot] commented 2 months ago

Codecov Report

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

Project coverage is 94.91%. Comparing base (584eaa2) to head (a8d4ae9).

Files Patch % Lines
vm/src/hint_processor/hint_processor_definition.rs 66.66% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1708 +/- ## ======================================= Coverage 94.90% 94.91% ======================================= Files 98 98 Lines 38092 38166 +74 ======================================= + Hits 36151 36224 +73 - Misses 1941 1942 +1 ```

: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 2.294 ± 0.035 2.262 2.386 1.01 ± 0.02
head big_factorial 2.275 ± 0.012 2.257 2.295 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.259 ± 0.008 2.240 2.272 1.00
head big_fibonacci 2.269 ± 0.037 2.242 2.367 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.597 ± 0.420 8.315 9.345 1.01 ± 0.05
head blake2s_integration_benchmark 8.536 ± 0.206 8.331 8.932 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.341 ± 0.027 2.295 2.401 1.00 ± 0.01
head compare_arrays_200000 2.335 ± 0.011 2.323 2.357 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.458 ± 0.020 1.431 1.499 1.01 ± 0.01
head dict_integration_benchmark 1.441 ± 0.007 1.433 1.457 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.394 ± 0.020 1.363 1.426 1.00 ± 0.02
head field_arithmetic_get_square_benchmark 1.392 ± 0.017 1.374 1.426 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.575 ± 0.394 8.319 9.593 1.01 ± 0.05
head integration_builtins 8.512 ± 0.173 8.320 8.690 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.815 ± 0.177 8.586 8.983 1.01 ± 0.03
head keccak_integration_benchmark 8.755 ± 0.183 8.559 8.983 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.358 ± 0.019 2.332 2.388 1.01 ± 0.01
head linear_search 2.338 ± 0.011 2.325 2.357 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.834 ± 0.027 1.803 1.878 1.01 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.818 ± 0.019 1.794 1.852 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.630 ± 0.017 1.607 1.657 1.02 ± 0.01
head math_integration_benchmark 1.602 ± 0.016 1.585 1.633 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.289 ± 0.015 1.262 1.307 1.00 ± 0.01
head memory_integration_benchmark 1.284 ± 0.012 1.265 1.300 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.923 ± 0.014 1.909 1.959 1.01 ± 0.01
head operations_with_data_structures_benchmarks 1.902 ± 0.006 1.893 1.912 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 551.5 ± 7.5 544.9 570.4 1.00 ± 0.02
head pedersen 550.1 ± 4.1 545.3 558.7 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 980.7 ± 7.0 970.0 990.8 1.00
head poseidon_integration_benchmark 985.9 ± 12.0 975.7 1013.8 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.921 ± 0.010 1.909 1.941 1.00 ± 0.01
head secp_integration_benchmark 1.919 ± 0.015 1.904 1.958 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 754.4 ± 5.3 747.8 763.2 1.00 ± 0.01
head set_integration_benchmark 752.8 ± 5.0 746.0 761.7 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.708 ± 0.050 4.599 4.759 1.00 ± 0.02
head uint256_integration_benchmark 4.696 ± 0.059 4.621 4.756 1.00
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 ± σ):     29.402 s ±  0.033 s    [User: 28.727 s, System: 0.674 s]
  Range (min … max):   29.378 s … 29.425 s    2 runs

Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     29.268 s ±  0.006 s    [User: 28.513 s, System: 0.754 s]
  Range (min … max):   29.264 s … 29.273 s    2 runs

Summary
  'hyper_threading_pr threads: 1' ran
    1.00 ± 0.00 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 ± σ):     15.709 s ±  0.029 s    [User: 28.844 s, System: 0.708 s]
  Range (min … max):   15.688 s … 15.729 s    2 runs

Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     15.629 s ±  0.018 s    [User: 28.767 s, System: 0.721 s]
  Range (min … max):   15.617 s … 15.642 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 ± σ):     11.328 s ±  0.314 s    [User: 40.450 s, System: 0.889 s]
  Range (min … max):   11.106 s … 11.550 s    2 runs

Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     11.434 s ±  0.565 s    [User: 40.659 s, System: 0.895 s]
  Range (min … max):   11.035 s … 11.834 s    2 runs

Summary
  'hyper_threading_main threads: 4' ran
    1.01 ± 0.06 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 ± σ):     11.208 s ±  0.133 s    [User: 40.488 s, System: 0.924 s]
  Range (min … max):   11.114 s … 11.303 s    2 runs

Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     11.579 s ±  0.147 s    [User: 40.852 s, System: 0.958 s]
  Range (min … max):   11.475 s … 11.683 s    2 runs

Summary
  'hyper_threading_main threads: 6' ran
    1.03 ± 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 ± σ):     11.019 s ±  0.054 s    [User: 40.960 s, System: 0.987 s]
  Range (min … max):   10.981 s … 11.057 s    2 runs

Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     11.236 s ±  0.106 s    [User: 41.082 s, System: 0.935 s]
  Range (min … max):   11.161 s … 11.312 s    2 runs

Summary
  'hyper_threading_main threads: 8' ran
    1.02 ± 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.865 s ±  0.019 s    [User: 41.376 s, System: 1.032 s]
  Range (min … max):   10.852 s … 10.878 s    2 runs

Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     11.171 s ±  0.252 s    [User: 41.808 s, System: 1.041 s]
  Range (min … max):   10.993 s … 11.349 s    2 runs

Summary
  'hyper_threading_main threads: 16' ran
    1.03 ± 0.02 times faster than 'hyper_threading_pr threads: 16'