-
Notifications
You must be signed in to change notification settings - Fork 49
Fix BoundedInt Add libfunc #1463
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1463 +/- ##
=======================================
Coverage 81.50% 81.50%
=======================================
Files 105 105
Lines 25868 25858 -10
=======================================
- Hits 21084 21076 -8
+ Misses 4784 4782 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Benchmark results Main vs HEAD.Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
|
Benchmarking resultsBenchmark for program
|
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
10.948 ± 0.060 | 10.877 | 11.088 | 4.55 ± 0.04 |
cairo-native (embedded AOT) |
2.408 ± 0.018 | 2.372 | 2.432 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.496 ± 0.023 | 2.464 | 2.528 | 1.04 ± 0.01 |
Benchmark for program dict_snapshot
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
519.6 ± 6.8 | 508.2 | 527.1 | 1.00 |
cairo-native (embedded AOT) |
2106.6 ± 16.8 | 2079.8 | 2136.8 | 4.05 ± 0.06 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2211.6 ± 20.3 | 2193.2 | 2257.7 | 4.26 ± 0.07 |
Benchmark for program factorial_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.752 ± 0.036 | 4.724 | 4.848 | 1.87 ± 0.02 |
cairo-native (embedded AOT) |
2.538 ± 0.015 | 2.511 | 2.557 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.591 ± 0.021 | 2.563 | 2.624 | 1.02 ± 0.01 |
Benchmark for program fib_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.739 ± 0.087 | 4.682 | 4.957 | 2.29 ± 0.05 |
cairo-native (embedded AOT) |
2.067 ± 0.019 | 2.034 | 2.099 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.116 ± 0.010 | 2.103 | 2.135 | 1.02 ± 0.01 |
Benchmark for program heavy_circuit
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
9.526 ± 0.056 | 9.459 | 9.641 | 1.00 |
cairo-native (embedded AOT) |
14.467 ± 0.046 | 14.378 | 14.523 | 1.52 ± 0.01 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
14.876 ± 0.066 | 14.751 | 14.963 | 1.56 ± 0.01 |
Benchmark for program linear_search
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
563.0 ± 5.4 | 552.9 | 572.5 | 1.00 |
cairo-native (embedded AOT) |
2149.7 ± 14.1 | 2128.4 | 2169.0 | 3.82 ± 0.04 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2294.4 ± 18.0 | 2267.6 | 2332.4 | 4.08 ± 0.05 |
Benchmark for program logistic_map
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
375.1 ± 5.8 | 369.0 | 390.1 | 1.00 |
cairo-native (embedded AOT) |
2228.9 ± 13.5 | 2209.2 | 2248.9 | 5.94 ± 0.10 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2411.8 ± 16.4 | 2389.0 | 2446.3 | 6.43 ± 0.11 |
8 tasks
JulianGCalderon
requested changes
Nov 26, 2025
JulianGCalderon
approved these changes
Nov 28, 2025
Contributor
JulianGCalderon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
gabrielbosio
approved these changes
Nov 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix BoundedInt Add libfunc
The previous implementation of the add libfunc had some cases in which it failed to return the correct result. We decided to change the algorithm to one that is simpler to understand and that fixes the errors.
We have C = A + B, where all of them are
BoundedInt. We represent the aBoundedIntas:BoundedInt.BoundedIntrange.So we want to get
Cdand we haveCo + Cd = Ao + Ad + Bo + Bd->Cd = Ao + Ad + Bo + Bd - Co. When havingBoundedIntadditions we need to implement theAddHelperlike the following:In this case we have:
And as we can see
Co = Ao + Bo. If this is not satisfied, then the Cairo code won´t compile. Then, by havingCd = Ao + Ad + Bo + Bd - CoandCo = Ao + Bowe can simplify the addition toCd = Ad + Bd.Closes #1448
Introduces Breaking Changes?
No.
Checklist