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 SECP hints required for k1 and r1 curves #41

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

whichqua
Copy link

@whichqua whichqua commented Aug 6, 2024

Implement SECP hints required for k1 and r1 curves

Problem: Secp hints are not defined
Solution: Implement them all

Description

This PR implements secp256(k1|r1) hint processing functions and their unit tests in the Cairo VM

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 Aug 6, 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 ± σ):     25.958 s ±  0.021 s    [User: 25.202 s, System: 0.754 s]
  Range (min … max):   25.943 s … 25.973 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     26.471 s ±  0.003 s    [User: 25.728 s, System: 0.742 s]
  Range (min … max):   26.469 s … 26.473 s    2 runs
 
Summary
  'hyper_threading_main threads: 1' ran
    1.02 ± 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.897 s ±  0.249 s    [User: 25.969 s, System: 0.817 s]
  Range (min … max):   14.721 s … 15.074 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     15.056 s ±  0.027 s    [User: 26.314 s, System: 0.750 s]
  Range (min … max):   15.037 s … 15.074 s    2 runs
 
Summary
  'hyper_threading_main threads: 2' ran
    1.01 ± 0.02 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.475 s ±  0.266 s    [User: 37.213 s, System: 0.960 s]
  Range (min … max):   10.287 s … 10.662 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.693 s ±  0.434 s    [User: 38.393 s, System: 0.922 s]
  Range (min … max):   10.386 s … 11.000 s    2 runs
 
Summary
  'hyper_threading_main threads: 4' ran
    1.02 ± 0.05 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.209 s ±  0.191 s    [User: 37.686 s, System: 0.993 s]
  Range (min … max):   10.074 s … 10.344 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.556 s ±  0.363 s    [User: 38.323 s, System: 0.992 s]
  Range (min … max):   10.300 s … 10.813 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 ± σ):     10.429 s ±  0.282 s    [User: 37.730 s, System: 0.916 s]
  Range (min … max):   10.230 s … 10.629 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.478 s ±  0.142 s    [User: 38.246 s, System: 0.997 s]
  Range (min … max):   10.377 s … 10.578 s    2 runs
 
Summary
  'hyper_threading_main threads: 8' ran
    1.00 ± 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 ± σ):     10.281 s ±  0.138 s    [User: 37.836 s, System: 1.056 s]
  Range (min … max):   10.183 s … 10.379 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.376 s ±  0.249 s    [User: 38.681 s, System: 1.135 s]
  Range (min … max):   10.200 s … 10.552 s    2 runs
 
Summary
  'hyper_threading_main threads: 16' ran
    1.01 ± 0.03 times faster than 'hyper_threading_pr threads: 16'


Copy link

github-actions bot commented Aug 6, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.035 ± 0.019 2.008 2.060 1.00
head big_factorial 2.087 ± 0.036 2.069 2.187 1.03 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 1.983 ± 0.021 1.960 2.016 1.00
head big_fibonacci 2.017 ± 0.005 2.010 2.023 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.489 ± 0.162 7.269 7.654 1.00
head blake2s_integration_benchmark 7.639 ± 0.113 7.490 7.790 1.02 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.105 ± 0.031 2.076 2.162 1.00
head compare_arrays_200000 2.164 ± 0.040 2.139 2.257 1.03 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.413 ± 0.021 1.392 1.466 1.00
head dict_integration_benchmark 1.436 ± 0.030 1.418 1.503 1.02 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.194 ± 0.014 1.173 1.215 1.00
head field_arithmetic_get_square_benchmark 1.224 ± 0.020 1.204 1.259 1.02 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.574 ± 0.135 7.408 7.708 1.00
head integration_builtins 7.719 ± 0.098 7.578 7.857 1.02 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.963 ± 0.592 7.555 9.540 1.00
head keccak_integration_benchmark 8.129 ± 0.491 7.761 9.340 1.02 ± 0.10
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.110 ± 0.066 2.060 2.293 1.00
head linear_search 2.160 ± 0.070 2.124 2.358 1.02 ± 0.05
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.475 ± 0.011 1.459 1.492 1.00
head math_cmp_and_pow_integration_benchmark 1.495 ± 0.025 1.474 1.563 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.433 ± 0.022 1.412 1.489 1.00
head math_integration_benchmark 1.452 ± 0.028 1.434 1.530 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.183 ± 0.024 1.167 1.249 1.00
head memory_integration_benchmark 1.191 ± 0.003 1.184 1.197 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.539 ± 0.013 1.522 1.560 1.00
head operations_with_data_structures_benchmarks 1.578 ± 0.038 1.543 1.636 1.02 ± 0.03
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 525.4 ± 10.2 518.2 552.9 1.00 ± 0.02
head pedersen 523.3 ± 0.9 521.9 524.2 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 755.8 ± 4.5 749.0 762.8 1.00
head poseidon_integration_benchmark 759.4 ± 2.1 757.3 764.1 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.811 ± 0.038 1.787 1.906 1.01 ± 0.03
head secp_integration_benchmark 1.791 ± 0.036 1.770 1.888 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 635.7 ± 2.4 631.4 639.4 1.00 ± 0.01
head set_integration_benchmark 634.5 ± 7.2 630.3 654.6 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.139 ± 0.065 4.071 4.249 1.00
head uint256_integration_benchmark 4.235 ± 0.081 4.157 4.429 1.02 ± 0.03

@whichqua whichqua force-pushed the gm/secp-hints-rc5 branch 2 times, most recently from 35a9fc7 to 2c12c1f Compare August 12, 2024 14:35
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.

2 participants