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
509 stars 142 forks source link

Allow running instructions from `pc`s outside the program segment #1493

Closed fmoletta closed 9 months ago

fmoletta commented 10 months ago

In order to run the os, we need to load programs into new segments and run them by setting the pc to their starting location. In order to achieve this, we must handle pc's with an index different from 0 in step_instruction. Depends on #1492 (for testing)

codecov[bot] commented 10 months ago

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (0941386) 96.81% compared to head (2a3a0fb) 96.81%.

Files Patch % Lines
vm/src/vm/vm_core.rs 95.04% 6 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1493 +/- ## ========================================== - Coverage 96.81% 96.81% -0.01% ========================================== Files 96 96 Lines 39581 39684 +103 ========================================== + Hits 38322 38419 +97 - Misses 1259 1265 +6 ```

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

github-actions[bot] commented 10 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.616 ± 0.033 2.591 2.700 1.00
head big_factorial 2.827 ± 0.043 2.787 2.931 1.08 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.231 ± 0.077 2.190 2.444 1.00
head big_fibonacci 2.430 ± 0.049 2.401 2.559 1.09 ± 0.04
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.540 ± 0.047 7.474 7.622 1.00
head blake2s_integration_benchmark 8.680 ± 0.342 8.420 9.302 1.15 ± 0.05
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.635 ± 0.043 2.609 2.754 1.00
head compare_arrays_200000 2.896 ± 0.086 2.839 3.113 1.10 ± 0.04
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.770 ± 0.020 1.751 1.821 1.00
head dict_integration_benchmark 1.885 ± 0.005 1.877 1.890 1.07 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.262 ± 0.009 1.252 1.280 1.00
head field_arithmetic_get_square_benchmark 1.390 ± 0.024 1.372 1.438 1.10 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 6.132 ± 0.047 6.076 6.209 1.00
head integration_builtins 6.932 ± 0.074 6.855 7.119 1.13 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.624 ± 0.058 7.572 7.774 1.00
head keccak_integration_benchmark 8.606 ± 0.045 8.547 8.701 1.13 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.667 ± 0.012 2.647 2.690 1.00
head linear_search 2.906 ± 0.033 2.871 2.982 1.09 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.758 ± 0.005 1.749 1.765 1.00
head math_cmp_and_pow_integration_benchmark 1.877 ± 0.010 1.866 1.895 1.07 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.695 ± 0.024 1.671 1.744 1.00
head math_integration_benchmark 1.797 ± 0.004 1.791 1.805 1.06 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.503 ± 0.023 1.487 1.566 1.00
head memory_integration_benchmark 1.631 ± 0.031 1.609 1.691 1.09 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.642 ± 0.068 1.611 1.833 1.00
head operations_with_data_structures_benchmarks 1.742 ± 0.011 1.727 1.764 1.06 ± 0.04
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 592.8 ± 1.2 590.3 594.7 1.00
head pedersen 615.8 ± 2.7 611.7 619.4 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.195 ± 0.005 1.187 1.201 1.00
head poseidon_integration_benchmark 1.229 ± 0.010 1.221 1.257 1.03 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.193 ± 0.020 2.176 2.244 1.00
head secp_integration_benchmark 2.310 ± 0.020 2.277 2.342 1.05 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.201 ± 0.021 1.188 1.259 1.00
head set_integration_benchmark 1.216 ± 0.004 1.211 1.222 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.613 ± 0.017 4.589 4.650 1.00
head uint256_integration_benchmark 5.089 ± 0.048 5.045 5.167 1.10 ± 0.01