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
When performing binary operations we default to checked operations. However, when we know we have a known upper loop bound we can determine whether there will be an overflow at compilation time.
For example:
We know the maximum loop bound is going to be 63 and the 63*64 will fit into a u32. This operation should be unchecked.
However, let's look at the output from noir-profiler execution-opcodes:
45.3% (448 samples) of the executed opcodes comes from i * 64, while only 6.47% (64 samples as expected) are actual Brillig operations. The rest of the operations for i * 64 are from overflow checks.
Happy Case
Get rid of unnecessary overflow checks when we know from the induction variable that the operation will never overflow.
e.g. The above example should only see 64 opcode samples from i * 64.
This PR #6910 is of similar style but only checks induction variables from outer loops and hoists binary ops into the outer loop based upon the induction variable upper bound.
Workaround
None
Workaround Description
There is no ability to workaround this at the moment, this requires compiler changes.
Additional Context
No response
Project Impact
Blocker
Blocker Context
I am marking this as a blocker as improving unconstrained execution is of general benefit to all Noir devs and this this specific optimization is only possible through compile changesr.
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:
Problem
When performing binary operations we default to checked operations. However, when we know we have a known upper loop bound we can determine whether there will be an overflow at compilation time.
For example:
We know the maximum loop bound is going to be 63 and the 63*64 will fit into a
u32
. This operation should be unchecked.However, let's look at the output from

noir-profiler execution-opcodes
:45.3% (448 samples) of the executed opcodes comes from
i * 64
, while only 6.47% (64 samples as expected) are actual Brillig operations. The rest of the operations fori * 64
are from overflow checks.Happy Case
Get rid of unnecessary overflow checks when we know from the induction variable that the operation will never overflow.
e.g. The above example should only see 64 opcode samples from
i * 64
.This PR #6910 is of similar style but only checks induction variables from outer loops and hoists binary ops into the outer loop based upon the induction variable upper bound.
Workaround
None
Workaround Description
There is no ability to workaround this at the moment, this requires compiler changes.
Additional Context
No response
Project Impact
Blocker
Blocker Context
I am marking this as a blocker as improving unconstrained execution is of general benefit to all Noir devs and this this specific optimization is only possible through compile changesr.
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: