Skip to content

Commit

Permalink
mvlookup patch
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-camuto committed Aug 23, 2024
1 parent 8db8fa5 commit db0fbbe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions halo2_proofs/src/plonk/evaluation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ use super::{shuffle, ConstraintSystem, Expression};
#[cfg(feature = "mv-lookup")]
use ff::BatchInvert;

#[cfg(feature = "mv-lookup")]
use maybe_rayon::iter::IntoParallelRefMutIterator;

/// Return the index in the polynomial of size `isize` after rotation `rot`.
fn get_rotation_idx(idx: usize, rot: i32, rot_scale: i32, isize: i32) -> usize {
(((idx as i32) + (rot * rot_scale)).rem_euclid(isize)) as usize
Expand Down
15 changes: 14 additions & 1 deletion halo2_proofs/src/plonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ use super::lookup;
#[cfg(feature = "mv-lookup")]
use super::mv_lookup as lookup;

#[cfg(feature = "mv-lookup")]
use maybe_rayon::iter::{
IntoParallelIterator, IntoParallelRefIterator, IntoParallelRefMutIterator,
};

use crate::{
arithmetic::{eval_polynomial, CurveAffine},
circuit::Value,
Expand Down Expand Up @@ -782,13 +787,21 @@ where
log::trace!("Permutation evaluation: {:?}", start.elapsed());

// Evaluate the lookups, if any, at omega^i x.

let start = Instant::now();

let lookups: Vec<Vec<lookup::prover::Evaluated<Scheme::Curve>>> = lookups
.into_iter()
.map(|lookups| -> Result<Vec<_>, _> {
lookups
.into_iter()
.map(|p| p.evaluate(pk, x, transcript))
.map(|p| {
#[cfg(not(feature = "mv-lookup"))]
let res = { p.evaluate(pk, x, transcript) };
#[cfg(feature = "mv-lookup")]
let res = { p.evaluate(&pk.vk, x, transcript) };
res
})
.collect::<Result<Vec<_>, _>>()
})
.collect::<Result<Vec<_>, _>>()?;
Expand Down

0 comments on commit db0fbbe

Please sign in to comment.