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

Ohadn/qm31 operations #1938

Open
wants to merge 1 commit into
base: ohadn/qm31_arithmetics-in-math_utils
Choose a base branch
from

Conversation

ohad-nir-starkware
Copy link
Collaborator

QM31Operations

Description

add packed reduced qm31 add, mul, sub, div via OpcodeExtension::QM31Operations.

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.

Copy link

github-actions bot commented Feb 9, 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 ± σ):     32.429 s ±  0.198 s    [User: 31.652 s, System: 0.775 s]
  Range (min … max):   32.289 s … 32.569 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     26.967 s ±  0.064 s    [User: 26.195 s, System: 0.771 s]
  Range (min … max):   26.922 s … 27.012 s    2 runs
 
Summary
  hyper_threading_pr threads: 1 ran
    1.20 ± 0.01 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 ± σ):     18.087 s ±  0.061 s    [User: 31.547 s, System: 0.782 s]
  Range (min … max):   18.044 s … 18.130 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.955 s ±  0.063 s    [User: 26.302 s, System: 0.806 s]
  Range (min … max):   14.911 s … 15.000 s    2 runs
 
Summary
  hyper_threading_pr threads: 2 ran
    1.21 ± 0.01 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.651 s ±  0.305 s    [User: 44.151 s, System: 0.950 s]
  Range (min … max):   12.435 s … 12.867 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.975 s ±  0.555 s    [User: 39.528 s, System: 0.997 s]
  Range (min … max):   10.583 s … 11.367 s    2 runs
 
Summary
  hyper_threading_pr threads: 4 ran
    1.15 ± 0.06 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 ± σ):     12.156 s ±  0.302 s    [User: 44.754 s, System: 0.933 s]
  Range (min … max):   11.943 s … 12.370 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     11.098 s ±  0.005 s    [User: 39.360 s, System: 0.977 s]
  Range (min … max):   11.095 s … 11.102 s    2 runs
 
Summary
  hyper_threading_pr threads: 6 ran
    1.10 ± 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 ± σ):     11.969 s ±  0.055 s    [User: 44.627 s, System: 1.007 s]
  Range (min … max):   11.929 s … 12.008 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.639 s ±  0.001 s    [User: 40.056 s, System: 0.991 s]
  Range (min … max):   10.639 s … 10.640 s    2 runs
 
Summary
  hyper_threading_pr threads: 8 ran
    1.12 ± 0.01 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 ± σ):     12.368 s ±  0.060 s    [User: 44.776 s, System: 1.110 s]
  Range (min … max):   12.325 s … 12.410 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.801 s ±  0.172 s    [User: 40.147 s, System: 1.108 s]
  Range (min … max):   10.680 s … 10.923 s    2 runs
 
Summary
  hyper_threading_pr threads: 16 ran
    1.15 ± 0.02 times faster than hyper_threading_main threads: 16


@ohad-nir-starkware ohad-nir-starkware changed the base branch from main to ohadn/opcode_extension February 9, 2025 19:17
Copy link

github-actions bot commented Feb 9, 2025

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.229 ± 0.049 2.195 2.358 1.01 ± 0.03
head big_factorial 2.213 ± 0.035 2.181 2.306 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.188 ± 0.021 2.159 2.226 1.01 ± 0.02
head big_fibonacci 2.172 ± 0.031 2.129 2.246 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.498 ± 0.156 8.226 8.711 1.03 ± 0.03
head blake2s_integration_benchmark 8.269 ± 0.167 8.097 8.644 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.311 ± 0.026 2.283 2.355 1.01 ± 0.02
head compare_arrays_200000 2.279 ± 0.034 2.234 2.356 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.502 ± 0.011 1.491 1.531 1.02 ± 0.01
head dict_integration_benchmark 1.470 ± 0.007 1.462 1.486 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.302 ± 0.022 1.280 1.353 1.00 ± 0.03
head field_arithmetic_get_square_benchmark 1.299 ± 0.038 1.267 1.384 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.464 ± 0.144 8.251 8.656 1.01 ± 0.02
head integration_builtins 8.349 ± 0.067 8.200 8.412 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.808 ± 0.159 8.525 8.963 1.02 ± 0.03
head keccak_integration_benchmark 8.636 ± 0.168 8.456 9.036 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.304 ± 0.013 2.280 2.322 1.02 ± 0.01
head linear_search 2.268 ± 0.015 2.253 2.307 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.606 ± 0.031 1.580 1.677 1.03 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.553 ± 0.014 1.540 1.587 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.528 ± 0.033 1.510 1.621 1.02 ± 0.03
head math_integration_benchmark 1.505 ± 0.026 1.492 1.579 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.275 ± 0.027 1.257 1.345 1.03 ± 0.02
head memory_integration_benchmark 1.243 ± 0.009 1.236 1.266 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.641 ± 0.007 1.632 1.657 1.02 ± 0.01
head operations_with_data_structures_benchmarks 1.616 ± 0.007 1.606 1.626 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 550.7 ± 8.5 546.4 574.8 1.01 ± 0.02
head pedersen 543.6 ± 1.4 541.3 546.1 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 648.2 ± 6.3 636.8 658.8 1.01 ± 0.01
head poseidon_integration_benchmark 641.5 ± 4.7 636.5 652.1 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.924 ± 0.012 1.908 1.943 1.01 ± 0.01
head secp_integration_benchmark 1.907 ± 0.013 1.886 1.934 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 664.0 ± 1.8 660.9 666.9 1.01 ± 0.00
head set_integration_benchmark 657.8 ± 2.4 655.9 664.4 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.593 ± 0.081 4.450 4.687 1.01 ± 0.02
head uint256_integration_benchmark 4.531 ± 0.027 4.478 4.560 1.00

Copy link

codecov bot commented Feb 9, 2025

Codecov Report

Attention: Patch coverage is 98.24561% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.39%. Comparing base (ee011aa) to head (985a24b).

Files with missing lines Patch % Lines
vm/src/vm/decoding/decoder.rs 94.11% 1 Missing ⚠️
vm/src/vm/vm_core.rs 98.96% 1 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                          @@
##           ohadn/qm31_arithmetics-in-math_utils    #1938   +/-   ##
=====================================================================
  Coverage                                 96.39%   96.39%           
=====================================================================
  Files                                       102      102           
  Lines                                     41531    41628   +97     
=====================================================================
+ Hits                                      40033    40128   +95     
- Misses                                     1498     1500    +2     

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

@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/qm31_operations branch 2 times, most recently from efdb5e3 to 6dd3870 Compare February 10, 2025 17:30
@ohad-nir-starkware ohad-nir-starkware changed the base branch from ohadn/opcode_extension to ohadn/u128_encoded_instr February 10, 2025 17:38
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/qm31_operations branch 3 times, most recently from b4da427 to eb339d8 Compare February 10, 2025 18:50
@ohad-nir-starkware ohad-nir-starkware changed the base branch from ohadn/u128_encoded_instr to ohadn/qm31_arithmetics-in-math_utils February 10, 2025 18:51
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/qm31_arithmetics-in-math_utils branch from d6d9a96 to d1f230b Compare February 10, 2025 21:47
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/qm31_arithmetics-in-math_utils branch from d1f230b to 4bca3db Compare February 11, 2025 11:50
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/qm31_arithmetics-in-math_utils branch from 4bca3db to ea9f93f Compare February 12, 2025 08:07
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/qm31_operations branch 3 times, most recently from c9356e0 to c13233c Compare February 12, 2025 13:42
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/qm31_arithmetics-in-math_utils branch from ea9f93f to ef1aa46 Compare February 12, 2025 17:42
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/qm31_arithmetics-in-math_utils branch from ef1aa46 to cbd7519 Compare February 12, 2025 18:09
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/qm31_arithmetics-in-math_utils branch from cbd7519 to ee011aa Compare February 12, 2025 20:12
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.

1 participant