-
Notifications
You must be signed in to change notification settings - Fork 46
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
Change tests to use sierra generator #1057
Conversation
✅ Code is now correctly formatted. |
Benchmark results Main vs 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) |
20.682 ± 0.052 | 20.622 | 20.755 | 5.24 ± 0.03 |
cairo-native (embedded AOT) |
3.950 ± 0.021 | 3.908 | 3.976 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
4.020 ± 0.026 | 3.991 | 4.065 | 1.02 ± 0.01 |
Benchmark for program dict_snapshot
Open benchmarks
Command | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
6.030 ± 0.038 | 5.956 | 6.080 | 1.62 ± 0.02 |
cairo-native (embedded AOT) |
3.722 ± 0.033 | 3.668 | 3.791 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
3.787 ± 0.016 | 3.767 | 3.819 | 1.02 ± 0.01 |
Benchmark for program factorial_2M
Open benchmarks
Command | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
14.159 ± 0.055 | 14.103 | 14.250 | 3.43 ± 0.02 |
cairo-native (embedded AOT) |
4.125 ± 0.025 | 4.088 | 4.164 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
4.206 ± 0.055 | 4.141 | 4.310 | 1.02 ± 0.01 |
Benchmark for program fib_2M
Open benchmarks
Command | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
14.117 ± 0.071 | 14.005 | 14.247 | 3.87 ± 0.05 |
cairo-native (embedded AOT) |
3.650 ± 0.039 | 3.588 | 3.720 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
3.688 ± 0.034 | 3.650 | 3.762 | 1.01 ± 0.01 |
Benchmark for program linear_search
Open benchmarks
Command | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
6.023 ± 0.036 | 5.966 | 6.073 | 1.58 ± 0.02 |
cairo-native (embedded AOT) |
3.803 ± 0.031 | 3.775 | 3.879 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
3.947 ± 0.035 | 3.898 | 4.013 | 1.04 ± 0.01 |
Benchmark for program logistic_map
Open benchmarks
Command | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
5.885 ± 0.051 | 5.810 | 5.977 | 1.52 ± 0.02 |
cairo-native (embedded AOT) |
3.869 ± 0.031 | 3.820 | 3.926 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
4.041 ± 0.039 | 3.993 | 4.106 | 1.04 ± 0.01 |
match ty { | ||
CoreTypeConcrete::Box(info) | ||
| CoreTypeConcrete::NonZero(info) | ||
| CoreTypeConcrete::Nullable(info) | ||
| CoreTypeConcrete::Snapshot(info) => { | ||
return self.to_ptr(arena, registry, &info.ty, find_dict_overrides); | ||
} | ||
_ => {} | ||
} |
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.
Shouldn't this logic be in the match just below, rather than in a separate match?
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.
That match below is different, it is a match of self
which is a Value
. However, ty
is a CoreTypeConcrete
src/libfuncs/enum.rs
Outdated
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 programs in this file are very complex, and the sierra generator is not easy to follow. Maybe we should leave them as sierra code?
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.
Mmm, is true that is quite complex. I agree that leaving those in sierra could be better. What are you thoughts on this @gabrielbosio?
Co-authored-by: Julian Gonzalez Calderon <[email protected]>
Co-authored-by: Julian Gonzalez Calderon <[email protected]>
…native into sierra-generator-bool
…native into sierra-generator-bool
if cfg!(test) { | ||
Self::Null | ||
} else { | ||
native_panic!("todo: implement uint128mulguarantee from_ptr") | ||
} |
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.
Why is it only implemented in tests?
let Value::Struct { | ||
fields, | ||
debug_name: _, | ||
} = run_sierra_program(&UINT512_DIVMOD_U256, &[lhs, rhs]).return_value | ||
else { | ||
panic!("should be a struct"); | ||
}; | ||
|
||
let result = jit_struct!(fields[0].clone(), fields[1].clone()); | ||
|
||
assert_eq!(result, jit_struct!(output_u512, output_u256)); |
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.
Could you also assert the output of all the fields, instead of only the first two?
This PR uses the sierra generator to test libfuncs. This is to prevent us from any possible change in the sierra generator which could generate false positives in tests. Some tests were left untouched either because the libfunc they were targeting was already being tested in another test, or because they were using the libfunc explicitly.
Checklist