mirror of https://github.com/zcash/halo2.git
Collect some prover metrics
This commit is contained in:
parent
ba27586965
commit
d4424db8d4
|
@ -141,6 +141,7 @@ impl<C: CurveAffine> Proof<C> {
|
|||
C::Projective::batch_to_affine(&advice_commitments_projective, &mut advice_commitments);
|
||||
let advice_commitments = advice_commitments;
|
||||
drop(advice_commitments_projective);
|
||||
metrics::counter!("advice_commitments", advice_commitments.len() as u64);
|
||||
|
||||
for commitment in &advice_commitments {
|
||||
hash_point(&mut transcript, commitment)?;
|
||||
|
|
|
@ -124,6 +124,7 @@ impl<C: CurveAffine> Params<C> {
|
|||
poly: &Polynomial<C::Scalar, Coeff>,
|
||||
r: Blind<C::Scalar>,
|
||||
) -> C::Projective {
|
||||
metrics::increment!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit");
|
||||
let mut tmp_scalars = Vec::with_capacity(poly.len() + 1);
|
||||
let mut tmp_bases = Vec::with_capacity(poly.len() + 1);
|
||||
|
||||
|
@ -144,6 +145,7 @@ impl<C: CurveAffine> Params<C> {
|
|||
poly: &Polynomial<C::Scalar, LagrangeCoeff>,
|
||||
r: Blind<C::Scalar>,
|
||||
) -> C::Projective {
|
||||
metrics::increment!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit_lagrange");
|
||||
let mut tmp_scalars = Vec::with_capacity(poly.len() + 1);
|
||||
let mut tmp_bases = Vec::with_capacity(poly.len() + 1);
|
||||
|
||||
|
|
|
@ -74,12 +74,14 @@ impl<C: CurveAffine> Proof<C> {
|
|||
//
|
||||
// TODO: If we modify multiexp to take "extra" bases, we could speed
|
||||
// this piece up a bit by combining the multiexps.
|
||||
metrics::counter!("multiexp", 2, "val" => "l/r", "size" => format!("{}", half));
|
||||
let l = best_multiexp(&a[0..half], &g[half..]);
|
||||
let r = best_multiexp(&a[half..], &g[0..half]);
|
||||
let value_l = compute_inner_product(&a[0..half], &b[half..]);
|
||||
let value_r = compute_inner_product(&a[half..], &b[0..half]);
|
||||
let mut l_randomness = C::Scalar::random();
|
||||
let r_randomness = C::Scalar::random();
|
||||
metrics::counter!("multiexp", 2, "val" => "l/r", "size" => "2");
|
||||
let l = l + &best_multiexp(&[value_l, l_randomness], &[u, params.h]);
|
||||
let r = r + &best_multiexp(&[value_r, r_randomness], &[u, params.h]);
|
||||
let mut l = l.to_affine();
|
||||
|
@ -170,6 +172,7 @@ impl<C: CurveAffine> Proof<C> {
|
|||
let d = C::Scalar::random();
|
||||
let s = C::Scalar::random();
|
||||
|
||||
metrics::increment!("multiexp", "val" => "delta", "size" => "3");
|
||||
let delta = best_multiexp(&[d, d * &b, s], &[g, u, params.h]).to_affine();
|
||||
|
||||
let (delta_x, delta_y) = delta.get_xy().unwrap();
|
||||
|
@ -202,6 +205,7 @@ fn parallel_generator_collapse<C: CurveAffine>(
|
|||
) {
|
||||
let len = g.len() / 2;
|
||||
let (mut g_lo, g_hi) = g.split_at_mut(len);
|
||||
metrics::counter!("multiexp", len as u64, "size" => "2", "fn" => "parallel_generator_collapse");
|
||||
|
||||
parallelize(&mut g_lo, |g_lo, start| {
|
||||
let g_hi = &g_hi[start..];
|
||||
|
|
|
@ -203,6 +203,7 @@ impl<G: Group> EvaluationDomain<G> {
|
|||
assert_eq!(a.values.len(), 1 << self.k);
|
||||
|
||||
// Perform inverse FFT to obtain the polynomial in coefficient form
|
||||
metrics::increment!("ifft", "size" => format!("{}", a.len()), "fn" => "lagrange_to_coeff");
|
||||
Self::ifft(&mut a.values, self.omega_inv, self.k, self.ifft_divisor);
|
||||
|
||||
Polynomial {
|
||||
|
@ -237,6 +238,7 @@ impl<G: Group> EvaluationDomain<G> {
|
|||
Self::distribute_powers(&mut a.values, g);
|
||||
}
|
||||
a.values.resize(self.extended_len(), G::group_zero());
|
||||
metrics::increment!("fft", "size" => format!("{}", self.extended_len()), "fn" => "coeff_to_extended");
|
||||
best_fft(&mut a.values, self.extended_omega, self.extended_k);
|
||||
|
||||
Polynomial {
|
||||
|
@ -255,6 +257,7 @@ impl<G: Group> EvaluationDomain<G> {
|
|||
assert_eq!(a.values.len(), self.extended_len());
|
||||
|
||||
// Inverse FFT
|
||||
metrics::increment!("ifft", "size" => format!("{}", a.len()), "fn" => "extended_to_coeff");
|
||||
Self::ifft(
|
||||
&mut a.values,
|
||||
self.extended_omega_inv,
|
||||
|
|
Loading…
Reference in New Issue