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

Implement TestLessThanOrEqualAddress y EvalCircuit Hints #1843

Merged
merged 41 commits into from
Nov 19, 2024
Merged

Conversation

FrancoGiachetta
Copy link
Contributor

@FrancoGiachetta FrancoGiachetta commented Sep 19, 2024

Implement TestLessThanOrEqual y EvalCircuit Hints

Description

This PR adds the implementations for EvalCircuit and TestLessThanOrEqual hints.

Relates to #1836

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.

Copy link

github-actions bot commented Sep 19, 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 ± σ):     31.934 s ±  0.043 s    [User: 31.097 s, System: 0.836 s]
  Range (min … max):   31.904 s … 31.965 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     33.021 s ±  0.119 s    [User: 32.218 s, System: 0.802 s]
  Range (min … max):   32.938 s … 33.105 s    2 runs
 
Summary
  'hyper_threading_main threads: 1' ran
    1.03 ± 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 ± σ):     17.775 s ±  0.013 s    [User: 30.985 s, System: 0.844 s]
  Range (min … max):   17.766 s … 17.784 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     17.733 s ±  0.024 s    [User: 30.867 s, System: 0.840 s]
  Range (min … max):   17.717 s … 17.750 s    2 runs
 
Summary
  'hyper_threading_pr threads: 2' ran
    1.00 ± 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 ± σ):     12.054 s ±  0.387 s    [User: 43.393 s, System: 0.989 s]
  Range (min … max):   11.781 s … 12.328 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     12.226 s ±  0.290 s    [User: 43.560 s, System: 1.022 s]
  Range (min … max):   12.021 s … 12.431 s    2 runs
 
Summary
  'hyper_threading_main threads: 4' ran
    1.01 ± 0.04 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 ± σ):     12.044 s ±  0.215 s    [User: 43.248 s, System: 1.051 s]
  Range (min … max):   11.892 s … 12.196 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     12.384 s ±  0.376 s    [User: 44.019 s, System: 0.998 s]
  Range (min … max):   12.118 s … 12.649 s    2 runs
 
Summary
  'hyper_threading_main threads: 6' ran
    1.03 ± 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 ± σ):     12.152 s ±  0.017 s    [User: 43.747 s, System: 1.103 s]
  Range (min … max):   12.140 s … 12.164 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     11.994 s ±  0.424 s    [User: 44.521 s, System: 1.078 s]
  Range (min … max):   11.694 s … 12.294 s    2 runs
 
Summary
  'hyper_threading_pr threads: 8' ran
    1.01 ± 0.04 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 ± σ):     11.775 s ±  0.071 s    [User: 44.213 s, System: 1.117 s]
  Range (min … max):   11.725 s … 11.826 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     12.037 s ±  0.277 s    [User: 44.622 s, System: 1.051 s]
  Range (min … max):   11.842 s … 12.233 s    2 runs
 
Summary
  'hyper_threading_main threads: 16' ran
    1.02 ± 0.02 times faster than 'hyper_threading_pr threads: 16'


Copy link

github-actions bot commented Sep 19, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.474 ± 0.032 2.443 2.546 1.00 ± 0.03
head big_factorial 2.474 ± 0.068 2.438 2.661 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.433 ± 0.035 2.398 2.516 1.00 ± 0.02
head big_fibonacci 2.430 ± 0.022 2.404 2.468 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 9.092 ± 0.154 8.956 9.497 1.00
head blake2s_integration_benchmark 9.103 ± 0.063 8.993 9.179 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.549 ± 0.052 2.510 2.674 1.00
head compare_arrays_200000 2.563 ± 0.033 2.514 2.635 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.722 ± 0.047 1.679 1.841 1.03 ± 0.04
head dict_integration_benchmark 1.680 ± 0.046 1.633 1.786 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.435 ± 0.009 1.423 1.452 1.02 ± 0.01
head field_arithmetic_get_square_benchmark 1.411 ± 0.014 1.400 1.450 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 9.193 ± 0.049 9.076 9.240 1.00 ± 0.01
head integration_builtins 9.186 ± 0.089 9.050 9.330 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 9.523 ± 0.098 9.419 9.739 1.00
head keccak_integration_benchmark 9.612 ± 0.454 9.325 10.840 1.01 ± 0.05
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.538 ± 0.033 2.510 2.622 1.00
head linear_search 2.564 ± 0.091 2.501 2.790 1.01 ± 0.04
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.740 ± 0.014 1.719 1.753 1.00 ± 0.04
head math_cmp_and_pow_integration_benchmark 1.740 ± 0.060 1.698 1.891 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.701 ± 0.023 1.677 1.760 1.01 ± 0.03
head math_integration_benchmark 1.686 ± 0.042 1.643 1.760 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.417 ± 0.011 1.399 1.429 1.00
head memory_integration_benchmark 1.418 ± 0.015 1.396 1.437 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.823 ± 0.021 1.799 1.866 1.02 ± 0.02
head operations_with_data_structures_benchmarks 1.787 ± 0.021 1.765 1.823 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 592.2 ± 7.4 585.5 608.4 1.01 ± 0.02
head pedersen 584.5 ± 11.4 576.9 608.6 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 684.9 ± 6.1 676.7 695.7 1.00
head poseidon_integration_benchmark 693.7 ± 13.2 678.2 719.7 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.091 ± 0.032 2.059 2.155 1.02 ± 0.02
head secp_integration_benchmark 2.051 ± 0.011 2.037 2.073 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 697.2 ± 5.1 692.2 710.9 1.06 ± 0.01
head set_integration_benchmark 658.2 ± 4.4 653.1 666.6 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 5.081 ± 0.118 5.019 5.415 1.01 ± 0.03
head uint256_integration_benchmark 5.023 ± 0.120 4.967 5.362 1.00

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 94.73684% with 14 lines in your changes missing coverage. Please review.

Project coverage is 96.33%. Comparing base (be5cb9a) to head (22491eb).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...c/hint_processor/cairo_1_hint_processor/circuit.rs 94.60% 11 Missing ⚠️
...processor/cairo_1_hint_processor/hint_processor.rs 93.33% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #1843    +/-   ##
========================================
  Coverage   96.33%   96.33%            
========================================
  Files         102      102            
  Lines       40426    40687   +261     
========================================
+ Hits        38943    39195   +252     
- Misses       1483     1492     +9     

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


🚨 Try these New Features:

@FrancoGiachetta FrancoGiachetta changed the title Implement TestLessThanOrEqual y EvalCircuit Hints Implement TestLessThanOrEqualAddress y EvalCircuit Hints Sep 30, 2024
@FrancoGiachetta FrancoGiachetta marked this pull request as ready for review October 1, 2024 12:50
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@JulianGCalderon JulianGCalderon left a comment

Choose a reason for hiding this comment

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

The implementation looks OK but there are quite a few unwraps. We should review them.

@FrancoGiachetta
Copy link
Contributor Author

No panics left now.

@pefontana pefontana added this pull request to the merge queue Nov 19, 2024
@pefontana pefontana removed this pull request from the merge queue due to a manual request Nov 19, 2024
@pefontana pefontana added this pull request to the merge queue Nov 19, 2024
Merged via the queue into main with commit 1e2d042 Nov 19, 2024
72 of 73 checks passed
@pefontana pefontana deleted the new-hints branch November 19, 2024 19:52
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