Skip to content

Commit

Permalink
Add arithmetic op counts to InfoEvaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmilson committed Nov 24, 2024
1 parent 56a6a61 commit 840ed3e
Show file tree
Hide file tree
Showing 11 changed files with 439 additions and 38 deletions.
11 changes: 8 additions & 3 deletions crates/prover/src/constraint_framework/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ impl<E: FrameworkEval + Sync> ComponentProver<SimdBackend> for FrameworkComponen
.step_by(CHUNK_SIZE)
.zip(col.chunks_mut(CHUNK_SIZE));

// Define any `self` values outside the loop to prevent the compiler thinking there is a
// `Sync` requirement on `Self`.
let self_eval = &self.eval;
let self_logup_sums = self.logup_sums;

iter.for_each(|(chunk_idx, mut chunk)| {
let trace_cols = trace.as_cols_ref().map_cols(|c| c.as_ref());

Expand All @@ -344,10 +349,10 @@ impl<E: FrameworkEval + Sync> ComponentProver<SimdBackend> for FrameworkComponen
&accum.random_coeff_powers,
trace_domain.log_size(),
eval_domain.log_size(),
self.eval.log_size(),
self.logup_sums,
self_eval.log_size(),
self_logup_sums,
);
let row_res = self.eval.evaluate(eval).row_res;
let row_res = self_eval.evaluate(eval).row_res;

// Finalize row.
unsafe {
Expand Down
7 changes: 7 additions & 0 deletions crates/prover/src/constraint_framework/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ impl FieldExpOps for Expr {
}
}

impl Add<BaseField> for Expr {
type Output = Self;
fn add(self, rhs: BaseField) -> Self {
self + Expr::from(rhs)
}
}

impl Mul<BaseField> for Expr {
type Output = Self;
fn mul(self, rhs: BaseField) -> Self {
Expand Down
Loading

0 comments on commit 840ed3e

Please sign in to comment.