-
Notifications
You must be signed in to change notification settings - Fork 250
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
fix(performance): Accurately mark safe constant indices for arrays of complex types #7491
Conversation
Changes to Brillig bytecode sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to number of Brillig opcodes executed
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
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.
Nice catch!
* master: feat(experimental): Support struct constructors in match patterns (#7489) feat: use resolved type instead of needing Constructor.struct_type (#7500) feat: better error message when keyword is found instead of type in p… (#7501) chore: bump external pinned commits (#7497) feat(experimental): Add invalid pattern syntax error (#7487) fix(performance): Accurately mark safe constant indices for arrays of complex types (#7491)
* master: (74 commits) feat: optimize out range checks on limiting cases (#7510) chore: clippy fixes (#7505) chore(docs): Supplement docs on `modexp` as a required precompile for Barretenberg's Solidity verifier (#7508) feat(debugger): REPL add breakpoint by sourcecode line (#5204) fix: issue duplicate error on impl function without self (#7490) feat(experimental): Support struct constructors in match patterns (#7489) feat: use resolved type instead of needing Constructor.struct_type (#7500) feat: better error message when keyword is found instead of type in p… (#7501) chore: bump external pinned commits (#7497) feat(experimental): Add invalid pattern syntax error (#7487) fix(performance): Accurately mark safe constant indices for arrays of complex types (#7491) fix(experimental): Allow shadowing in match patterns (#7484) chore: regression test #7195 (#7233) chore(docs): Section on `noir-profiler execution-opcodes` (#7480) chore: improve proptesting of 128bit values in `noirc_abi` (#7485) chore(profiler): Use brillig names for outputted flamegraphs (#7470) chore(docs): Profiler images reference (#7481) fix: don't use dummy location when inserting debug code (#7482) feat(cli)!: Add `--unstable-features` to gate unstable features (#7449) feat: Sync from aztec-packages (#7474) ...
feat: let all compiler errors carry a Location instead of a Span (noir-lang/noir#7486) chore: Increaes base64's allotted time (noir-lang/noir#7521) fix: don't crash on broken impl syntax (noir-lang/noir#7512) feat: optimize out range checks on limiting cases (noir-lang/noir#7510) chore: clippy fixes (noir-lang/noir#7505) chore(docs): Supplement docs on `modexp` as a required precompile for Barretenberg's Solidity verifier (noir-lang/noir#7508) feat(debugger): REPL add breakpoint by sourcecode line (noir-lang/noir#5204) fix: issue duplicate error on impl function without self (noir-lang/noir#7490) feat(experimental): Support struct constructors in match patterns (noir-lang/noir#7489) feat: use resolved type instead of needing Constructor.struct_type (noir-lang/noir#7500) feat: better error message when keyword is found instead of type in p… (noir-lang/noir#7501) chore: bump external pinned commits (noir-lang/noir#7497) feat(experimental): Add invalid pattern syntax error (noir-lang/noir#7487) fix(performance): Accurately mark safe constant indices for arrays of complex types (noir-lang/noir#7491) fix(experimental): Allow shadowing in match patterns (noir-lang/noir#7484) chore: regression test #7195 (noir-lang/noir#7233) chore(docs): Section on `noir-profiler execution-opcodes` (noir-lang/noir#7480) chore: improve proptesting of 128bit values in `noirc_abi` (noir-lang/noir#7485) chore(profiler): Use brillig names for outputted flamegraphs (noir-lang/noir#7470) chore(docs): Profiler images reference (noir-lang/noir#7481) fix: don't use dummy location when inserting debug code (noir-lang/noir#7482) feat(cli)!: Add `--unstable-features` to gate unstable features (noir-lang/noir#7449)
Automated pull of development from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: bump external pinned commits (noir-lang/noir#7515) feat: let all compiler errors carry a Location instead of a Span (noir-lang/noir#7486) chore: Increaes base64's allotted time (noir-lang/noir#7521) fix: don't crash on broken impl syntax (noir-lang/noir#7512) feat: optimize out range checks on limiting cases (noir-lang/noir#7510) chore: clippy fixes (noir-lang/noir#7505) chore(docs): Supplement docs on `modexp` as a required precompile for Barretenberg's Solidity verifier (noir-lang/noir#7508) feat(debugger): REPL add breakpoint by sourcecode line (noir-lang/noir#5204) fix: issue duplicate error on impl function without self (noir-lang/noir#7490) feat(experimental): Support struct constructors in match patterns (noir-lang/noir#7489) feat: use resolved type instead of needing Constructor.struct_type (noir-lang/noir#7500) feat: better error message when keyword is found instead of type in p… (noir-lang/noir#7501) chore: bump external pinned commits (noir-lang/noir#7497) feat(experimental): Add invalid pattern syntax error (noir-lang/noir#7487) fix(performance): Accurately mark safe constant indices for arrays of complex types (noir-lang/noir#7491) fix(experimental): Allow shadowing in match patterns (noir-lang/noir#7484) chore: regression test #7195 (noir-lang/noir#7233) chore(docs): Section on `noir-profiler execution-opcodes` (noir-lang/noir#7480) chore: improve proptesting of 128bit values in `noirc_abi` (noir-lang/noir#7485) chore(profiler): Use brillig names for outputted flamegraphs (noir-lang/noir#7470) chore(docs): Profiler images reference (noir-lang/noir#7481) fix: don't use dummy location when inserting debug code (noir-lang/noir#7482) feat(cli)!: Add `--unstable-features` to gate unstable features (noir-lang/noir#7449) END_COMMIT_OVERRIDE --------- Co-authored-by: guipublic <guipublic@gmail.com> Co-authored-by: guipublic <47281315+guipublic@users.noreply.github.com>
Description
Problem*
No issue but something I noticed while working towards Brillig execution trace optimizations.
We flatten complex types within arrays.
For example this program:
Will have the following SSA:
When it comes times to generate Brillig we will check whether to generate bytecode for array index validation by checking this method:
noir/compiler/noirc_evaluator/src/ssa/ir/dfg.rs
Line 658 in 8e68ce6
We are only checkling the
len
fromType::Array(..)
. Calling this method will thus fail for all of the above array gets. Even though we know the array index is safe.Summary*
Use the elements array in
Type::Array(elements, len)
and check the index againstelements.len() * len
.Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.