Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch inverse lookup column denominators. #677

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions crates/prover/src/core/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use super::circle::Coset;
use super::poly::circle::CircleDomain;
use super::utils::bit_reverse_index;

// TODO(AlonH): Move file to fri directory.

pub const UPPER_BOUND_QUERY_BYTES: usize = 4;

/// An ordered set of query indices over a bit reversed [CircleDomain].
Expand Down
1 change: 0 additions & 1 deletion crates/prover/src/examples/fibonacci/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ impl Fibonacci {
pub fn get_trace(&self) -> CpuCircleEvaluation<BaseField, BitReversedOrder> {
// Trace.
let trace_domain = CanonicCoset::new(self.air.component.log_size);
// TODO(AlonH): Consider using Vec::new instead of Vec::with_capacity throughout file.
let mut trace = Vec::with_capacity(trace_domain.size());

// Fill trace with fibonacci squared.
Expand Down
1 change: 0 additions & 1 deletion crates/prover/src/examples/wide_fibonacci/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ pub fn gen_trace(
.collect_vec()
}

// TODO(AlonH): Implement.
impl ComponentTraceGenerator<SimdBackend> for SimdWideFibComponent {
type Component = Self;
type Inputs = ();
Expand Down
26 changes: 16 additions & 10 deletions crates/prover/src/examples/wide_fibonacci/trace_gen.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use itertools::Itertools;
use num_traits::One;
use num_traits::{One, Zero};

use super::component::Input;
use crate::core::fields::m31::BaseField;
Expand Down Expand Up @@ -49,23 +49,29 @@ pub fn write_lookup_column(
})
.collect_vec();

(0..n_rows)
let denominators = (0..n_rows)
.map(|i| {
let numerator = shifted_secure_combination(
&[natural_ordered_trace[0][i], natural_ordered_trace[1][i]],
alpha,
z,
);
let denominator = shifted_secure_combination(
shifted_secure_combination(
&[
natural_ordered_trace[n_columns - 2][i],
natural_ordered_trace[n_columns - 1][i],
],
alpha,
z,
)
})
.collect_vec();
let mut denominator_inverses = vec![SecureField::zero(); denominators.len()];
SecureField::batch_inverse(&denominators, &mut denominator_inverses);

(0..n_rows)
.map(|i| {
let numerator = shifted_secure_combination(
&[natural_ordered_trace[0][i], natural_ordered_trace[1][i]],
alpha,
z,
);
// TODO(AlonH): Use batch inversion.
let cell = (numerator / denominator) * prev_value;
let cell = (numerator * denominator_inverses[i]) * prev_value;
prev_value = cell;
cell
})
Expand Down
Loading