Skip to content
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

bugfix: Don't assume outer deref when fetching integer values from references #1732

Merged
merged 12 commits into from
Apr 26, 2024

Conversation

fmoletta
Copy link
Member

@fmoletta fmoletta commented Apr 25, 2024

Refactors handling of references in hint_processor_utils module, as previous implementation assumed that references to felt values would always have outer dereferences. No changes have been made to the public api of these methods.
The HintError variants WrongIdentifierTypeInternal, IdentifierNotRelocatable & IdentifierNotInteger no longer show the address of the ids, as ids don't necessarily have an address, as is the case of references without outer deref.

@fmoletta fmoletta changed the title [WIP] Refactor reference handles to not asume outer deref for integer variables [WIP] Refactor reference handling to not asume outer deref for integer variables Apr 25, 2024
@fmoletta fmoletta changed the title [WIP] Refactor reference handling to not asume outer deref for integer variables [WIP] bugfix: Don't asume outer deref when fetching integer values from references Apr 25, 2024
Copy link

github-actions bot commented Apr 25, 2024

**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.060 s ±  0.094 s    [User: 25.344 s, System: 0.714 s]
  Range (min … max):   25.993 s … 26.126 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     30.277 s ±  0.039 s    [User: 29.595 s, System: 0.680 s]
  Range (min … max):   30.250 s … 30.305 s    2 runs
 
Summary
  'hyper_threading_main threads: 1' ran
    1.16 ± 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.804 s ±  0.012 s    [User: 25.624 s, System: 0.716 s]
  Range (min … max):   13.796 s … 13.813 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     16.207 s ±  0.049 s    [User: 29.905 s, System: 0.705 s]
  Range (min … max):   16.173 s … 16.242 s    2 runs
 
Summary
  'hyper_threading_main threads: 2' ran
    1.17 ± 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 ± σ):     10.848 s ±  0.144 s    [User: 38.401 s, System: 0.925 s]
  Range (min … max):   10.746 s … 10.950 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     12.019 s ±  0.086 s    [User: 41.459 s, System: 0.937 s]
  Range (min … max):   11.958 s … 12.079 s    2 runs
 
Summary
  'hyper_threading_main threads: 4' ran
    1.11 ± 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.474 s ±  0.121 s    [User: 38.941 s, System: 0.919 s]
  Range (min … max):   10.388 s … 10.559 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     11.546 s ±  0.352 s    [User: 41.685 s, System: 0.957 s]
  Range (min … max):   11.297 s … 11.795 s    2 runs
 
Summary
  'hyper_threading_main threads: 6' ran
    1.10 ± 0.04 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.442 s ±  0.173 s    [User: 39.073 s, System: 0.934 s]
  Range (min … max):   10.320 s … 10.564 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     11.304 s ±  0.010 s    [User: 42.062 s, System: 1.021 s]
  Range (min … max):   11.297 s … 11.311 s    2 runs
 
Summary
  'hyper_threading_main threads: 8' ran
    1.08 ± 0.02 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.484 s ±  0.125 s    [User: 39.309 s, System: 1.098 s]
  Range (min … max):   10.395 s … 10.572 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     11.388 s ±  0.264 s    [User: 42.222 s, System: 1.056 s]
  Range (min … max):   11.201 s … 11.575 s    2 runs
 
Summary
  'hyper_threading_main threads: 16' ran
    1.09 ± 0.03 times faster than 'hyper_threading_pr threads: 16'


Copy link

github-actions bot commented Apr 25, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.091 ± 0.094 2.036 2.347 1.00
head big_factorial 2.378 ± 0.045 2.348 2.468 1.14 ± 0.06
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.089 ± 0.071 2.048 2.287 1.00
head big_fibonacci 2.327 ± 0.013 2.310 2.345 1.11 ± 0.04
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.090 ± 0.040 7.042 7.182 1.00
head blake2s_integration_benchmark 8.897 ± 0.328 8.647 9.728 1.25 ± 0.05
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.119 ± 0.042 2.085 2.235 1.00
head compare_arrays_200000 2.404 ± 0.009 2.392 2.420 1.13 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.389 ± 0.013 1.371 1.408 1.00
head dict_integration_benchmark 1.552 ± 0.020 1.535 1.603 1.12 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.259 ± 0.024 1.232 1.308 1.00
head field_arithmetic_get_square_benchmark 1.430 ± 0.006 1.421 1.441 1.14 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.244 ± 0.050 7.164 7.342 1.00
head integration_builtins 8.699 ± 0.060 8.644 8.791 1.20 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.349 ± 0.033 7.311 7.418 1.00
head keccak_integration_benchmark 8.957 ± 0.071 8.882 9.104 1.22 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.167 ± 0.015 2.144 2.186 1.00
head linear_search 2.445 ± 0.035 2.415 2.525 1.13 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.776 ± 0.016 1.763 1.806 1.00
head math_cmp_and_pow_integration_benchmark 1.894 ± 0.012 1.886 1.925 1.07 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.580 ± 0.013 1.565 1.608 1.00
head math_integration_benchmark 1.696 ± 0.004 1.689 1.702 1.07 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.211 ± 0.016 1.196 1.251 1.00
head memory_integration_benchmark 1.339 ± 0.003 1.335 1.345 1.11 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.863 ± 0.036 1.833 1.952 1.00
head operations_with_data_structures_benchmarks 1.970 ± 0.007 1.963 1.982 1.06 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 531.8 ± 7.4 525.2 551.2 1.00
head pedersen 560.6 ± 3.4 557.5 567.4 1.05 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 969.5 ± 4.2 964.4 976.1 1.00
head poseidon_integration_benchmark 991.7 ± 5.4 983.0 997.8 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.841 ± 0.009 1.830 1.853 1.00
head secp_integration_benchmark 2.001 ± 0.010 1.989 2.014 1.09 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 697.0 ± 7.5 690.3 711.2 1.00
head set_integration_benchmark 729.4 ± 2.2 725.9 732.7 1.05 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.101 ± 0.033 4.054 4.144 1.00
head uint256_integration_benchmark 4.801 ± 0.029 4.763 4.842 1.17 ± 0.01

@fmoletta fmoletta changed the title [WIP] bugfix: Don't asume outer deref when fetching integer values from references bugfix: Don't assume outer deref when fetching integer values from references Apr 25, 2024
Copy link

codecov bot commented Apr 25, 2024

Codecov Report

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

Project coverage is 94.82%. Comparing base (c5839fd) to head (3e48bb8).

Files Patch % Lines
vm/src/hint_processor/hint_processor_utils.rs 96.84% 3 Missing ⚠️
...int_processor/builtin_hint_processor/hint_utils.rs 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1732      +/-   ##
==========================================
+ Coverage   94.80%   94.82%   +0.01%     
==========================================
  Files         101      101              
  Lines       38719    38712       -7     
==========================================
+ Hits        36709    36710       +1     
+ Misses       2010     2002       -8     

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

@fmoletta fmoletta marked this pull request as ready for review April 25, 2024 17:59
@pefontana pefontana added this pull request to the merge queue Apr 26, 2024
Merged via the queue into main with commit 59840b3 Apr 26, 2024
71 checks passed
@pefontana pefontana deleted the get-integer-from-var-name-no-outer-defer branch April 26, 2024 23:29
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.

None yet

3 participants