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
This program reads values from a large constant array at constant indices to calculate a constant value acc, however it crashes once we reach the loop unrolling phase.
My assumption is that we're creating many unnecessary duplicates of the array contents, we then get P*P copies of a P*P array which would take horrendous amounts of RAM to store. If this is the case then we should look at ways to deduplicate constant arrays similarly to how we handle constant numeric values.
The text was updated successfully, but these errors were encountered:
My assumption is that we're creating many unnecessary duplicates of the array contents
Yeah, this is because globals are "inlined" during monomorphization when they're used. Maybe we can add a quick fix to remember the global's ID and cache its value per-function instead.
# Description
## Problem\*
Resolves#4709
## Summary\*
The issue is due to reference count instructions which blow-up during
unrolling. Since these instructions are only for Brillig and since loops
are not unrolled in Brillig, I simply discard them during unrolling.
## Additional Context
I did not get an OOM on the mainframe, but the compilation lasted many
hours and did not complete (I finally cancelled it). With the fix the
execution is instantaneous, whether the code is constrained or
unconstrained.
## Documentation\*
Check one:
- [X] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.
# PR Checklist\*
- [ ] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
---------
Co-authored-by: Tom French <[email protected]>
Co-authored-by: jfecher <[email protected]>
See the linked repo here: https://github.com/AndreiCravtov/noir-crypto-kit/blob/d7db6bc93f60709abad4bda3b810e900b614d068/noir/src/main.nr
This program reads values from a large constant array at constant indices to calculate a constant value
acc
, however it crashes once we reach the loop unrolling phase.My assumption is that we're creating many unnecessary duplicates of the array contents, we then get
P*P
copies of aP*P
array which would take horrendous amounts of RAM to store. If this is the case then we should look at ways to deduplicate constant arrays similarly to how we handle constant numeric values.The text was updated successfully, but these errors were encountered: