diff --git a/crates/prover/src/constraint_framework/component.rs b/crates/prover/src/constraint_framework/component.rs index 86f00609c..5b1885d7c 100644 --- a/crates/prover/src/constraint_framework/component.rs +++ b/crates/prover/src/constraint_framework/component.rs @@ -1,5 +1,4 @@ use std::borrow::Cow; -use std::collections::HashMap; use std::fmt::{self, Display, Formatter}; use std::iter::zip; use std::ops::Deref; @@ -11,7 +10,6 @@ use tracing::{span, Level}; use super::cpu_domain::CpuDomainEvaluator; use super::logup::LogupSums; -use super::preprocessed_columns::PreprocessedColumn; use super::{ EvalAtRow, InfoEvaluator, PointEvaluator, SimdDomainEvaluator, PREPROCESSED_TRACE_IDX, }; @@ -49,7 +47,8 @@ pub struct TraceLocationAllocator { /// Mapping of tree index to next available column offset. next_tree_offsets: TreeVec, /// Mapping of preprocessed columns to their index. - preprocessed_columns: HashMap, + // TODO(Gali): Change Vec type to struct PreProcessedColumnId {pub id: String}. + preprocessed_columns: Vec, /// Controls whether the preprocessed columns are dynamic or static (default=Dynamic). preprocessed_columns_allocation_mode: PreprocessedColumnsAllocationMode, } @@ -81,31 +80,27 @@ impl TraceLocationAllocator { } /// Create a new `TraceLocationAllocator` with fixed preprocessed columns setup. - pub fn new_with_preproccessed_columns(preprocessed_columns: &[PreprocessedColumn]) -> Self { + pub fn new_with_preproccessed_columns(preprocessed_columns: &[String]) -> Self { + assert!( + preprocessed_columns.iter().all_unique(), + "Duplicate preprocessed columns are not allowed!" + ); Self { next_tree_offsets: Default::default(), - preprocessed_columns: preprocessed_columns - .iter() - .enumerate() - .map(|(i, &col)| (col, i)) - .collect(), + preprocessed_columns: preprocessed_columns.to_vec(), preprocessed_columns_allocation_mode: PreprocessedColumnsAllocationMode::Static, } } - pub const fn preprocessed_columns(&self) -> &HashMap { + pub const fn preprocessed_columns(&self) -> &Vec { &self.preprocessed_columns } // validates that `self.preprocessed_columns` is consistent with // `preprocessed_columns`. // I.e. preprocessed_columns[i] == self.preprocessed_columns[i]. - pub fn validate_preprocessed_columns(&self, preprocessed_columns: &[PreprocessedColumn]) { - assert_eq!(preprocessed_columns.len(), self.preprocessed_columns.len()); - - for (column, idx) in self.preprocessed_columns.iter() { - assert_eq!(Some(column), preprocessed_columns.get(*idx)); - } + pub fn validate_preprocessed_columns(&self, preprocessed_columns: &[String]) { + assert_eq!(self.preprocessed_columns, preprocessed_columns); } } @@ -144,22 +139,25 @@ impl FrameworkComponent { .iter() .map(|col| { let next_column = location_allocator.preprocessed_columns.len(); - *location_allocator + if let Some(pos) = location_allocator .preprocessed_columns - .entry(*col) - .or_insert_with(|| { - if matches!( - location_allocator.preprocessed_columns_allocation_mode, - PreprocessedColumnsAllocationMode::Static - ) { - panic!( - "Preprocessed column {:?} is missing from static alloction", - col - ); - } - - next_column - }) + .iter() + .position(|x| x == col) + { + pos + } else { + if matches!( + location_allocator.preprocessed_columns_allocation_mode, + PreprocessedColumnsAllocationMode::Static + ) { + panic!( + "Preprocessed column {:?} is missing from static allocation", + col + ); + } + location_allocator.preprocessed_columns.push(col.clone()); + next_column + } }) .collect(); Self { diff --git a/crates/prover/src/constraint_framework/expr/evaluator.rs b/crates/prover/src/constraint_framework/expr/evaluator.rs index 6b9238d23..10dce37d4 100644 --- a/crates/prover/src/constraint_framework/expr/evaluator.rs +++ b/crates/prover/src/constraint_framework/expr/evaluator.rs @@ -2,7 +2,6 @@ use num_traits::Zero; use super::{BaseExpr, ExtExpr}; use crate::constraint_framework::expr::ColumnExpr; -use crate::constraint_framework::preprocessed_columns::PreprocessedColumn; use crate::constraint_framework::{EvalAtRow, Relation, RelationEntry, INTERACTION_TRACE_IDX}; use crate::core::fields::m31; use crate::core::lookups::utils::Fraction; @@ -174,8 +173,8 @@ impl EvalAtRow for ExprEvaluator { intermediate } - fn get_preprocessed_column(&mut self, column: PreprocessedColumn) -> Self::F { - BaseExpr::Param(column.name().to_string()) + fn get_preprocessed_column(&mut self, column: String) -> Self::F { + BaseExpr::Param(column) } crate::constraint_framework::logup_proxy!(); @@ -208,7 +207,7 @@ mod tests { \ let constraint_1 = (QM31Impl::from_partial_evals([trace_2_column_3_offset_0, trace_2_column_4_offset_0, trace_2_column_5_offset_0, trace_2_column_6_offset_0]) \ - (QM31Impl::from_partial_evals([trace_2_column_3_offset_neg_1, trace_2_column_4_offset_neg_1, trace_2_column_5_offset_neg_1, trace_2_column_6_offset_neg_1]) \ - - ((total_sum) * (preprocessed_is_first)))) \ + - ((total_sum) * (preprocessed_is_first_16)))) \ * (intermediate1) \ - (qm31(1, 0, 0, 0));" .to_string(); diff --git a/crates/prover/src/constraint_framework/info.rs b/crates/prover/src/constraint_framework/info.rs index f8a6257e3..02e3de8d2 100644 --- a/crates/prover/src/constraint_framework/info.rs +++ b/crates/prover/src/constraint_framework/info.rs @@ -6,7 +6,6 @@ use std::rc::Rc; use num_traits::{One, Zero}; use super::logup::{LogupAtRow, LogupSums}; -use super::preprocessed_columns::PreprocessedColumn; use super::{EvalAtRow, INTERACTION_TRACE_IDX}; use crate::constraint_framework::PREPROCESSED_TRACE_IDX; use crate::core::fields::m31::BaseField; @@ -22,16 +21,13 @@ use crate::core::pcs::TreeVec; pub struct InfoEvaluator { pub mask_offsets: TreeVec>>, pub n_constraints: usize, - pub preprocessed_columns: Vec, + // TODO(Gali): Change Vec type to struct PreProcessedColumnId {pub id: String}. + pub preprocessed_columns: Vec, pub logup: LogupAtRow, pub arithmetic_counts: ArithmeticCounts, } impl InfoEvaluator { - pub fn new( - log_size: u32, - preprocessed_columns: Vec, - logup_sums: LogupSums, - ) -> Self { + pub fn new(log_size: u32, preprocessed_columns: Vec, logup_sums: LogupSums) -> Self { Self { mask_offsets: Default::default(), n_constraints: Default::default(), @@ -70,7 +66,7 @@ impl EvalAtRow for InfoEvaluator { array::from_fn(|_| FieldCounter::one()) } - fn get_preprocessed_column(&mut self, column: PreprocessedColumn) -> Self::F { + fn get_preprocessed_column(&mut self, column: String) -> Self::F { self.preprocessed_columns.push(column); FieldCounter::one() } diff --git a/crates/prover/src/constraint_framework/logup.rs b/crates/prover/src/constraint_framework/logup.rs index 370987e4c..014312995 100644 --- a/crates/prover/src/constraint_framework/logup.rs +++ b/crates/prover/src/constraint_framework/logup.rs @@ -52,7 +52,7 @@ pub struct LogupAtRow { pub fracs: Vec>, pub is_finalized: bool, /// The value of the `is_first` constant column at current row. - /// See [`super::preprocessed_columns::gen_is_first()`]. + /// See [`super::preprocessed_columns::IsFirst`]. pub is_first: E::F, pub log_size: u32, } diff --git a/crates/prover/src/constraint_framework/mod.rs b/crates/prover/src/constraint_framework/mod.rs index 22809152d..88a2908c6 100644 --- a/crates/prover/src/constraint_framework/mod.rs +++ b/crates/prover/src/constraint_framework/mod.rs @@ -19,7 +19,6 @@ pub use component::{FrameworkComponent, FrameworkEval, TraceLocationAllocator}; pub use info::InfoEvaluator; use num_traits::{One, Zero}; pub use point::PointEvaluator; -use preprocessed_columns::PreprocessedColumn; pub use simd_domain::SimdDomainEvaluator; use crate::core::fields::m31::BaseField; @@ -87,7 +86,7 @@ pub trait EvalAtRow { mask_item } - fn get_preprocessed_column(&mut self, _column: PreprocessedColumn) -> Self::F { + fn get_preprocessed_column(&mut self, _column: String) -> Self::F { let [mask_item] = self.next_interaction_mask(PREPROCESSED_TRACE_IDX, [0]); mask_item } @@ -173,9 +172,10 @@ macro_rules! logup_proxy { fn write_logup_frac(&mut self, fraction: Fraction) { if self.logup.fracs.is_empty() { self.logup.is_first = self.get_preprocessed_column( - crate::constraint_framework::preprocessed_columns::PreprocessedColumn::IsFirst( + crate::constraint_framework::preprocessed_columns::IsFirst::new( self.logup.log_size, - ), + ) + .id(), ); self.logup.is_finalized = false; } diff --git a/crates/prover/src/constraint_framework/preprocessed_columns.rs b/crates/prover/src/constraint_framework/preprocessed_columns.rs index df45d7e15..b7c0e5e07 100644 --- a/crates/prover/src/constraint_framework/preprocessed_columns.rs +++ b/crates/prover/src/constraint_framework/preprocessed_columns.rs @@ -54,8 +54,7 @@ impl IsFirst { } } -// TODO(ilya): Where should this enum be placed? -// TODO(Gali): Consider making it a trait, add documentation for the rest of the variants. +// TODO(Gali): Remove Enum. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum PreprocessedColumn { /// A column with `1` at the first position, and `0` elsewhere. @@ -173,26 +172,15 @@ pub fn gen_preprocessed_columns<'a, B: Backend>( #[cfg(test)] mod tests { + use super::IsFirst; use crate::core::backend::simd::m31::N_LANES; - use crate::core::backend::simd::SimdBackend; - use crate::core::backend::Column; - use crate::core::fields::m31::{BaseField, M31}; const LOG_SIZE: u32 = 8; - #[test] - fn test_gen_seq() { - let seq = super::gen_seq::(LOG_SIZE); - - for i in 0..(1 << LOG_SIZE) { - assert_eq!(seq.at(i), BaseField::from_u32_unchecked(i as u32)); - } - } - // TODO(Gali): Add packed_at tests for xor_table and plonk. #[test] fn test_packed_at_is_first() { - let is_first = super::PreprocessedColumn::IsFirst(LOG_SIZE); - let expected_is_first = super::gen_is_first::(LOG_SIZE).to_cpu(); + let is_first = IsFirst::new(LOG_SIZE); + let expected_is_first = is_first.gen_column_simd().to_cpu(); for i in 0..(1 << LOG_SIZE) / N_LANES { assert_eq!( @@ -201,17 +189,4 @@ mod tests { ); } } - - #[test] - fn test_packed_at_seq() { - let seq = super::PreprocessedColumn::Seq(LOG_SIZE); - let expected_seq: [_; 1 << LOG_SIZE] = std::array::from_fn(|i| M31::from(i as u32)); - - let packed_seq = std::array::from_fn::<_, { (1 << LOG_SIZE) / N_LANES }, _>(|i| { - seq.packed_at(i).to_array() - }) - .concat(); - - assert_eq!(packed_seq, expected_seq); - } } diff --git a/crates/prover/src/constraint_framework/relation_tracker.rs b/crates/prover/src/constraint_framework/relation_tracker.rs index e4606e7bf..3e75a7ddb 100644 --- a/crates/prover/src/constraint_framework/relation_tracker.rs +++ b/crates/prover/src/constraint_framework/relation_tracker.rs @@ -5,7 +5,6 @@ use itertools::Itertools; use num_traits::Zero; use super::logup::LogupSums; -use super::preprocessed_columns::PreprocessedColumn; use super::{ Batching, EvalAtRow, FrameworkEval, InfoEvaluator, Relation, RelationEntry, TraceLocationAllocator, INTERACTION_TRACE_IDX, @@ -146,10 +145,6 @@ impl EvalAtRow for RelationTrackerEvaluator<'_> { }) } - fn get_preprocessed_column(&mut self, column: PreprocessedColumn) -> Self::F { - column.packed_at(self.vec_row) - } - fn add_constraint(&mut self, _constraint: G) {} fn combine_ef(_values: [Self::F; SECURE_EXTENSION_DEGREE]) -> Self::EF { diff --git a/crates/prover/src/examples/blake/air.rs b/crates/prover/src/examples/blake/air.rs index 424e34f13..312f5c4ba 100644 --- a/crates/prover/src/examples/blake/air.rs +++ b/crates/prover/src/examples/blake/air.rs @@ -5,10 +5,11 @@ use num_traits::Zero; use serde::Serialize; use tracing::{span, Level}; +use super::preprocessed_columns::XorTable; use super::round::{blake_round_info, BlakeRoundComponent, BlakeRoundEval}; use super::scheduler::{BlakeSchedulerComponent, BlakeSchedulerEval}; use super::xor_table::{xor12, xor4, xor7, xor8, xor9}; -use crate::constraint_framework::preprocessed_columns::{gen_is_first, PreprocessedColumn}; +use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::{TraceLocationAllocator, PREPROCESSED_TRACE_IDX}; use crate::core::air::{Component, ComponentProver}; use crate::core::backend::simd::m31::LOG_N_LANES; @@ -26,28 +27,55 @@ use crate::examples::blake::{ round, xor_table, BlakeXorElements, XorAccums, N_ROUNDS, ROUND_LOG_SPLIT, }; -const PREPROCESSED_XOR_COLUMNS: [PreprocessedColumn; 20] = [ - PreprocessedColumn::XorTable(12, 4, 0), - PreprocessedColumn::XorTable(12, 4, 1), - PreprocessedColumn::XorTable(12, 4, 2), - PreprocessedColumn::IsFirst(xor12::column_bits::<12, 4>()), - PreprocessedColumn::XorTable(9, 2, 0), - PreprocessedColumn::XorTable(9, 2, 1), - PreprocessedColumn::XorTable(9, 2, 2), - PreprocessedColumn::IsFirst(xor9::column_bits::<9, 2>()), - PreprocessedColumn::XorTable(8, 2, 0), - PreprocessedColumn::XorTable(8, 2, 1), - PreprocessedColumn::XorTable(8, 2, 2), - PreprocessedColumn::IsFirst(xor8::column_bits::<8, 2>()), - PreprocessedColumn::XorTable(7, 2, 0), - PreprocessedColumn::XorTable(7, 2, 1), - PreprocessedColumn::XorTable(7, 2, 2), - PreprocessedColumn::IsFirst(xor7::column_bits::<7, 2>()), - PreprocessedColumn::XorTable(4, 0, 0), - PreprocessedColumn::XorTable(4, 0, 1), - PreprocessedColumn::XorTable(4, 0, 2), - PreprocessedColumn::IsFirst(xor4::column_bits::<4, 0>()), -]; +fn preprocessed_xor_columns() -> [String; 20] { + [ + XorTable::new(12, 4, 0).id(), + XorTable::new(12, 4, 1).id(), + XorTable::new(12, 4, 2).id(), + IsFirst::new(XorTable::new(12, 4, 0).column_bits()).id(), + XorTable::new(9, 2, 0).id(), + XorTable::new(9, 2, 1).id(), + XorTable::new(9, 2, 2).id(), + IsFirst::new(XorTable::new(9, 2, 0).column_bits()).id(), + XorTable::new(8, 2, 0).id(), + XorTable::new(8, 2, 1).id(), + XorTable::new(8, 2, 2).id(), + IsFirst::new(XorTable::new(8, 2, 0).column_bits()).id(), + XorTable::new(7, 2, 0).id(), + XorTable::new(7, 2, 1).id(), + XorTable::new(7, 2, 2).id(), + IsFirst::new(XorTable::new(7, 2, 0).column_bits()).id(), + XorTable::new(4, 0, 0).id(), + XorTable::new(4, 0, 1).id(), + XorTable::new(4, 0, 2).id(), + IsFirst::new(XorTable::new(4, 0, 0).column_bits()).id(), + ] +} + +const fn preprocessed_xor_columns_log_sizes() -> [u32; 20] { + [ + XorTable::new(12, 4, 0).column_bits(), + XorTable::new(12, 4, 1).column_bits(), + XorTable::new(12, 4, 2).column_bits(), + XorTable::new(12, 4, 0).column_bits(), + XorTable::new(9, 2, 0).column_bits(), + XorTable::new(9, 2, 1).column_bits(), + XorTable::new(9, 2, 2).column_bits(), + XorTable::new(9, 2, 0).column_bits(), + XorTable::new(8, 2, 0).column_bits(), + XorTable::new(8, 2, 1).column_bits(), + XorTable::new(8, 2, 2).column_bits(), + XorTable::new(8, 2, 0).column_bits(), + XorTable::new(7, 2, 0).column_bits(), + XorTable::new(7, 2, 1).column_bits(), + XorTable::new(7, 2, 2).column_bits(), + XorTable::new(7, 2, 0).column_bits(), + XorTable::new(4, 0, 0).column_bits(), + XorTable::new(4, 0, 1).column_bits(), + XorTable::new(4, 0, 2).column_bits(), + XorTable::new(4, 0, 0).column_bits(), + ] +} #[derive(Serialize)] pub struct BlakeStatement0 { @@ -86,12 +114,7 @@ impl BlakeStatement0 { log_sizes[PREPROCESSED_TRACE_IDX] = chain!( [scheduler_is_first_column_log_size], blake_round_is_first_column_log_sizes, - PREPROCESSED_XOR_COLUMNS.map(|column| match column { - PreprocessedColumn::XorTable(elem_bits, expand_bits, _) => - 2 * (elem_bits - expand_bits), - PreprocessedColumn::IsFirst(log_size) => log_size, - _ => panic!("Unexpected column"), - }), + preprocessed_xor_columns_log_sizes(), ) .collect_vec(); @@ -164,16 +187,17 @@ impl BlakeComponents { fn new(stmt0: &BlakeStatement0, all_elements: &AllElements, stmt1: &BlakeStatement1) -> Self { let log_size = stmt0.log_size; - let scheduler_is_first_column = PreprocessedColumn::IsFirst(log_size); - let blake_round_is_first_columns_iter = ROUND_LOG_SPLIT + let scheduler_is_first_column = IsFirst::new(log_size).id(); + let blake_round_is_first_columns_iter: Vec = ROUND_LOG_SPLIT .iter() - .map(|l| PreprocessedColumn::IsFirst(log_size + l)); + .map(|l| IsFirst::new(log_size + l).id()) + .collect_vec(); let tree_span_provider = &mut TraceLocationAllocator::new_with_preproccessed_columns( &chain!( [scheduler_is_first_column], blake_round_is_first_columns_iter, - PREPROCESSED_XOR_COLUMNS, + preprocessed_xor_columns(), ) .collect_vec()[..], ); @@ -322,13 +346,15 @@ where let mut tree_builder = commitment_scheme.tree_builder(); tree_builder.extend_evals( chain![ - vec![gen_is_first(log_size)], - ROUND_LOG_SPLIT.iter().map(|l| gen_is_first(log_size + l)), - xor_table::xor12::generate_constant_trace::<12, 4>(), - xor_table::xor9::generate_constant_trace::<9, 2>(), - xor_table::xor8::generate_constant_trace::<8, 2>(), - xor_table::xor7::generate_constant_trace::<7, 2>(), - xor_table::xor4::generate_constant_trace::<4, 0>(), + vec![IsFirst::new(log_size).gen_column_simd()], + ROUND_LOG_SPLIT + .iter() + .map(|l| IsFirst::new(log_size + l).gen_column_simd()), + XorTable::new(12, 4, 0).generate_constant_trace(), + XorTable::new(9, 2, 0).generate_constant_trace(), + XorTable::new(8, 2, 0).generate_constant_trace(), + XorTable::new(7, 2, 0).generate_constant_trace(), + XorTable::new(4, 0, 0).generate_constant_trace(), ] .collect_vec(), ); diff --git a/crates/prover/src/examples/blake/preprocessed_columns.rs b/crates/prover/src/examples/blake/preprocessed_columns.rs index f0655677a..d30813b01 100644 --- a/crates/prover/src/examples/blake/preprocessed_columns.rs +++ b/crates/prover/src/examples/blake/preprocessed_columns.rs @@ -1,6 +1,6 @@ use tracing::{span, Level}; -use crate::constraint_framework::preprocessed_columns::gen_is_first; +use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::core::backend::simd::column::BaseColumn; use crate::core::backend::simd::SimdBackend; use crate::core::fields::m31::BaseField; @@ -8,8 +8,7 @@ use crate::core::poly::circle::{CanonicCoset, CircleEvaluation}; use crate::core::poly::BitReversedOrder; use crate::core::ColumnVec; -// TODO(Gali): Add documentation and remove allow dead code. -#[allow(dead_code)] +// TODO(Gali): Add documentation. #[derive(Debug)] pub struct XorTable { pub n_bits: u32, @@ -17,8 +16,6 @@ pub struct XorTable { pub index_in_table: usize, } impl XorTable { - // TODO(Gali): Remove allow dead code. - #[allow(dead_code)] pub const fn new(n_bits: u32, n_expand_bits: u32, index_in_table: usize) -> Self { Self { n_bits, @@ -27,8 +24,6 @@ impl XorTable { } } - // TODO(Gali): Remove allow dead code. - #[allow(dead_code)] pub fn id(&self) -> String { format!( "preprocessed_xor_table_{}_{}_{}", @@ -36,22 +31,16 @@ impl XorTable { ) } - // TODO(Gali): Remove allow dead code. - #[allow(dead_code)] pub const fn limb_bits(&self) -> u32 { self.n_bits - self.n_expand_bits } - // TODO(Gali): Remove allow dead code. - #[allow(dead_code)] pub const fn column_bits(&self) -> u32 { 2 * self.limb_bits() } /// Generates the Preprocessed trace for the xor table. /// Returns the Preprocessed trace, the Preprocessed trace, and the claimed sum. - // TODO(Gali): Remove allow dead code. - #[allow(dead_code)] #[allow(clippy::type_complexity)] pub fn generate_constant_trace( &self, @@ -81,7 +70,7 @@ impl XorTable { }) .to_vec(); // TODO!(ShaharS): Remove this line. - constant_trace.push(gen_is_first(self.column_bits())); + constant_trace.push(IsFirst::new(self.column_bits()).gen_column_simd()); constant_trace } } diff --git a/crates/prover/src/examples/blake/round/mod.rs b/crates/prover/src/examples/blake/round/mod.rs index 4926fe218..027538297 100644 --- a/crates/prover/src/examples/blake/round/mod.rs +++ b/crates/prover/src/examples/blake/round/mod.rs @@ -56,7 +56,7 @@ mod tests { use itertools::Itertools; - use crate::constraint_framework::preprocessed_columns::gen_is_first; + use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::FrameworkEval; use crate::core::poly::circle::CanonicCoset; use crate::examples::blake::round::r#gen::{ @@ -92,7 +92,11 @@ mod tests { &round_lookup_elements, ); - let trace = TreeVec::new(vec![vec![gen_is_first(LOG_SIZE)], trace, interaction_trace]); + let trace = TreeVec::new(vec![ + vec![IsFirst::new(LOG_SIZE).gen_column_simd()], + trace, + interaction_trace, + ]); let trace_polys = trace.map_cols(|c| c.interpolate()); let component = BlakeRoundEval { diff --git a/crates/prover/src/examples/blake/scheduler/mod.rs b/crates/prover/src/examples/blake/scheduler/mod.rs index c998ed61b..dc9baa886 100644 --- a/crates/prover/src/examples/blake/scheduler/mod.rs +++ b/crates/prover/src/examples/blake/scheduler/mod.rs @@ -57,7 +57,7 @@ mod tests { use itertools::Itertools; - use crate::constraint_framework::preprocessed_columns::gen_is_first; + use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::FrameworkEval; use crate::core::poly::circle::CanonicCoset; use crate::examples::blake::round::RoundElements; @@ -89,7 +89,11 @@ mod tests { &blake_lookup_elements, ); - let trace = TreeVec::new(vec![vec![gen_is_first(LOG_SIZE)], trace, interaction_trace]); + let trace = TreeVec::new(vec![ + vec![IsFirst::new(LOG_SIZE).gen_column_simd()], + trace, + interaction_trace, + ]); let trace_polys = trace.map_cols(|c| c.interpolate()); let component = BlakeSchedulerEval { diff --git a/crates/prover/src/examples/blake/xor_table/constraints.rs b/crates/prover/src/examples/blake/xor_table/constraints.rs index 60fef8bfe..e42979b4a 100644 --- a/crates/prover/src/examples/blake/xor_table/constraints.rs +++ b/crates/prover/src/examples/blake/xor_table/constraints.rs @@ -18,27 +18,15 @@ macro_rules! xor_table_eval { // cl is the constant column for the xor: al ^ bl. let al = self .eval - .get_preprocessed_column(PreprocessedColumn::XorTable( - ELEM_BITS, - EXPAND_BITS, - 0, - )); + .get_preprocessed_column(XorTable::new(ELEM_BITS, EXPAND_BITS, 0).id()); let bl = self .eval - .get_preprocessed_column(PreprocessedColumn::XorTable( - ELEM_BITS, - EXPAND_BITS, - 1, - )); + .get_preprocessed_column(XorTable::new(ELEM_BITS, EXPAND_BITS, 1).id()); let cl = self .eval - .get_preprocessed_column(PreprocessedColumn::XorTable( - ELEM_BITS, - EXPAND_BITS, - 2, - )); + .get_preprocessed_column(XorTable::new(ELEM_BITS, EXPAND_BITS, 2).id()); for i in (0..(1 << (2 * EXPAND_BITS))) { let (i, j) = ((i >> EXPAND_BITS) as u32, (i % (1 << EXPAND_BITS)) as u32); @@ -46,15 +34,15 @@ macro_rules! xor_table_eval { let a = al.clone() + E::F::from(BaseField::from_u32_unchecked( - i << limb_bits::(), + i << XorTable::new(ELEM_BITS, EXPAND_BITS, 0).limb_bits(), )); let b = bl.clone() + E::F::from(BaseField::from_u32_unchecked( - j << limb_bits::(), + j << XorTable::new(ELEM_BITS, EXPAND_BITS, 1).limb_bits(), )); let c = cl.clone() + E::F::from(BaseField::from_u32_unchecked( - (i ^ j) << limb_bits::(), + (i ^ j) << XorTable::new(ELEM_BITS, EXPAND_BITS, 2).limb_bits(), )); self.eval.add_to_relation(RelationEntry::new( diff --git a/crates/prover/src/examples/blake/xor_table/gen.rs b/crates/prover/src/examples/blake/xor_table/gen.rs index 55877d02e..959968166 100644 --- a/crates/prover/src/examples/blake/xor_table/gen.rs +++ b/crates/prover/src/examples/blake/xor_table/gen.rs @@ -17,8 +17,10 @@ macro_rules! xor_table_gen { .iter() .map(|mult| { CircleEvaluation::new( - CanonicCoset::new(column_bits::()) - .circle_domain(), + CanonicCoset::new( + XorTable::new(ELEM_BITS, EXPAND_BITS, 0).column_bits(), + ) + .circle_domain(), mult.clone(), ) }) @@ -41,10 +43,11 @@ macro_rules! xor_table_gen { ColumnVec>, SecureField, ) { - let limb_bits = limb_bits::(); + let limb_bits = XorTable::new(ELEM_BITS, EXPAND_BITS, 0).limb_bits(); let _span = span!(Level::INFO, "Xor interaction trace").entered(); let offsets_vec = u32x16::from_array(std::array::from_fn(|i| i as u32)); - let mut logup_gen = LogupTraceGenerator::new(column_bits::()); + let mut logup_gen = + LogupTraceGenerator::new(XorTable::new(ELEM_BITS, EXPAND_BITS, 0).column_bits()); // Iterate each pair of columns, to batch their lookup together. // There are 2^(2*EXPAND_BITS) column, for each combination of ah, bh. @@ -65,7 +68,9 @@ macro_rules! xor_table_gen { // Each column has 2^(2*LIMB_BITS) rows, packed in N_LANES. #[allow(clippy::needless_range_loop)] - for vec_row in 0..(1 << (column_bits::() - LOG_N_LANES)) { + for vec_row in + 0..(1 << (XorTable::new(ELEM_BITS, EXPAND_BITS, 0).column_bits() - LOG_N_LANES)) + { // vec_row is LIMB_BITS of al and LIMB_BITS - LOG_N_LANES of bl. // Extract al, blh from vec_row. let al = vec_row >> (limb_bits - LOG_N_LANES); @@ -104,7 +109,8 @@ macro_rules! xor_table_gen { let bh = i as u32 & ((1 << EXPAND_BITS) - 1); #[allow(clippy::needless_range_loop)] - for vec_row in 0..(1 << (column_bits::() - LOG_N_LANES)) + for vec_row in 0..(1 + << (XorTable::new(ELEM_BITS, EXPAND_BITS, 0).column_bits() - LOG_N_LANES)) { // vec_row is LIMB_BITS of a, and LIMB_BITS - LOG_N_LANES of b. let al = vec_row >> (limb_bits - LOG_N_LANES); @@ -129,42 +135,6 @@ macro_rules! xor_table_gen { logup_gen.finalize_last() } - - /// Generates the Preprocessed trace for the xor table. - /// Returns the Preprocessed trace, the Preprocessed trace, and the claimed sum. - #[allow(clippy::type_complexity)] - pub fn generate_constant_trace( - ) -> ColumnVec> { - let limb_bits = limb_bits::(); - let _span = span!(Level::INFO, "Xor Preprocessed trace").entered(); - - // Generate the constant columns. In reality, these should be generated before the - // proof even began. - let a_col: BaseColumn = (0..(1 << (column_bits::()))) - .map(|i| BaseField::from_u32_unchecked((i >> limb_bits) as u32)) - .collect(); - let b_col: BaseColumn = (0..(1 << (column_bits::()))) - .map(|i| BaseField::from_u32_unchecked((i & ((1 << limb_bits) - 1)) as u32)) - .collect(); - let c_col: BaseColumn = (0..(1 << (column_bits::()))) - .map(|i| { - BaseField::from_u32_unchecked( - ((i >> limb_bits) ^ (i & ((1 << limb_bits) - 1))) as u32, - ) - }) - .collect(); - - let mut constant_trace = [a_col, b_col, c_col] - .map(|x| { - CircleEvaluation::new( - CanonicCoset::new(column_bits::()).circle_domain(), - x, - ) - }) - .to_vec(); - constant_trace.push(gen_is_first(column_bits::())); - constant_trace - } }; } pub(crate) use xor_table_gen; diff --git a/crates/prover/src/examples/blake/xor_table/mod.rs b/crates/prover/src/examples/blake/xor_table/mod.rs index e653e0bb9..d8a22118c 100644 --- a/crates/prover/src/examples/blake/xor_table/mod.rs +++ b/crates/prover/src/examples/blake/xor_table/mod.rs @@ -19,8 +19,9 @@ use itertools::Itertools; use num_traits::Zero; use tracing::{span, Level}; +use super::preprocessed_columns::XorTable; use crate::constraint_framework::logup::{LogupAtRow, LogupTraceGenerator}; -use crate::constraint_framework::preprocessed_columns::{gen_is_first, PreprocessedColumn}; +use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::{ relation, EvalAtRow, FrameworkComponent, FrameworkEval, InfoEvaluator, Relation, RelationEntry, INTERACTION_TRACE_IDX, PREPROCESSED_TRACE_IDX, @@ -52,14 +53,7 @@ macro_rules! xor_table_component { let info = component.evaluate(InfoEvaluator::empty()); info.mask_offsets .as_cols_ref() - .map_cols(|_| column_bits::()) - } - - pub const fn limb_bits() -> u32 { - ELEM_BITS - EXPAND_BITS - } - pub const fn column_bits() -> u32 { - 2 * limb_bits::() + .map_cols(|_| XorTable::new(ELEM_BITS, EXPAND_BITS, 0).column_bits()) } /// Accumulator that keeps track of the number of times each input has been used. @@ -74,7 +68,11 @@ macro_rules! xor_table_component { fn default() -> Self { Self { mults: (0..(1 << (2 * EXPAND_BITS))) - .map(|_| BaseColumn::zeros(1 << column_bits::())) + .map(|_| { + BaseColumn::zeros( + 1 << XorTable::new(ELEM_BITS, EXPAND_BITS, 0).column_bits(), + ) + }) .collect_vec(), } } @@ -84,12 +82,16 @@ macro_rules! xor_table_component { // Split a and b into high and low parts, according to ELEMENT_BITS and EXPAND_BITS. // The high part is the index of the multiplicity column. // The low part is the index of the element in that column. - let al = a & u32x16::splat((1 << limb_bits::()) - 1); - let ah = a >> limb_bits::(); - let bl = b & u32x16::splat((1 << limb_bits::()) - 1); - let bh = b >> limb_bits::(); + let al = a & u32x16::splat( + (1 << XorTable::new(ELEM_BITS, EXPAND_BITS, 0).limb_bits()) - 1, + ); + let ah = a >> XorTable::new(ELEM_BITS, EXPAND_BITS, 0).limb_bits(); + let bl = b & u32x16::splat( + (1 << XorTable::new(ELEM_BITS, EXPAND_BITS, 0).limb_bits()) - 1, + ); + let bh = b >> XorTable::new(ELEM_BITS, EXPAND_BITS, 0).limb_bits(); let column_idx = (ah << EXPAND_BITS) + bh; - let offset = (al << limb_bits::()) + bl; + let offset = (al << XorTable::new(ELEM_BITS, EXPAND_BITS, 0).limb_bits()) + bl; // Since the indices may collide, we cannot use scatter simd operations here. // Instead, loop over packed values. @@ -114,10 +116,10 @@ macro_rules! xor_table_component { for XorTableEval { fn log_size(&self) -> u32 { - column_bits::<$elem_bits, $expand_bits>() + XorTable::new($elem_bits, $expand_bits, 0).column_bits() } fn max_constraint_log_degree_bound(&self) -> u32 { - column_bits::<$elem_bits, $expand_bits>() + 1 + XorTable::new($elem_bits, $expand_bits, 0).column_bits() + 1 } fn evaluate(&self, mut eval: E) -> E { let xor_eval = $modname::XorTableEvalAtRow::<'_, _, ELEM_BITS, EXPAND_BITS> { @@ -156,9 +158,9 @@ mod tests { use crate::constraint_framework::logup::LookupElements; use crate::constraint_framework::{assert_constraints, FrameworkEval}; use crate::core::poly::circle::CanonicCoset; + use crate::examples::blake::preprocessed_columns::XorTable; use crate::examples::blake::xor_table::xor12::{ - column_bits, generate_constant_trace, generate_interaction_trace, generate_trace, - XorAccumulator, XorTableEval, + generate_interaction_trace, generate_trace, XorAccumulator, XorTableEval, }; #[test] @@ -175,7 +177,7 @@ mod tests { let lookup_elements = crate::examples::blake::XorElements12::dummy(); let (interaction_trace, claimed_sum) = generate_interaction_trace(lookup_data, &lookup_elements); - let constant_trace = generate_constant_trace::(); + let constant_trace = XorTable::new(ELEM_BITS, EXPAND_BITS, 0).generate_constant_trace(); let trace = TreeVec::new(vec![constant_trace, trace, interaction_trace]); let trace_polys = TreeVec::>::map_cols(trace, |c| c.interpolate()); @@ -186,7 +188,7 @@ mod tests { }; assert_constraints( &trace_polys, - CanonicCoset::new(column_bits::()), + CanonicCoset::new(XorTable::new(ELEM_BITS, EXPAND_BITS, 0).column_bits()), |eval| { component.evaluate(eval); }, diff --git a/crates/prover/src/examples/plonk/mod.rs b/crates/prover/src/examples/plonk/mod.rs index 78f431185..8728b1e94 100644 --- a/crates/prover/src/examples/plonk/mod.rs +++ b/crates/prover/src/examples/plonk/mod.rs @@ -3,7 +3,7 @@ use num_traits::One; use tracing::{span, Level}; use crate::constraint_framework::logup::{ClaimedPrefixSum, LogupTraceGenerator, LookupElements}; -use crate::constraint_framework::preprocessed_columns::{gen_is_first, PreprocessedColumn}; +use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::{ assert_constraints, relation, EvalAtRow, FrameworkComponent, FrameworkEval, RelationEntry, TraceLocationAllocator, @@ -49,12 +49,12 @@ impl FrameworkEval for PlonkEval { } fn evaluate(&self, mut eval: E) -> E { - let a_wire = eval.get_preprocessed_column(PreprocessedColumn::Plonk(0)); - let b_wire = eval.get_preprocessed_column(PreprocessedColumn::Plonk(1)); + let a_wire = eval.get_preprocessed_column(Plonk::new("wire_a".to_string()).id()); + let b_wire = eval.get_preprocessed_column(Plonk::new("wire_b".to_string()).id()); // Note: c_wire could also be implicit: (self.eval.point() - M31_CIRCLE_GEN.into_ef()).x. // A constant column is easier though. - let c_wire = eval.get_preprocessed_column(PreprocessedColumn::Plonk(2)); - let op = eval.get_preprocessed_column(PreprocessedColumn::Plonk(3)); + let c_wire = eval.get_preprocessed_column(Plonk::new("wire_c".to_string()).id()); + let op = eval.get_preprocessed_column(Plonk::new("op".to_string()).id()); let mult = eval.next_trace_mask(); let a_val = eval.next_trace_mask(); @@ -195,7 +195,7 @@ pub fn prove_fibonacci_plonk( // Preprocessed trace. let span = span!(Level::INFO, "Constant").entered(); let mut tree_builder = commitment_scheme.tree_builder(); - let is_first = gen_is_first(log_n_rows); + let is_first = IsFirst::new(log_n_rows).gen_column_simd(); let mut constant_trace = [ circuit.a_wire.clone(), circuit.b_wire.clone(), diff --git a/crates/prover/src/examples/poseidon/mod.rs b/crates/prover/src/examples/poseidon/mod.rs index 481d30fd6..3f45e329c 100644 --- a/crates/prover/src/examples/poseidon/mod.rs +++ b/crates/prover/src/examples/poseidon/mod.rs @@ -7,7 +7,7 @@ use num_traits::One; use tracing::{info, span, Level}; use crate::constraint_framework::logup::LogupTraceGenerator; -use crate::constraint_framework::preprocessed_columns::gen_is_first; +use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::{ relation, EvalAtRow, FrameworkComponent, FrameworkEval, Relation, RelationEntry, TraceLocationAllocator, @@ -349,7 +349,7 @@ pub fn prove_poseidon( // Preprocessed trace. let span = span!(Level::INFO, "Constant").entered(); let mut tree_builder = commitment_scheme.tree_builder(); - let constant_trace = vec![gen_is_first(log_n_rows)]; + let constant_trace = vec![IsFirst::new(log_n_rows).gen_column_simd()]; tree_builder.extend_evals(constant_trace); tree_builder.commit(channel); span.exit(); @@ -397,7 +397,7 @@ mod tests { use num_traits::One; use crate::constraint_framework::assert_constraints; - use crate::constraint_framework::preprocessed_columns::gen_is_first; + use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::core::air::Component; use crate::core::channel::Blake2sChannel; use crate::core::fields::m31::BaseField; @@ -472,7 +472,11 @@ mod tests { let (trace1, total_sum) = gen_interaction_trace(LOG_N_ROWS, interaction_data, &lookup_elements); - let traces = TreeVec::new(vec![vec![gen_is_first(LOG_N_ROWS)], trace0, trace1]); + let traces = TreeVec::new(vec![ + vec![IsFirst::new(LOG_N_ROWS).gen_column_simd()], + trace0, + trace1, + ]); let trace_polys = traces.map(|trace| trace.into_iter().map(|c| c.interpolate()).collect_vec()); assert_constraints( diff --git a/crates/prover/src/examples/state_machine/mod.rs b/crates/prover/src/examples/state_machine/mod.rs index 5de104188..8efc91246 100644 --- a/crates/prover/src/examples/state_machine/mod.rs +++ b/crates/prover/src/examples/state_machine/mod.rs @@ -11,9 +11,7 @@ use components::{ use gen::{gen_interaction_trace, gen_trace}; use itertools::{chain, Itertools}; -use crate::constraint_framework::preprocessed_columns::{ - gen_preprocessed_columns, PreprocessedColumn, -}; +use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::TraceLocationAllocator; use crate::core::backend::simd::m31::LOG_N_LANES; use crate::core::backend::simd::SimdBackend; @@ -59,13 +57,17 @@ pub fn prove_state_machine( let mut commitment_scheme = CommitmentSchemeProver::<_, Blake2sMerkleChannel>::new(config, &twiddles); - let preprocessed_columns = [ - PreprocessedColumn::IsFirst(x_axis_log_rows), - PreprocessedColumn::IsFirst(y_axis_log_rows), - ]; + let preprocessed_columns = [IsFirst::new(x_axis_log_rows), IsFirst::new(y_axis_log_rows)]; // Preprocessed trace. - let preprocessed_trace = gen_preprocessed_columns(preprocessed_columns.iter()); + let preprocessed_trace = preprocessed_columns + .into_iter() + .map(|col| col.gen_column_simd()) + .collect(); + let preprocessed_columns = [ + IsFirst::new(x_axis_log_rows).id(), + IsFirst::new(y_axis_log_rows).id(), + ]; // Trace. let trace_op0 = gen_trace(x_axis_log_rows, initial_state, 0); @@ -209,7 +211,7 @@ mod tests { use super::gen::{gen_interaction_trace, gen_trace}; use super::{prove_state_machine, verify_state_machine}; use crate::constraint_framework::expr::ExprEvaluator; - use crate::constraint_framework::preprocessed_columns::gen_is_first; + use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::{ assert_constraints, FrameworkEval, Relation, TraceLocationAllocator, }; @@ -245,7 +247,7 @@ mod tests { ); let trace = TreeVec::new(vec![ - vec![gen_is_first(log_n_rows)], + vec![IsFirst::new(log_n_rows).gen_column_simd()], trace, interaction_trace, ]); @@ -374,12 +376,12 @@ mod tests { trace_2_column_4_offset_claimed_sum, \ trace_2_column_5_offset_claimed_sum\ ]) - (claimed_sum)) \ - * (preprocessed_is_first); + * (preprocessed_is_first_8); \ let constraint_1 = (QM31Impl::from_partial_evals([trace_2_column_2_offset_0, trace_2_column_3_offset_0, trace_2_column_4_offset_0, trace_2_column_5_offset_0]) \ - (QM31Impl::from_partial_evals([trace_2_column_2_offset_neg_1, trace_2_column_3_offset_neg_1, trace_2_column_4_offset_neg_1, trace_2_column_5_offset_neg_1]) \ - - ((total_sum) * (preprocessed_is_first)))\ + - ((total_sum) * (preprocessed_is_first_8)))\ ) \ * ((intermediate0) * (intermediate1)) \ - (intermediate1 - (intermediate0));" diff --git a/crates/prover/src/examples/xor/gkr_lookups/mle_eval.rs b/crates/prover/src/examples/xor/gkr_lookups/mle_eval.rs index 3c0c17d0c..9c16ddc00 100644 --- a/crates/prover/src/examples/xor/gkr_lookups/mle_eval.rs +++ b/crates/prover/src/examples/xor/gkr_lookups/mle_eval.rs @@ -8,7 +8,7 @@ use itertools::{chain, zip_eq, Itertools}; use num_traits::{One, Zero}; use tracing::{span, Level}; -use crate::constraint_framework::preprocessed_columns::gen_is_first; +use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::{ EvalAtRow, InfoEvaluator, PointEvaluator, SimdDomainEvaluator, TraceLocationAllocator, }; @@ -210,7 +210,8 @@ impl ComponentProver for MleEvalProverComp .interpolate_with_twiddles(self.twiddles) .evaluate_with_twiddles(eval_domain, self.twiddles) .into_coordinate_evals(); - let is_first_lde = gen_is_first::(self.log_size()) + let is_first_lde = IsFirst::new(self.log_size()) + .gen_column_simd() .interpolate_with_twiddles(self.twiddles) .evaluate_with_twiddles(eval_domain, self.twiddles); let aux_interaction = component_trace.len(); @@ -744,9 +745,7 @@ mod tests { eval_prefix_sum_constraints, gen_carry_quotient_col, MleEvalPoint, MleEvalProverComponent, MleEvalVerifierComponent, }; - use crate::constraint_framework::preprocessed_columns::{ - gen_is_first, gen_is_step_with_offset, - }; + use crate::constraint_framework::preprocessed_columns::IsFirst; use crate::constraint_framework::{assert_constraints, EvalAtRow, TraceLocationAllocator}; use crate::core::air::{Component, ComponentProver, Components}; use crate::core::backend::cpu::bit_reverse; @@ -767,6 +766,7 @@ mod tests { use crate::core::vcs::blake2_merkle::Blake2sMerkleChannel; use crate::examples::xor::gkr_lookups::accumulation::MIN_LOG_BLOWUP_FACTOR; use crate::examples::xor::gkr_lookups::mle_eval::eval_step_selector_with_offset; + use crate::examples::xor::gkr_lookups::preprocessed_columns::IsStepWithOffset; #[test] fn mle_eval_prover_component() -> Result<(), VerificationError> { @@ -950,7 +950,7 @@ mod tests { let mle_coeffs_col_trace = mle_coeff_column::build_trace(&mle); let claim_shift = claim / BaseField::from(size); let carry_quotients_col = gen_carry_quotient_col(&eval_point).into_coordinate_evals(); - let is_first_col = [gen_is_first(log_size)]; + let is_first_col = [IsFirst::new(log_size).gen_column_simd()]; let aux_trace = chain![carry_quotients_col, is_first_col].collect(); let traces = TreeVec::new(vec![mle_coeffs_col_trace, mle_eval_trace, aux_trace]); let trace_polys = traces.map(|trace| trace.into_iter().map(|c| c.interpolate()).collect()); @@ -992,7 +992,7 @@ mod tests { let mle_eval_point = MleEvalPoint::new(&eval_point); let trace = build_trace(&mle, &eval_point, mle.eval_at_point(&eval_point)); let carry_quotients_col = gen_carry_quotient_col(&eval_point).into_coordinate_evals(); - let is_first_col = [gen_is_first(N_VARIABLES as u32)]; + let is_first_col = [IsFirst::new(N_VARIABLES as u32).gen_column_simd()]; let aux_trace = chain![carry_quotients_col, is_first_col].collect(); let traces = TreeVec::new(vec![trace, aux_trace]); let trace_polys = traces.map(|trace| trace.into_iter().map(|c| c.interpolate()).collect()); @@ -1029,7 +1029,7 @@ mod tests { let mle_eval_point = MleEvalPoint::new(&eval_point); let trace = build_trace(&mle, &eval_point, mle.eval_at_point(&eval_point)); let carry_quotients_col = gen_carry_quotient_col(&eval_point).into_coordinate_evals(); - let is_first_col = [gen_is_first(N_VARIABLES as u32)]; + let is_first_col = [IsFirst::new(N_VARIABLES as u32).gen_column_simd()]; let aux_trace = chain![carry_quotients_col, is_first_col].collect(); let traces = TreeVec::new(vec![trace, aux_trace]); let trace_polys = traces.map(|trace| trace.into_iter().map(|c| c.interpolate()).collect()); @@ -1066,7 +1066,7 @@ mod tests { let mle_eval_point = MleEvalPoint::new(&eval_point); let trace = build_trace(&mle, &eval_point, mle.eval_at_point(&eval_point)); let carry_quotients_col = gen_carry_quotient_col(&eval_point).into_coordinate_evals(); - let is_first_col = [gen_is_first(N_VARIABLES as u32)]; + let is_first_col = [IsFirst::new(N_VARIABLES as u32).gen_column_simd()]; let aux_trace = chain![carry_quotients_col, is_first_col].collect(); let traces = TreeVec::new(vec![trace, aux_trace]); let trace_polys = traces.map(|trace| trace.into_iter().map(|c| c.interpolate()).collect()); @@ -1120,7 +1120,7 @@ mod tests { const OFFSET: usize = 1; const LOG_STEP: u32 = 2; let coset = CanonicCoset::new(LOG_SIZE).coset(); - let col_eval = gen_is_step_with_offset::(LOG_SIZE, LOG_STEP, OFFSET); + let col_eval = IsStepWithOffset::new(LOG_SIZE, LOG_STEP, OFFSET).gen_column_simd(); let col_poly = col_eval.interpolate(); let p = SECURE_FIELD_CIRCLE_GEN; diff --git a/crates/prover/src/examples/xor/gkr_lookups/preprocessed_columns.rs b/crates/prover/src/examples/xor/gkr_lookups/preprocessed_columns.rs index 537d57839..b94781254 100644 --- a/crates/prover/src/examples/xor/gkr_lookups/preprocessed_columns.rs +++ b/crates/prover/src/examples/xor/gkr_lookups/preprocessed_columns.rs @@ -25,8 +25,6 @@ impl IsStepWithOffset { // TODO(andrew): Consider optimizing. Is a quotients of two coset_vanishing (use succinct rep // for verifier). - // TODO(Gali): Remove allow dead code. - #[allow(dead_code)] pub fn gen_column_simd(&self) -> CircleEvaluation { let mut col = Col::::zeros(1 << self.log_size); let size = 1 << self.log_size;