-
Notifications
You must be signed in to change notification settings - Fork 219
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: Apply optimizations to unconstrained code #2348
Conversation
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 we remove the code introduced here: #2190
I was thinking this could be a later PR, but sure |
Can you use the |
In a cruel twist of fate, this PR is also blocked on the mem2reg pass needing updates (and potentially more issues).
Which breaks mem2reg since the function is not inlined and it erroneously simplifies instructions after this function call with the old value of x. I was under the impression we didn't want to allow mutable references to be passed to Brillig functions? If we do then mem2reg needs to be updated not only to handle aliases but to handle function calls as well. |
|
I think this may be related to an error in the codegen for Brillig |
@vezenovm do you mind breaking that change into a separate PR? |
Will do |
It's probably not the most sensible to have a mutable reference and change a bunch of constrained data models in Brillig, but within Brillig I would imagine you would want to (especially if Brillig is the execution model for externally constrained e.g. Aztec public fn's) |
* master: (34 commits) chore: Decouple `noirc_abi` from frontend by introducing `PrintableType` (#2373) feat(brillig): Added locations for brillig artifacts (#2415) feat: Report compilation warnings before errors (#2398) chore: Rework `CrateGraph` to only have one root crate (#2391) chore: clippy fix (#2408) chore(deps): bump rustls-webpki from 0.101.1 to 0.101.4 (#2404) fix(acir): Attach locations to MemoryOps in ACIR (#2389) feat: Use equivalence information from equality assertions to simplify circuit (#2378) chore: fix body expr span (#2402) feat(attributes): enable custom attributes (#2395) chore: Remove `serde` from `noirc_frontend` (#2390) chore: allow parenthesizing in two type locations (#2388) chore(ci): automatically delete cache entries associated with closed PRs (#2342) feat: Perform more checks for compile-time arithmetic (#2380) chore: Remove `noirc_abi::FunctionSignature` and define in terms of HIR (#2372) feat: Update to `acvm` 0.22.0 (#2363) chore: Update committed ACIR artifacts (#2376) feat(ssa): Merge slices in if statements with witness conditions (#2347) chore: Separate frontend `Visibility` and `Distinctness` from the ABI (#2369) feat: add syntax for specifying function type environments (#2357) ...
df467e2
to
080d4b4
Compare
Was using this PR to experiment with some mem2reg changes on top of the current PR, hence the additional changes here. Optimizing |
This PR is ready for review now |
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.
Some non-blocking nits, LGTM
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Just need the ACIR artifacts to be reconciled and I can approve |
… into jf/optimize-brillig
@vezenovm should be good now |
* master: (47 commits) fix: Initialize structs during def collection, not name resolution (#2528) feat: Apply optimizations to unconstrained code (#2348) chore(ci): Distinguish between expected failures and compiler panics in `compile_failure` tests. (#2518) chore: improve types in `acvm-backend-barretenberg` (#2516) feat(aztec_noir): abstract kernel return types (#2521) chore: remove usage of `Backend` trait (#2514) chore: delete `ProveAndVerifyCommand` (#2520) chore: Remove dead code from `acvm_backend_barretenberg` (#2512) chore: only install `tokio-util` dependency on windows (#2425) chore(aztec_noir): imply the open keyword (#2508) chore: pull `acvm-backend-barretenberg` into main Noir repo (#2495) chore: clippy fix (#2507) chore: check if the noir aztec library is installed (#2505) chore: update ACIR artifacts (#2503) chore!: Update to `acvm-backend-barretenberg` v0.12.0 (#2377) fix: Bring back accidentally deleted double_verify_proof test. (#2501) chore(aztec_noir): import aztec library if not found yet (#2492) chore(abi)!: Replace struct name with fully qualified struct path (#2374) chore!: Remove keys from preprocessed artifacts (#2283) chore(noir): Release 0.10.5 (#2482) ...
Description
Problem*
Resolves #2066
Resolves #2336 - See note
Potentially addresses #2382 and #2355.
Summary*
#2336 was caused by us not removing old copies of functions if we ever failed to inline a function. While looking into it, performing a full reachability analysis to find which functions are still reachable was more difficult than just reworking inlining to count each unconstrained function as an entry point function along with main, and inline into all entry points. Once this was done I could move the generation of brillig to the end of ssa optimizations as it was no longer incompatible with inlining.
Documentation
This PR requires documentation updates when merged.
Additional Context
PR Checklist*
cargo fmt
on default settings.