forked from zcash/halo2
-
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
[Discussion] Peak memory estimation #291
Comments
One important thing aside of #274 would be to check in Halo2 if we can drop polynomials earlier than fn scope ends and drop gets triggered. On this way we might be able (if the compiler is not already doing so) to reduce it a bit. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Recently @han0110 did an analysis of peak memory estimation for halo2 proving, with a script implementation that takes a
ConstraintSystem
and estimates the peak memory of the prover. I ported that script to the zkevm-circuits and it can be seen here: https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/3bbc757a20d9d9f7759db47c096d5395361bee74/zkevm-circuits/src/bin/stats/halo2_stats.rs#L232Recently I ran some benchmarks with this test circuit in https://github.com/privacy-scaling-explorations/halo2/blob/1650a0b07fbbfeebab71f5650ccb62ccd20de0ff/halo2_proofs/tests/frontend_backend_split.rs to measure the peak memory and verify how accurate the estimation is, and I'm happy to report that the estimation is very accurate!
These are the characteristics of the circuit (where
wf
is theWIDTH_FACTOR
and can be parametrized):These are the results for
k = 10,12,14,16,18
andwf = 1,2,3,4,5,6
(memory values in MiB):The estimation is ~98% of the measured peak memory.
You can reproduce these tests from this branch https://github.com/privacy-scaling-explorations/halo2/tree/test/bench-mem-peak using this script https://github.com/privacy-scaling-explorations/halo2/blob/test/bench-mem-peak/halo2_proofs/bench.sh
Discussion
I think it would be nice to add this estimation into the code. Maybe it can be a
halo2_backend
function that receives aConstraintSystemMid
and returns the estimated memory? This way different backends can report different memory estimations.Another point of discussion is that it would be great to figure out the new memory estimation formula from #274
The text was updated successfully, but these errors were encountered: