-
Notifications
You must be signed in to change notification settings - Fork 226
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(ssa): Treat globals as constant in a function's DFG #7040
Conversation
Co-authored-by: jfecher <[email protected]>
Compilation Memory 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.
Looks good!
Changes to number of Brillig opcodes executed
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Nice, looks like we already see some benefits with different inliner aggressiveness settings. There looks to be some slight regressions as well. This is most likely due to us still repeating certain initialization of globals and will require #7021. |
…oir-lang/noir#7040) chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069) fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073)
noir-lang/noir#7078) feat(ssa): Treat globals as constant in a function's DFG (noir-lang/noir#7040) chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069) fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073)
…/noir#7078) feat(ssa): Treat globals as constant in a function's DFG (noir-lang/noir#7040) chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069) fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073)
feat: add `ConstrainNotEqual` instruction (noir-lang/noir#7032) feat!: `loop` statements (only frontend) (noir-lang/noir#7092) fix!: Include kind in `StructDefinition::generics` and fix derivation of Eq in structs with numeric generics (noir-lang/noir#7076) chore: add test for isuee #7090 (noir-lang/noir#7091) chore: mark `noir-edwards` as expected to compile (noir-lang/noir#7085) chore: allow passing custom conditions to inlining pass (noir-lang/noir#7083) feat(LSP): auto-import trait reexport if trait is not visible (noir-lang/noir#7079) fix: Allow implicit associated types on integer type kinds (noir-lang/noir#7078) feat(ssa): Treat globals as constant in a function's DFG (noir-lang/noir#7040) chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069) fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073)
feat: add `ConstrainNotEqual` instruction (noir-lang/noir#7032) feat!: `loop` statements (only frontend) (noir-lang/noir#7092) fix!: Include kind in `StructDefinition::generics` and fix derivation of Eq in structs with numeric generics (noir-lang/noir#7076) chore: add test for isuee #7090 (noir-lang/noir#7091) chore: mark `noir-edwards` as expected to compile (noir-lang/noir#7085) chore: allow passing custom conditions to inlining pass (noir-lang/noir#7083) feat(LSP): auto-import trait reexport if trait is not visible (noir-lang/noir#7079) fix: Allow implicit associated types on integer type kinds (noir-lang/noir#7078) feat(ssa): Treat globals as constant in a function's DFG (noir-lang/noir#7040) chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069) fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073)
feat: add `ConstrainNotEqual` instruction (noir-lang/noir#7032) feat!: `loop` statements (only frontend) (noir-lang/noir#7092) fix!: Include kind in `StructDefinition::generics` and fix derivation of Eq in structs with numeric generics (noir-lang/noir#7076) chore: add test for isuee #7090 (noir-lang/noir#7091) chore: mark `noir-edwards` as expected to compile (noir-lang/noir#7085) chore: allow passing custom conditions to inlining pass (noir-lang/noir#7083) feat(LSP): auto-import trait reexport if trait is not visible (noir-lang/noir#7079) fix: Allow implicit associated types on integer type kinds (noir-lang/noir#7078) feat(ssa): Treat globals as constant in a function's DFG (noir-lang/noir#7040) chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069) fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073)
Automated pull of development from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: add regression test for #6530 (noir-lang/noir#7089) feat: add `ConstrainNotEqual` instruction (noir-lang/noir#7032) feat!: `loop` statements (only frontend) (noir-lang/noir#7092) fix!: Include kind in `StructDefinition::generics` and fix derivation of Eq in structs with numeric generics (noir-lang/noir#7076) chore: add test for isuee #7090 (noir-lang/noir#7091) chore: mark `noir-edwards` as expected to compile (noir-lang/noir#7085) chore: allow passing custom conditions to inlining pass (noir-lang/noir#7083) feat(LSP): auto-import trait reexport if trait is not visible (noir-lang/noir#7079) fix: Allow implicit associated types on integer type kinds (noir-lang/noir#7078) feat(ssa): Treat globals as constant in a function's DFG (noir-lang/noir#7040) chore: Do not make new instruction if it hasn't changed (noir-lang/noir#7069) fix: do not remove memory blocks used as brillig input (noir-lang/noir#7073) END_COMMIT_OVERRIDE --------- Co-authored-by: Tom French <[email protected]>
Description
Problem*
Resolves TODO leftover from #6985
Also mentioned in this comment #7021 (comment).
Summary*
In order to re-use our existing instruction simplification we need to be able to access globals inside of the DFG. In order to do this I have created a new
GlobalsGraph
type that now exists as anArc<GlobalsGraph>
in theDataFlowGraph
.Arc
is used so that we can share theGlobalsGraph
across all functions. However, we will have to eat a cloning cost as we now place the globals information in all functions rather than simply placing it in the mainSsa
object.Additional Context
In #6985 we only added a
Value::Global
, but globals support both numeric constants and array constants. This means that we can have overlapping instruction ids in the function graph and the globals graph. To avoid having to add placeholder instructions like we do for values, when checking for a constant array instruction we also check whether the value tied to that instruction is specified as a global. If the instruction is specified as global we look for the instruction in the globals graph.Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.