-
Notifications
You must be signed in to change notification settings - Fork 48
Implement Squashed Felt252 Dict Entries libfunc #1446
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 #1446 +/- ##
==========================================
+ Coverage 81.47% 81.60% +0.12%
==========================================
Files 105 106 +1
Lines 25759 26033 +274
==========================================
+ Hits 20987 21244 +257
- Misses 4772 4789 +17 ☔ 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.289 ± 0.070 | 11.192 | 11.390 | 5.69 ± 0.09 |
cairo-native (embedded AOT) |
1.983 ± 0.030 | 1.947 | 2.057 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.067 ± 0.035 | 2.012 | 2.129 | 1.04 ± 0.02 |
Benchmark for program dict_snapshot
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
591.1 ± 10.1 | 575.5 | 605.0 | 1.00 |
cairo-native (embedded AOT) |
1682.9 ± 24.6 | 1640.9 | 1711.5 | 2.85 ± 0.06 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1816.0 ± 35.4 | 1763.9 | 1867.9 | 3.07 ± 0.08 |
Benchmark for program factorial_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
5.036 ± 0.051 | 4.992 | 5.170 | 2.33 ± 0.04 |
cairo-native (embedded AOT) |
2.167 ± 0.051 | 2.105 | 2.255 | 1.00 ± 0.03 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.163 ± 0.033 | 2.119 | 2.212 | 1.00 |
Benchmark for program fib_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.922 ± 0.025 | 4.879 | 4.956 | 3.05 ± 0.04 |
cairo-native (embedded AOT) |
1.614 ± 0.022 | 1.590 | 1.664 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.649 ± 0.016 | 1.629 | 1.675 | 1.02 ± 0.02 |
Benchmark for program heavy_circuit
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
10.167 ± 0.113 | 9.997 | 10.335 | 1.00 |
cairo-native (embedded AOT) |
14.293 ± 0.196 | 14.043 | 14.586 | 1.41 ± 0.02 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
14.847 ± 0.108 | 14.670 | 14.984 | 1.46 ± 0.02 |
Benchmark for program linear_search
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
614.7 ± 17.9 | 599.0 | 655.3 | 1.00 |
cairo-native (embedded AOT) |
1709.2 ± 24.4 | 1673.6 | 1750.4 | 2.78 ± 0.09 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1883.6 ± 43.1 | 1824.0 | 1968.1 | 3.06 ± 0.11 |
Benchmark for program logistic_map
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
517.4 ± 12.9 | 506.2 | 542.9 | 1.00 |
cairo-native (embedded AOT) |
1780.5 ± 20.4 | 1747.5 | 1815.7 | 3.44 ± 0.09 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1980.6 ± 41.9 | 1915.7 | 2042.8 | 3.83 ± 0.12 |
We were creating the array in mlir and the passing it to runtime so it could be modified. This commit deletes the mlir creation of the array and creates in runtime. This reduces a lot of code and complexity of the libfunc.
|
✅ Code is now correctly formatted. |
| pub unsafe extern "C" fn cairo_native__dict_into_entries( | ||
| dict_ptr: *const FeltDict, | ||
| data_prefix_offset: u64, | ||
| tuple_stride: u64, |
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.
I am receiving the size of the tuple from the MLIR code because I was unable to create it on the runtime side. I tried to do it like this:
let tuple_stride = Layout::new::<[u8; 32]>()
.extend(dict.layout).unwrap().0
.extend(dict.layout)To my understanding, this is the way to calculate the Layout of a struct<felt252, T, T>
Implement Squashed Felt252 Dict Entries libfunc
Implements the SquashedFelt252Dict libfunc:
Closes #1151
Introduces Breaking Changes?
No.
Checklist