-
Notifications
You must be signed in to change notification settings - Fork 248
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: add pass which inlines constant arguments into brillig functions #7559
base: master
Are you sure you want to change the base?
Conversation
Changes to Brillig bytecode sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to number of Brillig opcodes executed
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff 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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Execution Memory'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20
.
Benchmark suite | Current: 4c8c93d | Previous: 3239a4a | Ratio |
---|---|---|---|
rollup-block-root |
7870 MB |
1420 MB |
5.54 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
I don't understand why these regressions are happening (and less why the "stack too deep" error happens). I'm looking at the final SSA before and after this PR, and the new SSA is shorter. In the case of program "6" the main function is exactly the same, except that some calls have less arguments because they have been inlined. |
I'm also trying it with this program: use bignum::BigNum;
use bignum::BigNumTrait;
use bignum::fields::U256::U256Params;
// Define (compile-time) BigNum type
// number of limbs, number of bits of modulus, parameter set
type U256 = BigNum<3, 257, U256Params>;
fn main(x: [Field; 3], y: [Field; 3]) -> pub [Field; 3] {
let one = U256::from_slice(x);
let two = U256::from_slice(y);
// (one + two).limbs
(one + two).limbs
} This is the output of
And this is the output with this PR:
So it seems the number of brillig opcodes decreases, but the same number of opcodes is executed. Maybe we are missing some optimizations done on the functions where constants have been inlined (for example there's no constant folding happening there, though I tried it and it didn't change anything...) |
Description
Problem
Resolves #6812
Summary
Pending:
Additional Context
Also includes a commit to get better feedback on SSA test failures, and fixing some indentation in tests.
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.