Skip to content

Conversation

@JulianGCalderon
Copy link
Contributor

@JulianGCalderon JulianGCalderon commented Aug 11, 2025

Enable memory comparisons again

Closes #2154.

Depends on #2076.

When in proof mode, the builtin segment holes are filled at the end of the run. This generates a discrepancy between this VM and the original Python Cairo VM. For this reason, we disabled the memory comparisons temporarily. See #2088 and #2086.

This PR adds a new flag fill_holes that can be used independently from proof_mode. This enables us to compare proof mode memory with the original Python Cairo VM.

The test coverage workflow is failing because this PR modifies a function that was not being tested.

@github-actions
Copy link

github-actions bot commented Aug 11, 2025

**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 ± σ):     24.119 s ±  0.021 s    [User: 23.249 s, System: 0.868 s]
  Range (min … max):   24.104 s … 24.134 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     24.461 s ±  0.087 s    [User: 23.584 s, System: 0.875 s]
  Range (min … max):   24.400 s … 24.522 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 ± σ):     13.204 s ±  0.025 s    [User: 23.429 s, System: 0.875 s]
  Range (min … max):   13.186 s … 13.221 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     13.210 s ±  0.012 s    [User: 23.576 s, System: 0.871 s]
  Range (min … max):   13.202 s … 13.218 s    2 runs
 
Summary
  hyper_threading_main threads: 2 ran
    1.00 ± 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.729 s ±  0.173 s    [User: 35.686 s, System: 1.038 s]
  Range (min … max):    9.606 s …  9.851 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):      9.697 s ±  0.017 s    [User: 35.637 s, System: 1.006 s]
  Range (min … max):    9.684 s …  9.709 s    2 runs
 
Summary
  hyper_threading_pr threads: 4 ran
    1.00 ± 0.02 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 ± σ):      9.825 s ±  0.391 s    [User: 35.718 s, System: 1.069 s]
  Range (min … max):    9.548 s … 10.101 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):      9.750 s ±  0.123 s    [User: 35.873 s, System: 1.055 s]
  Range (min … max):    9.663 s …  9.837 s    2 runs
 
Summary
  hyper_threading_pr threads: 6 ran
    1.01 ± 0.04 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.631 s ±  0.048 s    [User: 36.160 s, System: 1.062 s]
  Range (min … max):    9.597 s …  9.665 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):      9.794 s ±  0.247 s    [User: 36.404 s, System: 1.062 s]
  Range (min … max):    9.619 s …  9.969 s    2 runs
 
Summary
  hyper_threading_main threads: 8 ran
    1.02 ± 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 ± σ):      9.820 s ±  0.178 s    [User: 36.226 s, System: 1.176 s]
  Range (min … max):    9.694 s …  9.946 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):      9.793 s ±  0.126 s    [User: 36.591 s, System: 1.143 s]
  Range (min … max):    9.703 s …  9.882 s    2 runs
 
Summary
  hyper_threading_pr threads: 16 ran
    1.00 ± 0.02 times faster than hyper_threading_main threads: 16


@github-actions
Copy link

github-actions bot commented Aug 11, 2025

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.058 ± 0.011 2.050 2.087 1.00
head big_factorial 2.061 ± 0.013 2.048 2.094 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.000 ± 0.030 1.980 2.067 1.00 ± 0.02
head big_fibonacci 1.991 ± 0.028 1.970 2.044 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.047 ± 0.026 6.980 7.075 1.00
head blake2s_integration_benchmark 7.072 ± 0.082 7.004 7.271 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.114 ± 0.017 2.095 2.144 1.00 ± 0.01
head compare_arrays_200000 2.111 ± 0.016 2.095 2.155 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.399 ± 0.018 1.385 1.446 1.00
head dict_integration_benchmark 1.405 ± 0.018 1.390 1.450 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.174 ± 0.014 1.162 1.209 1.00
head field_arithmetic_get_square_benchmark 1.181 ± 0.013 1.171 1.213 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.146 ± 0.021 7.109 7.165 1.00
head integration_builtins 7.164 ± 0.028 7.119 7.225 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.227 ± 0.087 7.139 7.462 1.00
head keccak_integration_benchmark 7.258 ± 0.141 7.205 7.660 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.088 ± 0.015 2.075 2.121 1.00 ± 0.01
head linear_search 2.086 ± 0.016 2.073 2.131 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.473 ± 0.005 1.466 1.479 1.00 ± 0.00
head math_cmp_and_pow_integration_benchmark 1.470 ± 0.004 1.464 1.475 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.419 ± 0.004 1.409 1.426 1.00
head math_integration_benchmark 1.424 ± 0.005 1.415 1.431 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.190 ± 0.007 1.180 1.200 1.00 ± 0.01
head memory_integration_benchmark 1.188 ± 0.005 1.183 1.198 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.496 ± 0.003 1.491 1.499 1.00
head operations_with_data_structures_benchmarks 1.497 ± 0.005 1.488 1.506 1.00 ± 0.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 518.6 ± 0.6 517.8 519.9 1.00
head pedersen 518.8 ± 0.7 517.7 520.2 1.00 ± 0.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 593.0 ± 1.1 591.6 594.4 1.00 ± 0.00
head poseidon_integration_benchmark 593.0 ± 2.5 589.5 597.3 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.748 ± 0.006 1.740 1.757 1.00
head secp_integration_benchmark 1.750 ± 0.009 1.743 1.772 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 657.2 ± 9.1 646.0 666.2 1.00 ± 0.02
head set_integration_benchmark 655.4 ± 7.0 646.5 666.9 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.032 ± 0.015 4.014 4.055 1.00 ± 0.00
head uint256_integration_benchmark 4.027 ± 0.005 4.018 4.037 1.00

@codecov
Copy link

codecov bot commented Aug 11, 2025

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.67%. Comparing base (579c323) to head (36b563a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
vm/src/cairo_run.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2165   +/-   ##
=======================================
  Coverage   96.67%   96.67%           
=======================================
  Files         103      103           
  Lines       43990    44000   +10     
=======================================
+ Hits        42529    42539   +10     
  Misses       1461     1461           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JulianGCalderon JulianGCalderon force-pushed the enable-memory-comparisons branch 2 times, most recently from cb5f9a1 to 7b3f45d Compare August 12, 2025 13:31
@JulianGCalderon JulianGCalderon changed the base branch from starkware-development to main August 12, 2025 18:00
@JulianGCalderon JulianGCalderon force-pushed the enable-memory-comparisons branch from 7b3f45d to 259a79e Compare August 12, 2025 18:00
@JulianGCalderon JulianGCalderon marked this pull request as ready for review August 12, 2025 19:17
@JulianGCalderon JulianGCalderon added this pull request to the merge queue Aug 14, 2025
Merged via the queue into main with commit c6877af Aug 14, 2025
92 of 93 checks passed
@JulianGCalderon JulianGCalderon deleted the enable-memory-comparisons branch August 14, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add memory comparison tests after merging starkware-development branch

4 participants