-
Notifications
You must be signed in to change notification settings - Fork 402
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
perf: non-native modular multiplication #749
Conversation
887c0d3
to
366950e
Compare
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.
couldn't find pointer issues, but my instinct tells me it's a bit risky ^^
also, did write some fuzz tests and ran for sometime, nothing found, but since we have a hint that does all the work, it just says the hint seems to be correct, not that everything is sound and one can't find a bad :)
lgtm 👍
Yes, it is not perfect, but imo works well enough. I have some ideas on how to make it more robust. Namely we can keep some DB of "element pointer -> hash of limbs" and if we see during some non-native operation that there is a conflict then we can panic. The problem with using values was that then I cannot re-use the element-as-polynomial evaluation value when same element is used in multiple muls. And this really impacted some non-native code. I could possibly try having some additional DB "hash of limbs -> stored evaluation", but dunno if this would be any better than the current approach + integrity check in prev paragraph. |
Description
This PR implements improved non-native modular multiplication as described in https://hackmd.io/3cpvkONzQl-TF5Oj8VXEHQ.
Type of change
How has this been tested?
The existing test suite passes.
How has this been benchmarked?
One of the biggest circuits we have - BW6-761 PLONK verifier in BN254 PLONK reduced from 180M constraints to 80M.
Checklist:
golangci-lint
does not output errors locally