-
Notifications
You must be signed in to change notification settings - Fork 49
Fix BoundedInt Sub libfunc #1465
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1465 +/- ##
==========================================
+ Coverage 81.50% 81.52% +0.01%
==========================================
Files 105 105
Lines 25868 25863 -5
==========================================
+ Hits 21084 21085 +1
+ Misses 4784 4778 -6 ☔ 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) |
11.024 ± 0.049 | 10.957 | 11.115 | 4.39 ± 0.08 |
cairo-native (embedded AOT) |
2.510 ± 0.045 | 2.441 | 2.601 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.583 ± 0.031 | 2.534 | 2.644 | 1.03 ± 0.02 |
Benchmark for program dict_snapshot
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
525.7 ± 7.7 | 516.4 | 538.6 | 1.00 |
cairo-native (embedded AOT) |
2194.9 ± 35.9 | 2149.3 | 2281.3 | 4.18 ± 0.09 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2314.9 ± 28.0 | 2270.0 | 2358.1 | 4.40 ± 0.08 |
Benchmark for program factorial_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.747 ± 0.012 | 4.727 | 4.768 | 1.81 ± 0.01 |
cairo-native (embedded AOT) |
2.623 ± 0.009 | 2.613 | 2.637 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.665 ± 0.017 | 2.641 | 2.693 | 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.727 ± 0.037 | 4.699 | 4.827 | 2.17 ± 0.02 |
cairo-native (embedded AOT) |
2.179 ± 0.017 | 2.155 | 2.206 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.214 ± 0.021 | 2.180 | 2.251 | 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.654 ± 0.103 | 9.527 | 9.810 | 1.00 |
cairo-native (embedded AOT) |
13.675 ± 0.099 | 13.568 | 13.850 | 1.42 ± 0.02 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
14.156 ± 0.114 | 13.947 | 14.351 | 1.47 ± 0.02 |
Benchmark for program linear_search
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
574.4 ± 6.2 | 566.7 | 585.8 | 1.00 |
cairo-native (embedded AOT) |
2245.6 ± 15.6 | 2221.0 | 2269.6 | 3.91 ± 0.05 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2351.7 ± 17.9 | 2333.3 | 2387.9 | 4.09 ± 0.05 |
Benchmark for program logistic_map
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
383.5 ± 4.0 | 376.6 | 389.5 | 1.00 |
cairo-native (embedded AOT) |
2310.4 ± 12.4 | 2287.1 | 2326.5 | 6.02 ± 0.07 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2482.0 ± 13.1 | 2461.2 | 2500.9 | 6.47 ± 0.08 |
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.
Looks good! Can you modify the tests to use test_case?
src/libfuncs/bounded_int.rs
Outdated
| lower_bound: i32, | ||
| upper_bound: i32, |
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.
The lower and upper bound are given by the sierra, so there is no need on checking it, right?
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.
Refactored in 30200bb
Co-authored-by: Julian Gonzalez Calderon <gonzalezcalderonjulian@gmail.com>
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!
ad4dc54
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Fix BoundedInt Sub libfunc
The previous implementation of the sub 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 is mathematically correct.
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.Closes #1449
Introduces Breaking Changes?
No.
Checklist