You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running nargo info --force-brillig --inliner-aggressiveness -9223372036854775808 --profile-execution will give you 178 opcodes executed.
If we made a global ZERO: Field = 0 and used that to initialize acc in both functions the opcodes executed would go down to 176. This is a pretty small example, but for larger programs with lots of constants performing this hoisting could be quite beneficial.
Happy Case
We should be able to automatically hoist constants shared across functions into the global space. We should not have any repeated initialization of constants.
Workaround
Yes
Workaround Description
Manually writing globals that are shared across functions
Additional Context
No response
Project Impact
Nice-to-have
Blocker Context
This provides execution benefits, so even though it is not a true blocker, it is high priority.
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered:
vezenovm
changed the title
Hoisting constants shared across functions into the global space
Hoist constants shared across functions into the global space
Jan 17, 2025
Problem
Post #7021 we will have globals from SSA fully implemented in Brillig.
However, we do not account for shared local constants across functions. For example let's take this simplified version of
global_var_regression_simple
Running
nargo info --force-brillig --inliner-aggressiveness -9223372036854775808 --profile-execution
will give you 178 opcodes executed.If we made a
global ZERO: Field = 0
and used that to initializeacc
in both functions the opcodes executed would go down to 176. This is a pretty small example, but for larger programs with lots of constants performing this hoisting could be quite beneficial.Happy Case
We should be able to automatically hoist constants shared across functions into the global space. We should not have any repeated initialization of constants.
Workaround
Yes
Workaround Description
Manually writing globals that are shared across functions
Additional Context
No response
Project Impact
Nice-to-have
Blocker Context
This provides execution benefits, so even though it is not a true blocker, it is high priority.
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: