Skip to content

Conversation

@YairVaknin-starkware
Copy link
Collaborator

@YairVaknin-starkware YairVaknin-starkware commented Mar 5, 2025

TITLE

Description

Description of the pull request changes and motivation.

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.
    • CHANGELOG has been updated.

This change is Reviewable

@YairVaknin-starkware YairVaknin-starkware force-pushed the yairv/enforce_disable_trace_padding_used_only_in_proof_mode branch from b96ae47 to b92d256 Compare March 5, 2025 17:35
@github-actions
Copy link

github-actions bot commented Mar 5, 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 ± σ):     26.009 s ±  0.016 s    [User: 25.238 s, System: 0.768 s]
  Range (min … max):   25.998 s … 26.020 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     26.107 s ±  0.048 s    [User: 25.355 s, System: 0.750 s]
  Range (min … max):   26.073 s … 26.141 s    2 runs
 
Summary
  hyper_threading_main threads: 1 ran
    1.00 ± 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.452 s ±  0.050 s    [User: 25.321 s, System: 0.793 s]
  Range (min … max):   14.417 s … 14.487 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.465 s ±  0.028 s    [User: 25.470 s, System: 0.788 s]
  Range (min … max):   14.445 s … 14.484 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 ± σ):     11.006 s ±  0.243 s    [User: 38.485 s, System: 0.935 s]
  Range (min … max):   10.834 s … 11.178 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.598 s ±  0.479 s    [User: 37.974 s, System: 0.928 s]
  Range (min … max):   10.259 s … 10.936 s    2 runs
 
Summary
  hyper_threading_pr threads: 4 ran
    1.04 ± 0.05 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.550 s ±  0.295 s    [User: 38.667 s, System: 0.960 s]
  Range (min … max):   10.342 s … 10.759 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.472 s ±  0.031 s    [User: 38.258 s, System: 0.955 s]
  Range (min … max):   10.451 s … 10.494 s    2 runs
 
Summary
  hyper_threading_pr threads: 6 ran
    1.01 ± 0.03 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 ± σ):     10.533 s ±  0.244 s    [User: 39.051 s, System: 0.943 s]
  Range (min … max):   10.361 s … 10.705 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.257 s ±  0.096 s    [User: 38.652 s, System: 0.932 s]
  Range (min … max):   10.190 s … 10.325 s    2 runs
 
Summary
  hyper_threading_pr threads: 8 ran
    1.03 ± 0.03 times faster than hyper_threading_main 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.361 s ±  0.062 s    [User: 39.156 s, System: 1.048 s]
  Range (min … max):   10.317 s … 10.405 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.247 s ±  0.055 s    [User: 38.825 s, System: 1.044 s]
  Range (min … max):   10.208 s … 10.286 s    2 runs
 
Summary
  hyper_threading_pr threads: 16 ran
    1.01 ± 0.01 times faster than hyper_threading_main threads: 16


@github-actions
Copy link

github-actions bot commented Mar 5, 2025

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.157 ± 0.028 2.132 2.231 1.01 ± 0.01
head big_factorial 2.132 ± 0.010 2.120 2.144 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.073 ± 0.020 2.040 2.100 1.00
head big_fibonacci 2.079 ± 0.025 2.049 2.134 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.824 ± 0.083 7.671 7.929 1.00 ± 0.03
head blake2s_integration_benchmark 7.805 ± 0.239 7.654 8.359 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.197 ± 0.027 2.174 2.261 1.00 ± 0.01
head compare_arrays_200000 2.195 ± 0.018 2.171 2.226 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.432 ± 0.009 1.418 1.444 1.01 ± 0.01
head dict_integration_benchmark 1.423 ± 0.009 1.413 1.442 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.245 ± 0.022 1.223 1.302 1.01 ± 0.02
head field_arithmetic_get_square_benchmark 1.232 ± 0.014 1.214 1.259 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.941 ± 0.339 7.737 8.877 1.02 ± 0.05
head integration_builtins 7.820 ± 0.119 7.740 8.139 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.165 ± 0.104 8.030 8.401 1.01 ± 0.02
head keccak_integration_benchmark 8.115 ± 0.064 8.014 8.195 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.215 ± 0.082 2.157 2.434 1.02 ± 0.04
head linear_search 2.181 ± 0.014 2.160 2.206 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.517 ± 0.008 1.504 1.530 1.00
head math_cmp_and_pow_integration_benchmark 1.532 ± 0.029 1.502 1.597 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.471 ± 0.013 1.457 1.503 1.01 ± 0.01
head math_integration_benchmark 1.451 ± 0.006 1.438 1.459 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.214 ± 0.008 1.205 1.229 1.00 ± 0.01
head memory_integration_benchmark 1.214 ± 0.009 1.207 1.239 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.576 ± 0.009 1.562 1.593 1.01 ± 0.01
head operations_with_data_structures_benchmarks 1.563 ± 0.007 1.549 1.569 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 535.8 ± 3.5 532.8 543.1 1.00
head pedersen 537.2 ± 2.7 533.6 541.9 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 629.9 ± 4.3 621.8 636.0 1.00
head poseidon_integration_benchmark 630.9 ± 2.8 625.5 634.6 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.872 ± 0.019 1.852 1.917 1.00
head secp_integration_benchmark 1.876 ± 0.015 1.860 1.910 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 665.6 ± 6.1 656.8 676.8 1.00
head set_integration_benchmark 675.9 ± 2.5 671.3 679.6 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.291 ± 0.050 4.237 4.390 1.01 ± 0.01
head uint256_integration_benchmark 4.254 ± 0.033 4.211 4.299 1.00

@YairVaknin-starkware YairVaknin-starkware force-pushed the yairv/enforce_disable_trace_padding_used_only_in_proof_mode branch from b92d256 to 46c82e6 Compare March 5, 2025 18:58
@codecov
Copy link

codecov bot commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.53%. Comparing base (7278ee0) to head (708987e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
vm/src/vm/runners/cairo_runner.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1984      +/-   ##
==========================================
- Coverage   96.53%   96.53%   -0.01%     
==========================================
  Files         103      103              
  Lines       42599    42612      +13     
==========================================
+ Hits        41123    41135      +12     
- Misses       1476     1477       +1     

☔ 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.

Copy link
Collaborator

@yuvalsw yuvalsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @fmoletta, @gabrielbosio, @igaray, @juanbono, @OmriEshhar1, @Oppen, and @pefontana)


vm/src/tests/cairo_run_test.rs line 1038 at r1 (raw file):

    let mut hint_processor = BuiltinHintProcessor::new_empty();
    let runner = cairo_run(program_data, &config, &mut hint_processor).unwrap();
    assert!(!runner.vm.current_step.is_power_of_two());
  1. I don't understand how this is equivalent to the previous check you deleted.
  2. it is not guaranteed to not be a power of 2. Add a comment saying this is true for this proof specifically (assuming I am right about it).

vm/src/vm/runners/cairo_runner.rs line 5416 at r1 (raw file):

            Err(RunnerError::DisableTracePaddingWithoutProofMode) => { /* test passed */ }
            _ => panic!("Expected DisableTracePaddingWithoutProofMode error"),
        }

consider (will also probably dismiss the codecov failure)

Suggestion:

        assert_eq!(result, Err(RunnerError::DisableTracePaddingWithoutProofMode), "Expected DisableTracePaddingWithoutProofMode error");

@YairVaknin-starkware YairVaknin-starkware force-pushed the yairv/enforce_disable_trace_padding_used_only_in_proof_mode branch from 46c82e6 to 6b89371 Compare March 9, 2025 16:56
Copy link
Collaborator Author

@YairVaknin-starkware YairVaknin-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @fmoletta, @gabrielbosio, @igaray, @juanbono, @OmriEshhar1, @Oppen, @pefontana, and @yuvalsw)


vm/src/tests/cairo_run_test.rs line 1038 at r1 (raw file):

Previously, yuvalsw wrote…
  1. I don't understand how this is equivalent to the previous check you deleted.
  2. it is not guaranteed to not be a power of 2. Add a comment saying this is true for this proof specifically (assuming I am right about it).
  1. it's not. the prev test didn't really test anything and especially not what its name implies. It didn't even run in proof mode (which with the change introduced in this PR will fail).
  2. Correct. Done.

vm/src/vm/runners/cairo_runner.rs line 5416 at r1 (raw file):

Previously, yuvalsw wrote…

consider (will also probably dismiss the codecov failure)

Was my first approach, too, but the CairoRunner struct doesn't impl Debug, and it would require deriving it for many structs that are internally used by the Runner struct just for that for this approach to work.

@edg-l edg-l requested a review from noaov1 as a code owner March 10, 2025 10:11
@edg-l edg-l enabled auto-merge March 10, 2025 11:30
@edg-l edg-l added this pull request to the merge queue Mar 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Mar 10, 2025
@YairVaknin-starkware YairVaknin-starkware force-pushed the yairv/enforce_disable_trace_padding_used_only_in_proof_mode branch from 3605efc to 708987e Compare March 10, 2025 14:02
@YairVaknin-starkware YairVaknin-starkware added this pull request to the merge queue Mar 10, 2025
Merged via the queue into main with commit c71b496 Mar 10, 2025
92 of 93 checks passed
@YairVaknin-starkware YairVaknin-starkware deleted the yairv/enforce_disable_trace_padding_used_only_in_proof_mode branch March 10, 2025 14:59
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.

4 participants