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

Use return type info from sierra when serializing return values in cairo1-run crate #1665

Merged
merged 27 commits into from
Mar 20, 2024

Conversation

fmoletta
Copy link
Member

@fmoletta fmoletta commented Mar 14, 2024

Closes #1664
Uses sierra program data to serialize each return value according to its concrete type.
Removes the public serialize_output function in favor of an internal serialize_output function used by cairo_run_program.
Possible follow up work: See if we can find the names of the enum variants & struct fields in the sierra program data and include them in the serialization.

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 90.41916% with 32 lines in your changes are missing coverage. Please review.

Project coverage is 96.64%. Comparing base (0b6d116) to head (014b4af).

Files Patch % Lines
cairo1-run/src/cairo_run.rs 90.18% 32 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1665      +/-   ##
==========================================
- Coverage   96.70%   96.64%   -0.07%     
==========================================
  Files          95       95              
  Lines       38154    38375     +221     
==========================================
+ Hits        36897    37087     +190     
- Misses       1257     1288      +31     

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

Copy link

github-actions bot commented Mar 14, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.281 ± 0.053 2.234 2.409 1.01 ± 0.02
head big_factorial 2.252 ± 0.015 2.225 2.270 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.293 ± 0.055 2.249 2.395 1.00 ± 0.04
head big_fibonacci 2.293 ± 0.073 2.238 2.471 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.333 ± 0.116 8.218 8.512 1.00
head blake2s_integration_benchmark 8.367 ± 0.120 8.218 8.530 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.330 ± 0.043 2.267 2.403 1.00
head compare_arrays_200000 2.342 ± 0.040 2.310 2.445 1.00 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.443 ± 0.022 1.426 1.494 1.00
head dict_integration_benchmark 1.445 ± 0.022 1.423 1.498 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.292 ± 0.012 1.275 1.310 1.00
head field_arithmetic_get_square_benchmark 1.304 ± 0.014 1.284 1.328 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.427 ± 0.128 8.278 8.576 1.00
head integration_builtins 8.437 ± 0.153 8.279 8.619 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.632 ± 0.144 8.477 8.804 1.00
head keccak_integration_benchmark 8.708 ± 0.123 8.504 8.844 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.318 ± 0.026 2.297 2.386 1.00
head linear_search 2.344 ± 0.026 2.317 2.406 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.575 ± 0.015 1.558 1.610 1.01 ± 0.01
head math_cmp_and_pow_integration_benchmark 1.564 ± 0.012 1.550 1.586 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.415 ± 0.014 1.401 1.437 1.00
head math_integration_benchmark 1.422 ± 0.009 1.406 1.432 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.270 ± 0.039 1.247 1.370 1.00 ± 0.03
head memory_integration_benchmark 1.266 ± 0.020 1.245 1.303 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.591 ± 0.007 1.582 1.600 1.00
head operations_with_data_structures_benchmarks 1.601 ± 0.007 1.592 1.616 1.01 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 589.9 ± 1.1 588.0 591.4 1.00
head pedersen 592.0 ± 4.5 588.4 601.2 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 983.7 ± 6.8 973.1 993.8 1.00
head poseidon_integration_benchmark 986.5 ± 11.9 977.6 1016.9 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.869 ± 0.005 1.860 1.877 1.00
head secp_integration_benchmark 1.874 ± 0.052 1.844 2.019 1.00 ± 0.03
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 743.8 ± 2.4 740.6 748.4 1.00
head set_integration_benchmark 747.0 ± 4.7 742.2 759.1 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.607 ± 0.033 4.542 4.639 1.00
head uint256_integration_benchmark 4.658 ± 0.165 4.559 5.118 1.01 ± 0.04

@fmoletta fmoletta changed the title [Cairo1] Use return type info from sierra when serializing return values Use return type info from sierra when serializing return values n cairo1-run crate Mar 15, 2024
@fmoletta fmoletta changed the title Use return type info from sierra when serializing return values n cairo1-run crate Use return type info from sierra when serializing return values in cairo1-run crate Mar 15, 2024
@fmoletta fmoletta marked this pull request as ready for review March 15, 2024 14:06
@pefontana pefontana added this pull request to the merge queue Mar 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 18, 2024
@fmoletta fmoletta enabled auto-merge March 20, 2024 21:18
@fmoletta fmoletta added this pull request to the merge queue Mar 20, 2024
Merged via the queue into main with commit bf7d707 Mar 20, 2024
51 of 52 checks passed
@fmoletta fmoletta deleted the use-sierra-info-to-process-return-values branch March 20, 2024 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in cairo1-run --print_output: Only First Field of Struct Retrieved
3 participants