Skip to content

Fix WRITE_DIVMOD_SEGMENT hint #2078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 6, 2025
Merged

Fix WRITE_DIVMOD_SEGMENT hint #2078

merged 5 commits into from
May 6, 2025

Conversation

JulianGCalderon
Copy link
Contributor

Fix WRITE_DIVMOD_SEGMENT hint

We were using SECP_P prime instead of PRIME, as indicated by the hint code.

Additionally, I refactored the hint logic to:

  • Return an error variant instead of an assert.
  • Improve legibility.

Copy link

github-actions bot commented Apr 28, 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.360 s ±  0.038 s    [User: 25.525 s, System: 0.832 s]
  Range (min … max):   26.333 s … 26.386 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     26.192 s ±  0.028 s    [User: 25.392 s, System: 0.796 s]
  Range (min … max):   26.172 s … 26.212 s    2 runs
 
Summary
  hyper_threading_pr threads: 1 ran
    1.01 ± 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 ± σ):     14.634 s ±  0.066 s    [User: 25.640 s, System: 0.813 s]
  Range (min … max):   14.587 s … 14.681 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.536 s ±  0.014 s    [User: 25.437 s, System: 0.808 s]
  Range (min … max):   14.527 s … 14.546 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.446 s ±  0.126 s    [User: 37.607 s, System: 1.001 s]
  Range (min … max):   10.356 s … 10.535 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.556 s ±  0.226 s    [User: 37.510 s, System: 0.970 s]
  Range (min … max):   10.396 s … 10.716 s    2 runs
 
Summary
  hyper_threading_main threads: 4 ran
    1.01 ± 0.02 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 ± σ):     10.243 s ±  0.271 s    [User: 38.076 s, System: 1.014 s]
  Range (min … max):   10.051 s … 10.435 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.555 s ±  0.016 s    [User: 38.136 s, System: 1.018 s]
  Range (min … max):   10.544 s … 10.566 s    2 runs
 
Summary
  hyper_threading_main threads: 6 ran
    1.03 ± 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.415 s ±  0.219 s    [User: 37.709 s, System: 1.007 s]
  Range (min … max):   10.260 s … 10.569 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.213 s ±  0.009 s    [User: 38.374 s, System: 1.011 s]
  Range (min … max):   10.207 s … 10.220 s    2 runs
 
Summary
  hyper_threading_pr threads: 8 ran
    1.02 ± 0.02 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.562 s ±  0.058 s    [User: 38.223 s, System: 1.100 s]
  Range (min … max):   10.521 s … 10.603 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.164 s ±  0.055 s    [User: 38.420 s, System: 1.124 s]
  Range (min … max):   10.125 s … 10.202 s    2 runs
 
Summary
  hyper_threading_pr threads: 16 ran
    1.04 ± 0.01 times faster than hyper_threading_main threads: 16


Copy link

github-actions bot commented Apr 28, 2025

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.136 ± 0.009 2.124 2.151 1.00 ± 0.01
head big_factorial 2.128 ± 0.013 2.109 2.150 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.055 ± 0.008 2.041 2.065 1.00
head big_fibonacci 2.060 ± 0.021 2.044 2.110 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.589 ± 0.034 7.546 7.639 1.00 ± 0.01
head blake2s_integration_benchmark 7.580 ± 0.063 7.541 7.752 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.217 ± 0.015 2.203 2.254 1.00
head compare_arrays_200000 2.220 ± 0.022 2.203 2.256 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.455 ± 0.014 1.441 1.488 1.00 ± 0.02
head dict_integration_benchmark 1.453 ± 0.019 1.437 1.499 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.231 ± 0.003 1.224 1.234 1.00
head field_arithmetic_get_square_benchmark 1.235 ± 0.011 1.226 1.262 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.665 ± 0.035 7.589 7.707 1.00
head integration_builtins 7.679 ± 0.102 7.616 7.958 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.919 ± 0.096 7.865 8.188 1.01 ± 0.01
head keccak_integration_benchmark 7.871 ± 0.023 7.835 7.906 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.208 ± 0.057 2.177 2.368 1.01 ± 0.03
head linear_search 2.180 ± 0.007 2.168 2.193 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.548 ± 0.021 1.532 1.606 1.00 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.543 ± 0.019 1.524 1.580 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.486 ± 0.012 1.475 1.518 1.00 ± 0.01
head math_integration_benchmark 1.484 ± 0.004 1.481 1.492 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.235 ± 0.018 1.226 1.287 1.00
head memory_integration_benchmark 1.239 ± 0.028 1.220 1.318 1.00 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.595 ± 0.006 1.588 1.608 1.00 ± 0.00
head operations_with_data_structures_benchmarks 1.594 ± 0.004 1.589 1.601 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 537.3 ± 1.5 535.4 539.2 1.00 ± 0.00
head pedersen 535.5 ± 1.6 532.8 538.0 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 651.5 ± 3.2 645.8 654.6 1.00 ± 0.01
head poseidon_integration_benchmark 650.4 ± 3.4 644.8 654.6 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.885 ± 0.016 1.870 1.921 1.01 ± 0.01
head secp_integration_benchmark 1.872 ± 0.007 1.865 1.889 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 633.2 ± 5.8 629.2 649.3 1.00 ± 0.01
head set_integration_benchmark 630.6 ± 1.6 628.1 632.6 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.244 ± 0.016 4.221 4.270 1.00 ± 0.01
head uint256_integration_benchmark 4.244 ± 0.016 4.216 4.267 1.00

Copy link

codecov bot commented Apr 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.58%. Comparing base (f2b63ff) to head (937fe62).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2078   +/-   ##
=======================================
  Coverage   96.58%   96.58%           
=======================================
  Files         102      102           
  Lines       42924    42924           
=======================================
  Hits        41456    41456           
  Misses       1468     1468           

☔ 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 marked this pull request as ready for review May 5, 2025 15:17
@gabrielbosio gabrielbosio added this pull request to the merge queue May 6, 2025
Merged via the queue into main with commit 10b3dd9 May 6, 2025
94 checks passed
@gabrielbosio gabrielbosio deleted the fix-hint branch May 6, 2025 21:51
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.

3 participants