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

Add HintProcessor::execute_hint_extensive + refactor hint_ranges #1491

Merged
merged 27 commits into from
Nov 27, 2023

Conversation

fmoletta
Copy link
Contributor

@fmoletta fmoletta commented Nov 23, 2023

This PR proposes a solution to the hint-relates problems faced when running the starknet os:

  • Hints can be associated to pc's that are not in the segment 0
  • Hints can load more hints during their execution

The proposed solution for each problem is:

  • Use a HashMap indexed by a Relocatable pc value for hint ranges
  • Extend the HintProcessor api with an execute_hint_extensive method which can return a map of extra hints to be loaded after the hint is executed. This new method comes with a default implementation that just calls execute_hint so that this change may not affect current implementors of the trait

Tests added for this new behaviour in #1494

@fmoletta fmoletta changed the title [WIP] Add HintProcessor::execute_hint_extensive + use a HashMap with Relocatable index for hint ranges [WIP] Add HintProcessor::execute_hint_extensive + refactor hint_ranges Nov 23, 2023
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (7c1cfd9) 96.82% compared to head (480601c) 96.81%.

Files Patch % Lines
vm/src/vm/vm_core.rs 90.90% 4 Missing ⚠️
vm/src/types/program.rs 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1491      +/-   ##
==========================================
- Coverage   96.82%   96.81%   -0.01%     
==========================================
  Files          96       96              
  Lines       39567    39574       +7     
==========================================
+ Hits        38311    38315       +4     
- Misses       1256     1259       +3     

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

Copy link

github-actions bot commented Nov 23, 2023

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.633 ± 0.018 2.605 2.661 1.00
head big_factorial 2.648 ± 0.036 2.598 2.726 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.249 ± 0.042 2.219 2.365 1.02 ± 0.02
head big_fibonacci 2.209 ± 0.017 2.186 2.241 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 6.212 ± 0.039 6.134 6.253 1.00
head blake2s_integration_benchmark 7.569 ± 0.063 7.503 7.704 1.22 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.330 ± 0.023 2.313 2.394 1.00
head compare_arrays_200000 2.611 ± 0.015 2.597 2.642 1.12 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.612 ± 0.007 1.600 1.620 1.00
head dict_integration_benchmark 1.761 ± 0.015 1.735 1.780 1.09 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.086 ± 0.008 1.079 1.103 1.00
head field_arithmetic_get_square_benchmark 1.265 ± 0.034 1.245 1.354 1.16 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 6.271 ± 0.057 6.180 6.358 1.01 ± 0.03
head integration_builtins 6.209 ± 0.153 6.126 6.572 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 6.280 ± 0.040 6.227 6.338 1.00
head keccak_integration_benchmark 7.641 ± 0.061 7.555 7.713 1.22 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.373 ± 0.017 2.348 2.395 1.00
head linear_search 2.666 ± 0.036 2.631 2.759 1.12 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.625 ± 0.010 1.611 1.643 1.00
head math_cmp_and_pow_integration_benchmark 1.772 ± 0.030 1.747 1.850 1.09 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.540 ± 0.038 1.505 1.643 1.00
head math_integration_benchmark 1.668 ± 0.020 1.653 1.722 1.08 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.339 ± 0.008 1.328 1.352 1.00
head memory_integration_benchmark 1.491 ± 0.032 1.467 1.580 1.11 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.464 ± 0.009 1.452 1.478 1.00
head operations_with_data_structures_benchmarks 1.611 ± 0.009 1.602 1.632 1.10 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 592.7 ± 2.1 590.3 597.0 1.01 ± 0.01
head pedersen 589.5 ± 3.0 585.6 595.5 1.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.165 ± 0.006 1.158 1.177 1.00
head poseidon_integration_benchmark 1.201 ± 0.006 1.191 1.210 1.03 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.035 ± 0.014 2.020 2.070 1.00
head secp_integration_benchmark 2.175 ± 0.008 2.163 2.193 1.07 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.155 ± 0.014 1.141 1.193 1.00
head set_integration_benchmark 1.179 ± 0.004 1.173 1.185 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 3.960 ± 0.024 3.930 4.008 1.00
head uint256_integration_benchmark 4.690 ± 0.227 4.586 5.333 1.18 ± 0.06

vm/src/vm/vm_core.rs Outdated Show resolved Hide resolved
@fmoletta fmoletta changed the title [WIP] Add HintProcessor::execute_hint_extensive + refactor hint_ranges Add HintProcessor::execute_hint_extensive + refactor hint_ranges Nov 24, 2023
@fmoletta fmoletta marked this pull request as ready for review November 24, 2023 21:49
@pefontana pefontana added this pull request to the merge queue Nov 27, 2023
Merged via the queue into main with commit 006666e Nov 27, 2023
49 of 50 checks passed
@pefontana pefontana deleted the fede-refactor-v3 branch November 27, 2023 20:14
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