-
Notifications
You must be signed in to change notification settings - Fork 222
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
chore: simplify boolean in a mul of a mul #6951
Merged
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
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Compilation Report
|
Execution Report
|
Compilation Memory Report
|
Execution Memory Report
|
This PR drops the number of opcodes in |
TomAFrench
approved these changes
Jan 6, 2025
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.
LGTM!
AztecBot
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jan 7, 2025
…oir#6926) chore: simplify boolean in a mul of a mul (noir-lang/noir#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (noir-lang/noir#6893) chore: Move comment as part of #6945 (noir-lang/noir#6959) chore: Separate unconstrained functions during monomorphization (noir-lang/noir#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (noir-lang/noir#6952) feat: lock on Nargo.toml on several nargo commands (noir-lang/noir#6941) feat: don't simplify SSA instructions when creating them from a string (noir-lang/noir#6948) chore: add reproduction case for bignum test failure (noir-lang/noir#6464) chore: bump `noir-gates-diff` (noir-lang/noir#6949) feat(test): Enable the test fuzzer for Wasm (noir-lang/noir#6835) chore: also print test output to stdout in CI (noir-lang/noir#6930) fix: Non-determinism from under constrained checks (noir-lang/noir#6945) chore: use logs for benchmarking (noir-lang/noir#6911) chore: bump `noir-gates-diff` (noir-lang/noir#6944) chore: bump `noir-gates-diff` (noir-lang/noir#6943) fix: Show output of `test_program_is_idempotent` on failure (noir-lang/noir#6942) chore: delete a bunch of dead code from `noirc_evaluator` (noir-lang/noir#6939) feat: require trait function calls (`Foo::bar()`) to have the trait in scope (imported) (noir-lang/noir#6882) chore: Bump arkworks to version `0.5.0` (noir-lang/noir#6871)
AztecBot
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jan 7, 2025
chore: simplify boolean in a mul of a mul (noir-lang/noir#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (noir-lang/noir#6893) chore: Move comment as part of #6945 (noir-lang/noir#6959) chore: Separate unconstrained functions during monomorphization (noir-lang/noir#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (noir-lang/noir#6952) feat: lock on Nargo.toml on several nargo commands (noir-lang/noir#6941) feat: don't simplify SSA instructions when creating them from a string (noir-lang/noir#6948) chore: add reproduction case for bignum test failure (noir-lang/noir#6464) chore: bump `noir-gates-diff` (noir-lang/noir#6949) feat(test): Enable the test fuzzer for Wasm (noir-lang/noir#6835) chore: also print test output to stdout in CI (noir-lang/noir#6930) fix: Non-determinism from under constrained checks (noir-lang/noir#6945) chore: use logs for benchmarking (noir-lang/noir#6911) chore: bump `noir-gates-diff` (noir-lang/noir#6944) chore: bump `noir-gates-diff` (noir-lang/noir#6943) fix: Show output of `test_program_is_idempotent` on failure (noir-lang/noir#6942) chore: delete a bunch of dead code from `noirc_evaluator` (noir-lang/noir#6939) feat: require trait function calls (`Foo::bar()`) to have the trait in scope (imported) (noir-lang/noir#6882) chore: Bump arkworks to version `0.5.0` (noir-lang/noir#6871)
AztecBot
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jan 7, 2025
) feat: `--pedantic-solving` flag (noir-lang/noir#6716) feat!: update `aes128_encrypt` to return an array (noir-lang/noir#6973) fix: wrong module to lookup trait when using crate or super (noir-lang/noir#6974) fix: Start RC at 1 again (noir-lang/noir#6958) feat!: turn TypeIsMorePrivateThenItem into an error (noir-lang/noir#6953) fix: don't fail parsing macro if there are parser warnings (noir-lang/noir#6969) fix: error on missing function parameters (noir-lang/noir#6967) feat: don't report warnings for dependencies (noir-lang/noir#6926) chore: simplify boolean in a mul of a mul (noir-lang/noir#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (noir-lang/noir#6893) chore: Move comment as part of #6945 (noir-lang/noir#6959) chore: Separate unconstrained functions during monomorphization (noir-lang/noir#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (noir-lang/noir#6952) feat: lock on Nargo.toml on several nargo commands (noir-lang/noir#6941) feat: don't simplify SSA instructions when creating them from a string (noir-lang/noir#6948) chore: add reproduction case for bignum test failure (noir-lang/noir#6464) chore: bump `noir-gates-diff` (noir-lang/noir#6949) feat(test): Enable the test fuzzer for Wasm (noir-lang/noir#6835) chore: also print test output to stdout in CI (noir-lang/noir#6930) fix: Non-determinism from under constrained checks (noir-lang/noir#6945) chore: use logs for benchmarking (noir-lang/noir#6911) chore: bump `noir-gates-diff` (noir-lang/noir#6944) chore: bump `noir-gates-diff` (noir-lang/noir#6943) fix: Show output of `test_program_is_idempotent` on failure (noir-lang/noir#6942) chore: delete a bunch of dead code from `noirc_evaluator` (noir-lang/noir#6939) feat: require trait function calls (`Foo::bar()`) to have the trait in scope (imported) (noir-lang/noir#6882) chore: Bump arkworks to version `0.5.0` (noir-lang/noir#6871)
AztecBot
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jan 7, 2025
feat: `--pedantic-solving` flag (noir-lang/noir#6716) feat!: update `aes128_encrypt` to return an array (noir-lang/noir#6973) fix: wrong module to lookup trait when using crate or super (noir-lang/noir#6974) fix: Start RC at 1 again (noir-lang/noir#6958) feat!: turn TypeIsMorePrivateThenItem into an error (noir-lang/noir#6953) fix: don't fail parsing macro if there are parser warnings (noir-lang/noir#6969) fix: error on missing function parameters (noir-lang/noir#6967) feat: don't report warnings for dependencies (noir-lang/noir#6926) chore: simplify boolean in a mul of a mul (noir-lang/noir#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (noir-lang/noir#6893) chore: Move comment as part of #6945 (noir-lang/noir#6959) chore: Separate unconstrained functions during monomorphization (noir-lang/noir#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (noir-lang/noir#6952) feat: lock on Nargo.toml on several nargo commands (noir-lang/noir#6941) feat: don't simplify SSA instructions when creating them from a string (noir-lang/noir#6948) chore: add reproduction case for bignum test failure (noir-lang/noir#6464) chore: bump `noir-gates-diff` (noir-lang/noir#6949) feat(test): Enable the test fuzzer for Wasm (noir-lang/noir#6835) chore: also print test output to stdout in CI (noir-lang/noir#6930) fix: Non-determinism from under constrained checks (noir-lang/noir#6945) chore: use logs for benchmarking (noir-lang/noir#6911) chore: bump `noir-gates-diff` (noir-lang/noir#6944) chore: bump `noir-gates-diff` (noir-lang/noir#6943) fix: Show output of `test_program_is_idempotent` on failure (noir-lang/noir#6942) chore: delete a bunch of dead code from `noirc_evaluator` (noir-lang/noir#6939) feat: require trait function calls (`Foo::bar()`) to have the trait in scope (imported) (noir-lang/noir#6882) chore: Bump arkworks to version `0.5.0` (noir-lang/noir#6871)
TomAFrench
added a commit
that referenced
this pull request
Jan 8, 2025
* master: (51 commits) feat!: type-check trait default methods (#6645) feat: `--pedantic-solving` flag (#6716) feat!: update `aes128_encrypt` to return an array (#6973) fix: wrong module to lookup trait when using crate or super (#6974) fix: Start RC at 1 again (#6958) feat!: turn TypeIsMorePrivateThenItem into an error (#6953) fix: don't fail parsing macro if there are parser warnings (#6969) fix: error on missing function parameters (#6967) feat: don't report warnings for dependencies (#6926) chore: simplify boolean in a mul of a mul (#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (#6893) chore: Move comment as part of #6945 (#6959) chore: Separate unconstrained functions during monomorphization (#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (#6952) feat: lock on Nargo.toml on several nargo commands (#6941) feat: don't simplify SSA instructions when creating them from a string (#6948) chore: add reproduction case for bignum test failure (#6464) chore: bump `noir-gates-diff` (#6949) feat(test): Enable the test fuzzer for Wasm (#6835) chore: also print test output to stdout in CI (#6930) ...
AztecBot
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jan 8, 2025
) feat: `--pedantic-solving` flag (noir-lang/noir#6716) feat!: update `aes128_encrypt` to return an array (noir-lang/noir#6973) fix: wrong module to lookup trait when using crate or super (noir-lang/noir#6974) fix: Start RC at 1 again (noir-lang/noir#6958) feat!: turn TypeIsMorePrivateThenItem into an error (noir-lang/noir#6953) fix: don't fail parsing macro if there are parser warnings (noir-lang/noir#6969) fix: error on missing function parameters (noir-lang/noir#6967) feat: don't report warnings for dependencies (noir-lang/noir#6926) chore: simplify boolean in a mul of a mul (noir-lang/noir#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (noir-lang/noir#6893) chore: Move comment as part of #6945 (noir-lang/noir#6959) chore: Separate unconstrained functions during monomorphization (noir-lang/noir#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (noir-lang/noir#6952) feat: lock on Nargo.toml on several nargo commands (noir-lang/noir#6941) feat: don't simplify SSA instructions when creating them from a string (noir-lang/noir#6948) chore: add reproduction case for bignum test failure (noir-lang/noir#6464) chore: bump `noir-gates-diff` (noir-lang/noir#6949) feat(test): Enable the test fuzzer for Wasm (noir-lang/noir#6835) chore: also print test output to stdout in CI (noir-lang/noir#6930) fix: Non-determinism from under constrained checks (noir-lang/noir#6945) chore: use logs for benchmarking (noir-lang/noir#6911) chore: bump `noir-gates-diff` (noir-lang/noir#6944) chore: bump `noir-gates-diff` (noir-lang/noir#6943) fix: Show output of `test_program_is_idempotent` on failure (noir-lang/noir#6942) chore: delete a bunch of dead code from `noirc_evaluator` (noir-lang/noir#6939) feat: require trait function calls (`Foo::bar()`) to have the trait in scope (imported) (noir-lang/noir#6882) chore: Bump arkworks to version `0.5.0` (noir-lang/noir#6871)
AztecBot
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jan 8, 2025
feat: `--pedantic-solving` flag (noir-lang/noir#6716) feat!: update `aes128_encrypt` to return an array (noir-lang/noir#6973) fix: wrong module to lookup trait when using crate or super (noir-lang/noir#6974) fix: Start RC at 1 again (noir-lang/noir#6958) feat!: turn TypeIsMorePrivateThenItem into an error (noir-lang/noir#6953) fix: don't fail parsing macro if there are parser warnings (noir-lang/noir#6969) fix: error on missing function parameters (noir-lang/noir#6967) feat: don't report warnings for dependencies (noir-lang/noir#6926) chore: simplify boolean in a mul of a mul (noir-lang/noir#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (noir-lang/noir#6893) chore: Move comment as part of #6945 (noir-lang/noir#6959) chore: Separate unconstrained functions during monomorphization (noir-lang/noir#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (noir-lang/noir#6952) feat: lock on Nargo.toml on several nargo commands (noir-lang/noir#6941) feat: don't simplify SSA instructions when creating them from a string (noir-lang/noir#6948) chore: add reproduction case for bignum test failure (noir-lang/noir#6464) chore: bump `noir-gates-diff` (noir-lang/noir#6949) feat(test): Enable the test fuzzer for Wasm (noir-lang/noir#6835) chore: also print test output to stdout in CI (noir-lang/noir#6930) fix: Non-determinism from under constrained checks (noir-lang/noir#6945) chore: use logs for benchmarking (noir-lang/noir#6911) chore: bump `noir-gates-diff` (noir-lang/noir#6944) chore: bump `noir-gates-diff` (noir-lang/noir#6943) fix: Show output of `test_program_is_idempotent` on failure (noir-lang/noir#6942) chore: delete a bunch of dead code from `noirc_evaluator` (noir-lang/noir#6939) feat: require trait function calls (`Foo::bar()`) to have the trait in scope (imported) (noir-lang/noir#6882) chore: Bump arkworks to version `0.5.0` (noir-lang/noir#6871)
Rumata888
pushed a commit
that referenced
this pull request
Jan 8, 2025
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
AztecBot
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jan 8, 2025
fix: Do not emit range check for multiplication by bool (noir-lang/noir#6983) fix: do not panic on indices which are not valid `u32`s (noir-lang/noir#6976) feat!: require trait method calls (`foo.bar()`) to have the trait in scope (imported) (noir-lang/noir#6895) feat!: type-check trait default methods (noir-lang/noir#6645) feat: `--pedantic-solving` flag (noir-lang/noir#6716) feat!: update `aes128_encrypt` to return an array (noir-lang/noir#6973) fix: wrong module to lookup trait when using crate or super (noir-lang/noir#6974) fix: Start RC at 1 again (noir-lang/noir#6958) feat!: turn TypeIsMorePrivateThenItem into an error (noir-lang/noir#6953) fix: don't fail parsing macro if there are parser warnings (noir-lang/noir#6969) fix: error on missing function parameters (noir-lang/noir#6967) feat: don't report warnings for dependencies (noir-lang/noir#6926) chore: simplify boolean in a mul of a mul (noir-lang/noir#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (noir-lang/noir#6893) chore: Move comment as part of #6945 (noir-lang/noir#6959) chore: Separate unconstrained functions during monomorphization (noir-lang/noir#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (noir-lang/noir#6952) feat: lock on Nargo.toml on several nargo commands (noir-lang/noir#6941) feat: don't simplify SSA instructions when creating them from a string (noir-lang/noir#6948) chore: add reproduction case for bignum test failure (noir-lang/noir#6464) chore: bump `noir-gates-diff` (noir-lang/noir#6949) feat(test): Enable the test fuzzer for Wasm (noir-lang/noir#6835) chore: also print test output to stdout in CI (noir-lang/noir#6930) fix: Non-determinism from under constrained checks (noir-lang/noir#6945) chore: use logs for benchmarking (noir-lang/noir#6911) chore: bump `noir-gates-diff` (noir-lang/noir#6944) chore: bump `noir-gates-diff` (noir-lang/noir#6943) fix: Show output of `test_program_is_idempotent` on failure (noir-lang/noir#6942) chore: delete a bunch of dead code from `noirc_evaluator` (noir-lang/noir#6939) feat: require trait function calls (`Foo::bar()`) to have the trait in scope (imported) (noir-lang/noir#6882) chore: Bump arkworks to version `0.5.0` (noir-lang/noir#6871)
AztecBot
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jan 8, 2025
fix: Do not emit range check for multiplication by bool (noir-lang/noir#6983) fix: do not panic on indices which are not valid `u32`s (noir-lang/noir#6976) feat!: require trait method calls (`foo.bar()`) to have the trait in scope (imported) (noir-lang/noir#6895) feat!: type-check trait default methods (noir-lang/noir#6645) feat: `--pedantic-solving` flag (noir-lang/noir#6716) feat!: update `aes128_encrypt` to return an array (noir-lang/noir#6973) fix: wrong module to lookup trait when using crate or super (noir-lang/noir#6974) fix: Start RC at 1 again (noir-lang/noir#6958) feat!: turn TypeIsMorePrivateThenItem into an error (noir-lang/noir#6953) fix: don't fail parsing macro if there are parser warnings (noir-lang/noir#6969) fix: error on missing function parameters (noir-lang/noir#6967) feat: don't report warnings for dependencies (noir-lang/noir#6926) chore: simplify boolean in a mul of a mul (noir-lang/noir#6951) feat(ssa): Immediately simplify away RefCount instructions in ACIR functions (noir-lang/noir#6893) chore: Move comment as part of #6945 (noir-lang/noir#6959) chore: Separate unconstrained functions during monomorphization (noir-lang/noir#6894) feat!: turn CannotReexportItemWithLessVisibility into an error (noir-lang/noir#6952) feat: lock on Nargo.toml on several nargo commands (noir-lang/noir#6941) feat: don't simplify SSA instructions when creating them from a string (noir-lang/noir#6948) chore: add reproduction case for bignum test failure (noir-lang/noir#6464) chore: bump `noir-gates-diff` (noir-lang/noir#6949) feat(test): Enable the test fuzzer for Wasm (noir-lang/noir#6835) chore: also print test output to stdout in CI (noir-lang/noir#6930) fix: Non-determinism from under constrained checks (noir-lang/noir#6945) chore: use logs for benchmarking (noir-lang/noir#6911) chore: bump `noir-gates-diff` (noir-lang/noir#6944) chore: bump `noir-gates-diff` (noir-lang/noir#6943) fix: Show output of `test_program_is_idempotent` on failure (noir-lang/noir#6942) chore: delete a bunch of dead code from `noirc_evaluator` (noir-lang/noir#6939) feat: require trait function calls (`Foo::bar()`) to have the trait in scope (imported) (noir-lang/noir#6882) chore: Bump arkworks to version `0.5.0` (noir-lang/noir#6871)
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.
Description
Problem*
Resolves #6879
Summary*
When multiplying a boolean with the result of another multiplication involving the same boolean, we can discard one multiplication.
Additional Context
The regression is a bit subtle, the optimisation introduced by PR #6875 was simplifying an ifesle instruction if one of its operand is also an ifelse with the same condition.
When the operands are an array and the array with one element modified, the merge of values only happens on the modified element, which induces only one multiplication.
However, when the array is a result of of an ifelse, the optimisation from #6875 replace it with another array (the operand of the inner ifselse). So we are no longer merging two almost identical arrays, and we get one multiplication per array element instead.
So basically, the optimisation is preventing another optimisation.
I could not find a way to get the two optimisation to be effective at the same time. The value merge is done when we eliminate IfElse, so the #6875 must be done before. But then the link between the arrays is not obvious.
Fortunately, since this happens when we have inner If statements with the same condition, that means we are multiplying several times with the condition, and this can be optimised from the instruction simplification pass.
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.