Skip to content

Remove duplicated get_val #2065

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

Merged
merged 4 commits into from
Apr 8, 2025
Merged

Remove duplicated get_val #2065

merged 4 commits into from
Apr 8, 2025

Conversation

FrancoGiachetta
Copy link
Contributor

@FrancoGiachetta FrancoGiachetta commented Apr 8, 2025

Remove get_val and keep res_operand_get_val

Description

Currently we have two functions to fetch value value of res_operand from the vm. Both are a duplicated of the other. This PR removes the least used of them (get_val)

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 Apr 8, 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 ± σ):     26.397 s ±  0.032 s    [User: 25.636 s, System: 0.760 s]
  Range (min … max):   26.375 s … 26.420 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     26.343 s ±  0.024 s    [User: 25.551 s, System: 0.791 s]
  Range (min … max):   26.326 s … 26.359 s    2 runs
 
Summary
  hyper_threading_pr threads: 1 ran
    1.00 ± 0.00 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 ± σ):     14.694 s ±  0.027 s    [User: 25.639 s, System: 0.831 s]
  Range (min … max):   14.675 s … 14.713 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.690 s ±  0.119 s    [User: 25.731 s, System: 0.836 s]
  Range (min … max):   14.606 s … 14.774 s    2 runs
 
Summary
  hyper_threading_pr threads: 2 ran
    1.00 ± 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 ± σ):     10.512 s ±  0.218 s    [User: 37.765 s, System: 0.940 s]
  Range (min … max):   10.358 s … 10.666 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.509 s ±  0.410 s    [User: 37.698 s, System: 0.961 s]
  Range (min … max):   10.219 s … 10.799 s    2 runs
 
Summary
  hyper_threading_pr threads: 4 ran
    1.00 ± 0.04 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 ± σ):     10.371 s ±  0.205 s    [User: 38.049 s, System: 0.976 s]
  Range (min … max):   10.226 s … 10.516 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.375 s ±  0.212 s    [User: 38.364 s, System: 0.967 s]
  Range (min … max):   10.225 s … 10.525 s    2 runs
 
Summary
  hyper_threading_main threads: 6 ran
    1.00 ± 0.03 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.301 s ±  0.022 s    [User: 38.344 s, System: 0.962 s]
  Range (min … max):   10.286 s … 10.317 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.493 s ±  0.088 s    [User: 38.284 s, System: 0.958 s]
  Range (min … max):   10.431 s … 10.556 s    2 runs
 
Summary
  hyper_threading_main threads: 8 ran
    1.02 ± 0.01 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.180 s ±  0.000 s    [User: 38.795 s, System: 1.073 s]
  Range (min … max):   10.180 s … 10.181 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.344 s ±  0.092 s    [User: 38.771 s, System: 1.075 s]
  Range (min … max):   10.278 s … 10.409 s    2 runs
 
Summary
  hyper_threading_main threads: 16 ran
    1.02 ± 0.01 times faster than hyper_threading_pr threads: 16


@FrancoGiachetta FrancoGiachetta marked this pull request as ready for review April 8, 2025 13:37
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.

LGTM

Copy link

github-actions bot commented Apr 8, 2025

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.117 ± 0.013 2.103 2.150 1.00
head big_factorial 2.120 ± 0.020 2.100 2.172 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.046 ± 0.023 2.029 2.106 1.00 ± 0.01
head big_fibonacci 2.036 ± 0.012 2.027 2.068 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.547 ± 0.090 7.454 7.712 1.00 ± 0.02
head blake2s_integration_benchmark 7.512 ± 0.117 7.417 7.748 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.173 ± 0.014 2.162 2.208 1.00 ± 0.01
head compare_arrays_200000 2.164 ± 0.008 2.148 2.176 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.448 ± 0.008 1.439 1.464 1.00 ± 0.01
head dict_integration_benchmark 1.448 ± 0.008 1.440 1.463 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.211 ± 0.013 1.197 1.241 1.01 ± 0.01
head field_arithmetic_get_square_benchmark 1.203 ± 0.006 1.195 1.214 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.579 ± 0.084 7.541 7.818 1.01 ± 0.01
head integration_builtins 7.515 ± 0.033 7.473 7.583 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.855 ± 0.123 7.768 8.108 1.01 ± 0.02
head keccak_integration_benchmark 7.800 ± 0.089 7.724 8.039 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.151 ± 0.016 2.140 2.197 1.00
head linear_search 2.153 ± 0.017 2.137 2.183 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.529 ± 0.015 1.517 1.558 1.00 ± 0.01
head math_cmp_and_pow_integration_benchmark 1.526 ± 0.007 1.517 1.539 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.468 ± 0.006 1.456 1.476 1.00
head math_integration_benchmark 1.470 ± 0.010 1.458 1.488 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.216 ± 0.011 1.209 1.247 1.00 ± 0.01
head memory_integration_benchmark 1.214 ± 0.004 1.210 1.224 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.573 ± 0.006 1.564 1.583 1.00 ± 0.01
head operations_with_data_structures_benchmarks 1.571 ± 0.006 1.562 1.580 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 533.2 ± 1.8 530.4 535.8 1.00 ± 0.00
head pedersen 532.6 ± 1.3 531.1 534.9 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 628.7 ± 5.2 621.6 638.0 1.00
head poseidon_integration_benchmark 629.1 ± 5.0 621.7 634.1 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.851 ± 0.008 1.840 1.865 1.00 ± 0.01
head secp_integration_benchmark 1.847 ± 0.011 1.836 1.866 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 662.3 ± 5.6 653.7 667.2 1.00 ± 0.01
head set_integration_benchmark 661.9 ± 4.8 654.2 670.5 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.200 ± 0.056 4.147 4.322 1.01 ± 0.02
head uint256_integration_benchmark 4.166 ± 0.033 4.127 4.229 1.00

Copy link

codecov bot commented Apr 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.57%. Comparing base (0038711) to head (54fd63d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2065      +/-   ##
==========================================
+ Coverage   96.55%   96.57%   +0.02%     
==========================================
  Files         102      102              
  Lines       42872    42854      -18     
==========================================
- Hits        41394    41387       -7     
+ Misses       1478     1467      -11     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gabrielbosio gabrielbosio added this pull request to the merge queue Apr 8, 2025
Merged via the queue into main with commit 6b283d7 Apr 8, 2025
94 checks passed
@gabrielbosio gabrielbosio deleted the remove-dup-get-val branch April 8, 2025 22:41
enitrat pushed a commit to kkrt-labs/cairo-vm that referenced this pull request Apr 14, 2025
* avoid installing gmp if it is already installed

* revert part of the last commit

* changelog

* remove unwanted file
enitrat pushed a commit to kkrt-labs/cairo-vm that referenced this pull request Apr 22, 2025
* avoid installing gmp if it is already installed

* revert part of the last commit

* changelog

* remove unwanted file
enitrat pushed a commit to kkrt-labs/cairo-vm that referenced this pull request May 6, 2025
* avoid installing gmp if it is already installed

* revert part of the last commit

* changelog

* remove unwanted file
enitrat pushed a commit to kkrt-labs/cairo-vm that referenced this pull request May 6, 2025
* avoid installing gmp if it is already installed

* revert part of the last commit

* changelog

* remove unwanted file
enitrat pushed a commit to kkrt-labs/cairo-vm that referenced this pull request May 6, 2025
* avoid installing gmp if it is already installed

* revert part of the last commit

* changelog

* remove unwanted file
gabrielbosio pushed a commit that referenced this pull request May 21, 2025
* avoid installing gmp if it is already installed

* revert part of the last commit

* changelog

* remove unwanted file
gabrielbosio added a commit that referenced this pull request Jun 4, 2025
* Remove duplicated `get_val` (#2065)

* avoid installing gmp if it is already installed

* revert part of the last commit

* changelog

* remove unwanted file

* CI: Make cache keys depend on Cairo version (#2056)

* Add Makefile and requirements.txt to cache key

* Don't fetch cairo stwo exclusive programs

* Remove empty file

* Restrict caching Cairo programs

Revert how the Rust workflow uses the Cairo program paths to
calculate the cache keys.
This change would imply the branch only adds Makefile and
requirements.txt to the cache key computation.

---------

Co-authored-by: gabrielbosio <[email protected]>
Co-authored-by: Gabriel Bosio <[email protected]>

* dev: make Memory::get `pub` (#2039)

* dev: make Memory::get `pub`

* edit changelog

* dev: expose get_maybe_relocatable instead

* add comment on borrowed variant

* add tests

* feat(breaking): add support for hint accessible scopes (#2042)

* feat: add support for hint accessible scopes

update changelog

* Update vm/src/hint_processor/hint_processor_definition.rs

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* feat: add support for alias identifiers destination in program serde (#2071)

* feat: add support for aliases destination in program serde

* add changelog

---------

Co-authored-by: Julián González Calderón <[email protected]>

* fix: Add boundary tests for SecpSplitOutOfRange in secp_utils (#2062)

* fix: Add boundary tests for SecpSplitOutOfRange in secp_utils

* Update secp_utils.rs

* Update CHANGELOG.md

* Update secp_utils.rs

* remove optimizations

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* empty commit to fix CI

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* docs: add --run_from_cairo_pie documentation for Cairo 0 and Cairo 1 (#2077)

* docs: add --run_from_cairo_pie flag usage documentation for Cairo 0

* docs: add --run_from_cairo_pie flag usage documentation for Cairo 1

* Update README.md

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* Update README.md

* Update README.md

* Update README.md

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

* Update README.md

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>
Co-authored-by: Gabriel Bosio <[email protected]>

* Fix WRITE_DIVMOD_SEGMENT hint (#2078)

* Minor fixes - use CAIRO_PRIME

* Add error handling

* Update CHANGELOG.md

* Bump cairo-lang to 0.13.5 (#1959)

* Update cairo-lang versin

* Update changelog

* Add new hints

* Specify prime in new hints

* Only apply mod floor if prime is not CAIRO_PRIME

* Properly implement pack for a different prime

* Fix pack in compute_doubling_slope

* Add negative_points.cairo test

* Add try_get_point_from_x for negative points

* Add double_x test for negative points

* Allow to many arguments

* Add codecov to cairo-0-secp-hints feature

* Prepare for Release v3.0.0-rc.1 (#2092)

* Update version

* Update lock

* Update toolchain

* Update changelog

* Fix clippy

* Update toolchain in CI

* fix: correct cache keys for no-std test coverage in CI (#2093)

* Update rust.yml

* Update rust.yml

* Update rust toolchain to 1.87.0 (#2100)

* update rust toolchain to 1.87.0

* remove uneeded file

* update rust in workflows

* update changelog

* clippy

* clippy

* remove unneeded clippy allow

* fix Changelog link (#2104)

* Improve memory_segments coverage (#2110)

* Add tests for .gen_arg() and .write_arg()

* Add test for .is_valid_memory_value()

* Assert contents of memory segments

---------

Co-authored-by: Franco Giachetta <[email protected]>
Co-authored-by: Julian Gonzalez Calderon <[email protected]>
Co-authored-by: Mathieu <[email protected]>
Co-authored-by: VolodymyrBg <[email protected]>
Co-authored-by: GarmashAlex <[email protected]>
Co-authored-by: crStiv <[email protected]>
Co-authored-by: DiegoC <[email protected]>
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