-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add Bytes31 return type #610
Conversation
Benchmarking resultsBenchmark for program
|
Command | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
11.431 ± 0.070 | 11.340 | 11.580 | 23.78 ± 0.17 |
cairo-native (embedded AOT) |
1.532 ± 0.011 | 1.515 | 1.549 | 3.19 ± 0.03 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.646 ± 0.017 | 1.626 | 1.673 | 3.42 ± 0.04 |
cairo-native (standalone AOT) |
0.652 ± 0.001 | 0.651 | 0.654 | 1.36 ± 0.01 |
cairo-native (standalone AOT with -march=native) |
0.481 ± 0.002 | 0.480 | 0.485 | 1.00 |
Benchmark for program fib_2M
Open benchmarks
Command | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
10.876 ± 0.080 | 10.810 | 11.070 | 1336.70 ± 18.12 |
cairo-native (embedded AOT) |
1.178 ± 0.023 | 1.141 | 1.215 | 144.75 ± 3.24 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.126 ± 0.006 | 1.116 | 1.137 | 138.40 ± 1.76 |
cairo-native (standalone AOT) |
0.008 ± 0.000 | 0.008 | 0.009 | 1.03 ± 0.02 |
cairo-native (standalone AOT with -march=native) |
0.008 ± 0.000 | 0.008 | 0.008 | 1.00 |
Benchmark for program logistic_map
Open benchmarks
Command | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
1.908 ± 0.009 | 1.892 | 1.924 | 28.83 ± 0.16 |
cairo-native (embedded AOT) |
1.254 ± 0.012 | 1.239 | 1.275 | 18.95 ± 0.18 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.436 ± 0.016 | 1.419 | 1.475 | 21.70 ± 0.24 |
cairo-native (standalone AOT) |
0.107 ± 0.000 | 0.107 | 0.107 | 1.62 ± 0.00 |
cairo-native (standalone AOT with -march=native) |
0.066 ± 0.000 | 0.066 | 0.067 | 1.00 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #610 +/- ##
==========================================
+ Coverage 92.33% 92.36% +0.02%
==========================================
Files 109 109
Lines 34097 34090 -7
==========================================
+ Hits 31485 31486 +1
+ Misses 2612 2604 -8 ☔ View full report in Codecov by Sentry. |
src/executor.rs
Outdated
Some(return_ptr) => JitValue::from_jit(return_ptr, type_id, registry), | ||
None => { | ||
#[cfg(target_arch = "x86_64")] | ||
let value = JitValue::from_jit(return_ptr.unwrap(), type_id, registry); |
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 just realized that this unwrap here would always fail if it wasn't unreachable.
It would always fail because the match's branch means that it's always None
, and it's unreachable because x86 only returns values in two registers at most (128 bits, not 248).
Maybe we should change it to unreachable!()
? (here and in the felt)
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.
Good catch! @azteca1998
I added the unreachable!(), but I think I would be good to make a refactor in another PR that changes the fn parse_result so it return a Result, what do you think?
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.
Returning a result in the case of reaching an unreachable part of the code? I've never seen the point of doing that.
However, if it's a refactor that avoids the need to have an unreachable!()
statement due to a change in the design (and not pushing it into a result) then I'm all for it.
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.
Yes, I meant the refactor that avoids unreachable!()
I will take it next!
@@ -647,15 +647,24 @@ fn parse_result( | |||
Some(return_ptr) => JitValue::from_jit(return_ptr, type_id, registry), | |||
None => { | |||
#[cfg(target_arch = "x86_64")] | |||
let value = JitValue::from_jit(return_ptr.unwrap(), type_id, registry); | |||
unreachable!(); |
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.
Can you please add a comment explaining the difference behaviour across architectures?
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.
Something like this should work:
unreachable!(); | |
// Since x86_64's return values hold at most two different 64bit registers, | |
// everything bigger than u128 will be returned by memory, therefore making | |
// this branch unreachable on that architecture. | |
unreachable!(); |
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.
Great!
Done 9d9b7a8
Add Bytes31 return type
Checklist