-
Notifications
You must be signed in to change notification settings - Fork 192
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
fix: optimize opening proof gpu usage #569
base: main
Are you sure you want to change the base?
Conversation
d7344b6
to
6373f3f
Compare
1e19b77
to
cc0b559
Compare
180d219
to
293fd54
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.
Nice work! Just a couple of nits but looks good to merge otherwise
// let q_k_com: Vec<P::G1Affine> = optimal_iter!(quotients) | ||
// .map(|q| UnivariateKZG::commit(&pp.commit_pp, q).unwrap()) | ||
// .collect(); |
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.
nit
// let q_k_com: Vec<P::G1Affine> = optimal_iter!(quotients) | |
// .map(|q| UnivariateKZG::commit(&pp.commit_pp, q).unwrap()) | |
// .collect(); |
@@ -230,30 +230,66 @@ where | |||
Ok(commitments.into_iter().map(|c| c.into_affine()).collect()) | |||
} | |||
|
|||
// This API will try to minimize copies to the GPU or just do the batches in parallel on the CPU | |||
#[tracing::instrument(skip_all, name = "KZG::commit_variable_batch_with_mode")] |
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.
#[tracing::instrument(skip_all, name = "KZG::commit_variable_batch_with_mode")] | |
#[tracing::instrument(skip_all, name = "KZG::commit_variable_batch")] |
Ok(commitments.into_iter().map(|c| c.into_affine()).collect()) | ||
} | ||
|
||
#[tracing::instrument(skip_all, name = "KZG::commit_variable_batch_with_mode")] |
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.
#[tracing::instrument(skip_all, name = "KZG::commit_variable_batch_with_mode")] | |
#[tracing::instrument(skip_all, name = "KZG::commit_variable_batch_univariate")] |
}) | ||
.collect::<Vec<_>>(); | ||
|
||
// TODO(sagar): Are the coefficients of these witness polynomials always of the same length? |
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.
can delete this comment
MultilinearPolynomial::I64Scalars(poly) => { | ||
Either::Right((i, max_num_bits, poly.coeffs_as_field_elements())) | ||
} | ||
_ => Either::Left((i, max_num_bits, poly)), |
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.
_ => Either::Left((i, max_num_bits, poly)), | |
MultilinearPolynomial::U8Scalars(_) => unreachable!("MultilinearPolynomial::U8Scalars cannot have more than 10 bits") |
--features icicle
on MacOS (skips the CUDA backend from icicle-jolt)std::Borrow
Brings a 1.4x(30%) speedup to the KZG opening proof. GPU opening proofs are ~2.8x(65%) faster than CPU now.
Net improvement of 15% in prover time GPU vs CPU.