-
Notifications
You must be signed in to change notification settings - Fork 49
Optimize felt252_div compilation
#1437
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
Open
FrancoGiachetta
wants to merge
11
commits into
main
Choose a base branch
from
opt-felt252_div-compilation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
|
✅ Code is now correctly formatted. |
07ccfdd to
4bf1632
Compare
…cairo_native into opt-felt252_div-compilation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1437 +/- ##
==========================================
- Coverage 81.45% 81.44% -0.01%
==========================================
Files 105 105
Lines 25869 25845 -24
==========================================
- Hits 21072 21050 -22
+ Misses 4797 4795 -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) |
11.039 ± 0.299 | 10.893 | 11.876 | 4.38 ± 0.13 |
cairo-native (embedded AOT) |
2.523 ± 0.027 | 2.485 | 2.574 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.635 ± 0.015 | 2.613 | 2.658 | 1.04 ± 0.01 |
Benchmark for program dict_snapshot
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
555.1 ± 13.5 | 542.0 | 587.0 | 1.00 |
cairo-native (embedded AOT) |
2288.4 ± 21.3 | 2258.7 | 2320.1 | 4.12 ± 0.11 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2419.8 ± 27.5 | 2362.3 | 2455.5 | 4.36 ± 0.12 |
Benchmark for program factorial_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.818 ± 0.025 | 4.783 | 4.867 | 1.73 ± 0.02 |
cairo-native (embedded AOT) |
2.803 ± 0.075 | 2.712 | 2.926 | 1.01 ± 0.03 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.778 ± 0.036 | 2.708 | 2.827 | 1.00 |
Benchmark for program fib_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.738 ± 0.022 | 4.714 | 4.782 | 2.11 ± 0.07 |
cairo-native (embedded AOT) |
2.246 ± 0.070 | 2.159 | 2.400 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.289 ± 0.035 | 2.217 | 2.329 | 1.02 ± 0.04 |
Benchmark for program heavy_circuit
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
10.136 ± 0.146 | 9.858 | 10.308 | 1.00 |
cairo-native (embedded AOT) |
15.237 ± 0.213 | 14.770 | 15.491 | 1.50 ± 0.03 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
15.458 ± 0.238 | 15.127 | 15.817 | 1.53 ± 0.03 |
Benchmark for program linear_search
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
595.5 ± 10.9 | 581.8 | 613.0 | 1.00 |
cairo-native (embedded AOT) |
2332.8 ± 36.6 | 2289.9 | 2394.4 | 3.92 ± 0.09 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2419.0 ± 56.5 | 2361.2 | 2520.5 | 4.06 ± 0.12 |
Benchmark for program logistic_map
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
392.9 ± 8.9 | 379.2 | 409.9 | 1.00 |
cairo-native (embedded AOT) |
2385.8 ± 49.4 | 2337.7 | 2492.1 | 6.07 ± 0.19 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2581.3 ± 32.5 | 2526.2 | 2628.8 | 6.57 ± 0.17 |
8af6772 to
8c56617
Compare
402fa82 to
0ce2bb5
Compare
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.
Optimize
felt252_divcompilationCloses #None.
Similar to #1400, this PR tries to optimize felts division's compilation time. This issue seems to be the same as the one the mentioned PR attacks. Arithmetic operations tend to rise the execution of the pass TwoAddressInstructionPass, which tries to legalize the operations so as to generate properly formed instructions.
Particularly in x86, this pass tends to take a great amount of time during object generation phase of the compilation.
Benchmarks:
Compilation
I benchmarked one class hash which seems to be having this issue. This was performed with the following specs:
Execution
I've run some block checking execution performance, each of them were run 10 times. The specs used are the same as the ones with compilation.
Samply
I've also run the compilation of the same contract with samply, using the same specs as with benchmarks.
Introduces Breaking Changes?
No.
starknet-blocks.ymlworkflow to use these PRs.These PRs should be merged after this one right away, in that order.
Checklist