-
Notifications
You must be signed in to change notification settings - Fork 160
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
feat: Add feature lambdaworks-felt
to felt
& cairo-vm
crates
#1281
Merged
Conversation
This file contains 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
Also comment `from` impls for primitive numbers and (De)Serialize derives
fmoletta
changed the title
Add
feat: Add feature Jun 26, 2023
lambdaworks-felt
feature to felt
cratelambdaworks-felt
to felt
& cairo-vm
crates
Oppen
reviewed
Jun 26, 2023
…ro-rs into lambdaworks-felt-feature
…ro-rs into lambdaworks-felt-feature
fmoletta
requested review from
igaray,
entropidelic,
juanbono,
pefontana and
Juan-M-V
as code owners
June 26, 2023 21:18
juanbono
approved these changes
Jun 26, 2023
Oppen
approved these changes
Jun 26, 2023
pefontana
approved these changes
Jun 26, 2023
Benchmark Results for unmodified programs 🚀
|
kariy
pushed a commit
to dojoengine/cairo-rs
that referenced
this pull request
Jul 4, 2023
…ambdaclass#1281) * wip * Manually implement some common derives Also comment `from` impls for primitive numbers and (De)Serialize derives * Implement FromPrimitive * Implement ToPrimitive * Add BitAnd/Xor/Or implementations * Implement bit shift operators * Remove Signed implementation * Remove Integer impl * Impl Bounded * Impl from_str_radix * Add iter_u64_digits impl * Add Add impls * Add Sub impls * Patch arbitrary * Fix some warnings * Implement parse_bytes * Implement utility methods for tests * Fix test compilation errors * Add From impl for signed primitive nums * Impl From<BigInt> * Re-add bits fn * Impl Signed * Impl (De)Serialize * Fix compile errors and clippy suggestions * Pin cairo 1 compiler version * Reorder impls * Fix compile error * Fix various errors (tests pass!) * Remove to_bytes_be * Fix panicky from_bytes_be * Fix is_positive * Fix str conversions * Add documentation * Fix from_i64 accepting negative numbers * Use BigUint in from_bytes_be * Remove unneded field macro * Pin lambdaworks commit * Fix keccak * Fix from_i64 condition was reversed * Change Debug::fmt to return number in decimal * Appease clippy in felt crate * Silence clippy warning (for now) * Fix nostd error * Update lambdaworks to latest revision * Update rust version in CI * Change sqrt for lambdaworks' * Manually build BigDigits on to_biguint * Use a bigger number of iterations for square bench * Update lambdaworks-math revision * Fix sqrt tests and Shl/Shr impl (+add tests) * Update Cargo.lock * Appease clippy and fix Shr<usize> * Square input instead of using prop_assume * Revert the change to Shr * Appease clippy * Use bits instead of shl in range check * Remove `FeltBigInt` * Add lamdaworks-benchmarks.sh * Add lamdaworks-benchmarks.md * Update lamdaworks-benchmarks.md * Update commits * Update .md commits * Looooong benchmark * Remove bigbox clippy allow * Update lambdaworks to latest, and change AddAssign * Remove `-P` option in `xargs` In the measurements we got through `perf`, there were 3 to 4 times more page faults compared to base. This can be explained by the runner using swap memory because of the increase in memory usage. We can fix it by reducing the amount of processes ran in parallel by xargs (2 -> 1) * Change `to_(b|l)e_bytes` to not use lw primitives * Change comments in `Add<&Felt252> for u64` * Fix: wasn't indexing properly :P * Override default `div_mod_floor` impl for Felt252 * Disable swap memory before benchmarking * Reduce number of warmups and runs * Optimize `assert_le_felt` (used in math_integration_benchmark) * Use constant for zero() function * Extract division by constant * Use BigUint in assert_le_felt This part uses comparisons and integer division (that use `to_biguint`), so it's better to use `BigUints` directly. * Avoid calling `BigInt::abs` * Update changelog * Add tests for felt * Add TODO * Add other texts * Update lambdaworks to latest * Revert hyperfine arguments to main * Remove unneeded clones and into_owneds * Remove unneeded references and clones * Add BREAKING note to changelog * Make Felt252::one just copy a constant * Impl From<bool> for Felt252 * Change some uses of get_ref with get_mut_ref Using `get_ref` and later updating the variable with an `exec_scopes.insert_value(...)` causes two lookups in a hashmap, along with two creation of `String` from a slice. This change reduces it to just a single lookup and `String` creation. * Unify mem*_continue_* functions * Run benchmarks sequentially to avoid mem issues * Use div_mod_floor instead of div and mod * Use BigUint for non-modular calculations * Add TODO * Include both lib.rs * Fix lib_bigint_felt * Add test-lambdaworks-felt workflow * Fix failling example * Move extern crate import to lib.rs * Update changelog * Fix changelog * Fix example * Remove benchmark docs * Remove clone * Move crate-level attribute to lib.rs * Fix changelog * Remove blank line in toml * Use one line cfg directives * Remove reference * Restore clone * Fix doc test * Add `lambdaworks-felt` feature to vm crate * Add instructions to (de)activate the new feature * Use different matrix group for lambdaworks felt in CI * Move the sections a bit * Update lambdaworks-math version to 0.1.1 * Invert the part talking about features --------- Co-authored-by: Pedro Fontana <fontana.pedro93@gmail.com> Co-authored-by: Tomá <47506558+MegaRedHand@users.noreply.github.com> Co-authored-by: Mario Rugiero <mrugiero@gmail.com>
kariy
pushed a commit
to dojoengine/cairo-rs
that referenced
this pull request
Jul 4, 2023
…ambdaclass#1281) * wip * Manually implement some common derives Also comment `from` impls for primitive numbers and (De)Serialize derives * Implement FromPrimitive * Implement ToPrimitive * Add BitAnd/Xor/Or implementations * Implement bit shift operators * Remove Signed implementation * Remove Integer impl * Impl Bounded * Impl from_str_radix * Add iter_u64_digits impl * Add Add impls * Add Sub impls * Patch arbitrary * Fix some warnings * Implement parse_bytes * Implement utility methods for tests * Fix test compilation errors * Add From impl for signed primitive nums * Impl From<BigInt> * Re-add bits fn * Impl Signed * Impl (De)Serialize * Fix compile errors and clippy suggestions * Pin cairo 1 compiler version * Reorder impls * Fix compile error * Fix various errors (tests pass!) * Remove to_bytes_be * Fix panicky from_bytes_be * Fix is_positive * Fix str conversions * Add documentation * Fix from_i64 accepting negative numbers * Use BigUint in from_bytes_be * Remove unneded field macro * Pin lambdaworks commit * Fix keccak * Fix from_i64 condition was reversed * Change Debug::fmt to return number in decimal * Appease clippy in felt crate * Silence clippy warning (for now) * Fix nostd error * Update lambdaworks to latest revision * Update rust version in CI * Change sqrt for lambdaworks' * Manually build BigDigits on to_biguint * Use a bigger number of iterations for square bench * Update lambdaworks-math revision * Fix sqrt tests and Shl/Shr impl (+add tests) * Update Cargo.lock * Appease clippy and fix Shr<usize> * Square input instead of using prop_assume * Revert the change to Shr * Appease clippy * Use bits instead of shl in range check * Remove `FeltBigInt` * Add lamdaworks-benchmarks.sh * Add lamdaworks-benchmarks.md * Update lamdaworks-benchmarks.md * Update commits * Update .md commits * Looooong benchmark * Remove bigbox clippy allow * Update lambdaworks to latest, and change AddAssign * Remove `-P` option in `xargs` In the measurements we got through `perf`, there were 3 to 4 times more page faults compared to base. This can be explained by the runner using swap memory because of the increase in memory usage. We can fix it by reducing the amount of processes ran in parallel by xargs (2 -> 1) * Change `to_(b|l)e_bytes` to not use lw primitives * Change comments in `Add<&Felt252> for u64` * Fix: wasn't indexing properly :P * Override default `div_mod_floor` impl for Felt252 * Disable swap memory before benchmarking * Reduce number of warmups and runs * Optimize `assert_le_felt` (used in math_integration_benchmark) * Use constant for zero() function * Extract division by constant * Use BigUint in assert_le_felt This part uses comparisons and integer division (that use `to_biguint`), so it's better to use `BigUints` directly. * Avoid calling `BigInt::abs` * Update changelog * Add tests for felt * Add TODO * Add other texts * Update lambdaworks to latest * Revert hyperfine arguments to main * Remove unneeded clones and into_owneds * Remove unneeded references and clones * Add BREAKING note to changelog * Make Felt252::one just copy a constant * Impl From<bool> for Felt252 * Change some uses of get_ref with get_mut_ref Using `get_ref` and later updating the variable with an `exec_scopes.insert_value(...)` causes two lookups in a hashmap, along with two creation of `String` from a slice. This change reduces it to just a single lookup and `String` creation. * Unify mem*_continue_* functions * Run benchmarks sequentially to avoid mem issues * Use div_mod_floor instead of div and mod * Use BigUint for non-modular calculations * Add TODO * Include both lib.rs * Fix lib_bigint_felt * Add test-lambdaworks-felt workflow * Fix failling example * Move extern crate import to lib.rs * Update changelog * Fix changelog * Fix example * Remove benchmark docs * Remove clone * Move crate-level attribute to lib.rs * Fix changelog * Remove blank line in toml * Use one line cfg directives * Remove reference * Restore clone * Fix doc test * Add `lambdaworks-felt` feature to vm crate * Add instructions to (de)activate the new feature * Use different matrix group for lambdaworks felt in CI * Move the sections a bit * Update lambdaworks-math version to 0.1.1 * Invert the part talking about features --------- Co-authored-by: Pedro Fontana <fontana.pedro93@gmail.com> Co-authored-by: Tomá <47506558+MegaRedHand@users.noreply.github.com> Co-authored-by: Mario Rugiero <mrugiero@gmail.com>
kariy
pushed a commit
to dojoengine/cairo-rs
that referenced
this pull request
Jul 25, 2023
…ambdaclass#1281) * wip * Manually implement some common derives Also comment `from` impls for primitive numbers and (De)Serialize derives * Implement FromPrimitive * Implement ToPrimitive * Add BitAnd/Xor/Or implementations * Implement bit shift operators * Remove Signed implementation * Remove Integer impl * Impl Bounded * Impl from_str_radix * Add iter_u64_digits impl * Add Add impls * Add Sub impls * Patch arbitrary * Fix some warnings * Implement parse_bytes * Implement utility methods for tests * Fix test compilation errors * Add From impl for signed primitive nums * Impl From<BigInt> * Re-add bits fn * Impl Signed * Impl (De)Serialize * Fix compile errors and clippy suggestions * Pin cairo 1 compiler version * Reorder impls * Fix compile error * Fix various errors (tests pass!) * Remove to_bytes_be * Fix panicky from_bytes_be * Fix is_positive * Fix str conversions * Add documentation * Fix from_i64 accepting negative numbers * Use BigUint in from_bytes_be * Remove unneded field macro * Pin lambdaworks commit * Fix keccak * Fix from_i64 condition was reversed * Change Debug::fmt to return number in decimal * Appease clippy in felt crate * Silence clippy warning (for now) * Fix nostd error * Update lambdaworks to latest revision * Update rust version in CI * Change sqrt for lambdaworks' * Manually build BigDigits on to_biguint * Use a bigger number of iterations for square bench * Update lambdaworks-math revision * Fix sqrt tests and Shl/Shr impl (+add tests) * Update Cargo.lock * Appease clippy and fix Shr<usize> * Square input instead of using prop_assume * Revert the change to Shr * Appease clippy * Use bits instead of shl in range check * Remove `FeltBigInt` * Add lamdaworks-benchmarks.sh * Add lamdaworks-benchmarks.md * Update lamdaworks-benchmarks.md * Update commits * Update .md commits * Looooong benchmark * Remove bigbox clippy allow * Update lambdaworks to latest, and change AddAssign * Remove `-P` option in `xargs` In the measurements we got through `perf`, there were 3 to 4 times more page faults compared to base. This can be explained by the runner using swap memory because of the increase in memory usage. We can fix it by reducing the amount of processes ran in parallel by xargs (2 -> 1) * Change `to_(b|l)e_bytes` to not use lw primitives * Change comments in `Add<&Felt252> for u64` * Fix: wasn't indexing properly :P * Override default `div_mod_floor` impl for Felt252 * Disable swap memory before benchmarking * Reduce number of warmups and runs * Optimize `assert_le_felt` (used in math_integration_benchmark) * Use constant for zero() function * Extract division by constant * Use BigUint in assert_le_felt This part uses comparisons and integer division (that use `to_biguint`), so it's better to use `BigUints` directly. * Avoid calling `BigInt::abs` * Update changelog * Add tests for felt * Add TODO * Add other texts * Update lambdaworks to latest * Revert hyperfine arguments to main * Remove unneeded clones and into_owneds * Remove unneeded references and clones * Add BREAKING note to changelog * Make Felt252::one just copy a constant * Impl From<bool> for Felt252 * Change some uses of get_ref with get_mut_ref Using `get_ref` and later updating the variable with an `exec_scopes.insert_value(...)` causes two lookups in a hashmap, along with two creation of `String` from a slice. This change reduces it to just a single lookup and `String` creation. * Unify mem*_continue_* functions * Run benchmarks sequentially to avoid mem issues * Use div_mod_floor instead of div and mod * Use BigUint for non-modular calculations * Add TODO * Include both lib.rs * Fix lib_bigint_felt * Add test-lambdaworks-felt workflow * Fix failling example * Move extern crate import to lib.rs * Update changelog * Fix changelog * Fix example * Remove benchmark docs * Remove clone * Move crate-level attribute to lib.rs * Fix changelog * Remove blank line in toml * Use one line cfg directives * Remove reference * Restore clone * Fix doc test * Add `lambdaworks-felt` feature to vm crate * Add instructions to (de)activate the new feature * Use different matrix group for lambdaworks felt in CI * Move the sections a bit * Update lambdaworks-math version to 0.1.1 * Invert the part talking about features --------- Co-authored-by: Pedro Fontana <fontana.pedro93@gmail.com> Co-authored-by: Tomá <47506558+MegaRedHand@users.noreply.github.com> Co-authored-by: Mario Rugiero <mrugiero@gmail.com>
kariy
pushed a commit
to dojoengine/cairo-rs
that referenced
this pull request
Jul 25, 2023
…ambdaclass#1281) * wip * Manually implement some common derives Also comment `from` impls for primitive numbers and (De)Serialize derives * Implement FromPrimitive * Implement ToPrimitive * Add BitAnd/Xor/Or implementations * Implement bit shift operators * Remove Signed implementation * Remove Integer impl * Impl Bounded * Impl from_str_radix * Add iter_u64_digits impl * Add Add impls * Add Sub impls * Patch arbitrary * Fix some warnings * Implement parse_bytes * Implement utility methods for tests * Fix test compilation errors * Add From impl for signed primitive nums * Impl From<BigInt> * Re-add bits fn * Impl Signed * Impl (De)Serialize * Fix compile errors and clippy suggestions * Pin cairo 1 compiler version * Reorder impls * Fix compile error * Fix various errors (tests pass!) * Remove to_bytes_be * Fix panicky from_bytes_be * Fix is_positive * Fix str conversions * Add documentation * Fix from_i64 accepting negative numbers * Use BigUint in from_bytes_be * Remove unneded field macro * Pin lambdaworks commit * Fix keccak * Fix from_i64 condition was reversed * Change Debug::fmt to return number in decimal * Appease clippy in felt crate * Silence clippy warning (for now) * Fix nostd error * Update lambdaworks to latest revision * Update rust version in CI * Change sqrt for lambdaworks' * Manually build BigDigits on to_biguint * Use a bigger number of iterations for square bench * Update lambdaworks-math revision * Fix sqrt tests and Shl/Shr impl (+add tests) * Update Cargo.lock * Appease clippy and fix Shr<usize> * Square input instead of using prop_assume * Revert the change to Shr * Appease clippy * Use bits instead of shl in range check * Remove `FeltBigInt` * Add lamdaworks-benchmarks.sh * Add lamdaworks-benchmarks.md * Update lamdaworks-benchmarks.md * Update commits * Update .md commits * Looooong benchmark * Remove bigbox clippy allow * Update lambdaworks to latest, and change AddAssign * Remove `-P` option in `xargs` In the measurements we got through `perf`, there were 3 to 4 times more page faults compared to base. This can be explained by the runner using swap memory because of the increase in memory usage. We can fix it by reducing the amount of processes ran in parallel by xargs (2 -> 1) * Change `to_(b|l)e_bytes` to not use lw primitives * Change comments in `Add<&Felt252> for u64` * Fix: wasn't indexing properly :P * Override default `div_mod_floor` impl for Felt252 * Disable swap memory before benchmarking * Reduce number of warmups and runs * Optimize `assert_le_felt` (used in math_integration_benchmark) * Use constant for zero() function * Extract division by constant * Use BigUint in assert_le_felt This part uses comparisons and integer division (that use `to_biguint`), so it's better to use `BigUints` directly. * Avoid calling `BigInt::abs` * Update changelog * Add tests for felt * Add TODO * Add other texts * Update lambdaworks to latest * Revert hyperfine arguments to main * Remove unneeded clones and into_owneds * Remove unneeded references and clones * Add BREAKING note to changelog * Make Felt252::one just copy a constant * Impl From<bool> for Felt252 * Change some uses of get_ref with get_mut_ref Using `get_ref` and later updating the variable with an `exec_scopes.insert_value(...)` causes two lookups in a hashmap, along with two creation of `String` from a slice. This change reduces it to just a single lookup and `String` creation. * Unify mem*_continue_* functions * Run benchmarks sequentially to avoid mem issues * Use div_mod_floor instead of div and mod * Use BigUint for non-modular calculations * Add TODO * Include both lib.rs * Fix lib_bigint_felt * Add test-lambdaworks-felt workflow * Fix failling example * Move extern crate import to lib.rs * Update changelog * Fix changelog * Fix example * Remove benchmark docs * Remove clone * Move crate-level attribute to lib.rs * Fix changelog * Remove blank line in toml * Use one line cfg directives * Remove reference * Restore clone * Fix doc test * Add `lambdaworks-felt` feature to vm crate * Add instructions to (de)activate the new feature * Use different matrix group for lambdaworks felt in CI * Move the sections a bit * Update lambdaworks-math version to 0.1.1 * Invert the part talking about features --------- Co-authored-by: Pedro Fontana <fontana.pedro93@gmail.com> Co-authored-by: Tomá <47506558+MegaRedHand@users.noreply.github.com> Co-authored-by: Mario Rugiero <mrugiero@gmail.com>
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.
Notes: Further refactor is needed to make both impls swappable backends for the same
Felts252
abstractionChecklist