-
Notifications
You must be signed in to change notification settings - Fork 129
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
memo: improvement list #15
Comments
Can we move this to halo2 repo ? |
Yes! |
@noctrlz i posted some cpu profiling graph here. zcash#418 (comment). It seems |
@lispc |
Some of my initial ideas after looking at the code a bit and things I plan on looking into further and implementing. Will have to implement some of these things to know how big of different it makes to know if they are worth it or not. Most time spent in evaluation the expressions, FFT, and multiexp. Shameless plug to my post about my libsnark optimizations but many of what is said there should also be applicable here. FFT
Multi exp
Evaluations
Will have to test against actual transactions to see if some of these assumptions hold or not, currently most values are Current status: Biggest gains are from reusing intermediate results across expressions. This also impacts memory use a lot because of temporary buffers so optimizing both at the same time. Very easy to reduce memory by 50%-60% with practically no changes (without counting the memory savings by not using Some stuff I quickly tested a bit to have more of a feeling how this behaves: Misc
|
@Brechtpd |
Two important areas to optimize on the circuits side are
We currently have a good idea how to greatly reduce 2) by making use of the intermediate rows (the rows between the step height) by having each row do a limited number of lookups and in the custom gates use those cells to verify the data we would normally lookup. Because lookups add 3 degrees to the input expression, having this indirection with a lookup always having a simple table cell as input also means we have a lower degree requirement (because the input degree is always 1). For the custom gates it should always be possible to get the degree as low as needed by making use of intermediate cells (which I guess could even be done automatically), so the theoretical minimum degree we can achieve is strictly the one imposed by the lookups. The current minimum degree for lookups (between advice cells) is 4. This would put the lower limit on the extended domain to 4x the normal size. However I think it may be possible to lower this to 3 by removing the extra terms required to have zero knowledge (which for zkEVM we don't need anyway):
Without zero knowledge I believe we can drop the If this is true the theoretical lowest degree needed is just 3 and so the extended domain would only be 2x the size of the normal domain, otherwise it's x4 which is still pretty good I guess. :) Adding a selector to the lookups also increases the degree, so if we need the degree to be at 3 we would need dedicated cells that do the lookups on each row without exception (which shouldn't be a problem). |
I think it won't break anything, but would like to hear @therealyingtong's thought.
Ideally we don't need to always shuffle the input and table in the same grand product IIUC, we can shuffle input and table separately with their own grand products to take down the degree to 2. If we really need selector on input to make layout easier, then I think this is a possible solution. |
upstream halo2 introduced AST for ploy and performance get improved. (details : zcash#447 (comment)) We may need to merge the upstream later. |
Introducing assembly was done on privacy-scaling-explorations/pairing#5. |
Assembly Optimization In The Future
goff implementation will be hint. |
Rebase and introduce assembly reduce prover time 72.02%. |
book: Note that we use 0 for uncommitted leaves in the commitment tree
Optimize poly evaluation and fft reduce prover time 75.6%. |
Category
Memo
|
…-hk/dev-fix/address-pr-15 Resolve "Address PR privacy-scaling-explorations#15 issues"
Most of these improvements now apply to primitives that are implemented in halo2curves so the issue is no longer relevant. |
I noted improvement list in order not to forget.
ff
to assemblyThank you Onur for giving ideas!
The text was updated successfully, but these errors were encountered: