Skip to content

Commit

Permalink
Formal column_size in expression evaluator (#1006)
Browse files Browse the repository at this point in the history
Formal `column_size` in expression evaluator.
  • Loading branch information
Alon-Ti authored Feb 10, 2025
1 parent a194fad commit 9f7fe0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions crates/prover/src/constraint_framework/expr/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use super::{BaseExpr, ExtExpr};
use crate::constraint_framework::expr::ColumnExpr;
use crate::constraint_framework::preprocessed_columns::PreProcessedColumnId;
use crate::constraint_framework::{EvalAtRow, Relation, RelationEntry, INTERACTION_TRACE_IDX};
use crate::core::fields::m31::M31;
use crate::core::fields::FieldExpOps;
use crate::core::lookups::utils::Fraction;

pub struct FormalLogupAtRow {
Expand All @@ -21,6 +19,7 @@ pub struct FormalLogupAtRow {
impl FormalLogupAtRow {
pub fn new(interaction: usize, log_size: u32) -> Self {
let claimed_sum_name = "claimed_sum".to_string();
let column_size_name = "column_size".to_string();

Self {
interaction,
Expand All @@ -30,10 +29,7 @@ impl FormalLogupAtRow {
is_finalized: true,
is_first: BaseExpr::zero(),
cumsum_shift: ExtExpr::Param(claimed_sum_name)
* BaseExpr::Inv(Box::new(BaseExpr::pow(
&BaseExpr::Const(M31(2)),
log_size as u128,
))),
* BaseExpr::Inv(Box::new(BaseExpr::Param(column_size_name))),
log_size,
}
}
Expand Down Expand Up @@ -207,7 +203,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])) \
+ (claimed_sum) * (qm31(32768, 0, 0, 0))) \
+ (claimed_sum) * (1 / (column_size))) \
* (intermediate1) \
- (qm31(1, 0, 0, 0));"
.to_string();
Expand Down
2 changes: 1 addition & 1 deletion crates/prover/src/examples/state_machine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ mod tests {
\
let constraint_0 = (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])) \
+ (claimed_sum) * (qm31(8388608, 0, 0, 0))\
+ (claimed_sum) * (1 / (column_size))\
) \
* ((intermediate0) * (intermediate1)) \
- (intermediate1 - (intermediate0));"
Expand Down

1 comment on commit 9f7fe0f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 9f7fe0f Previous: 394f839 Ratio
iffts/simd ifft/28 1223393444 ns/iter (± 14487601) 566367730 ns/iter (± 125553309) 2.16
merkle throughput/simd merkle 30622591 ns/iter (± 312022) 13123349 ns/iter (± 484950) 2.33

This comment was automatically generated by workflow using github-action-benchmark.

CC: @shaharsamocha7

Please sign in to comment.