Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions crates/mpcs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ whir.workspace = true
multilinear_extensions.workspace = true
num-integer = "0.1"
p3.workspace = true
p3-maybe-rayon.workspace = true
rand.workspace = true
rand_chacha.workspace = true
rayon = { workspace = true, optional = true }
Expand All @@ -32,8 +33,6 @@ witness.workspace = true
criterion.workspace = true

[features]
benchmark = ["parallel"]
default = ["parallel"] # Add "sanity-check" to debug
nightly-features = [
"p3/nightly-features",
"ff_ext/nightly-features",
Expand All @@ -43,7 +42,7 @@ nightly-features = [
"whir/nightly-features",
"witness/nightly-features",
]
parallel = ["dep:rayon"]
parallel = ["p3-maybe-rayon/parallel","dep:rayon"]
print-trace = ["whir/print-trace"]
sanity-check = []

Expand Down
2 changes: 1 addition & 1 deletion crates/mpcs/benches/interpolate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use itertools::Itertools;
use mpcs::util::arithmetic::interpolate_field_type_over_boolean_hypercube;

use multilinear_extensions::mle::{FieldType, MultilinearExtension};
use p3::maybe_rayon::prelude::*;
use rand::{SeedableRng, rngs::OsRng};
use rand_chacha::ChaCha8Rng;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};

type E = GoldilocksExt2;

Expand Down
6 changes: 1 addition & 5 deletions crates/mpcs/src/basefold/commit_phase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ use multilinear_extensions::{
mle::{IntoMLE, MultilinearExtension},
virtual_poly::build_eq_x_r_vec,
};
use rayon::{
iter::{IntoParallelIterator, IntoParallelRefMutIterator},
prelude::{IndexedParallelIterator, ParallelIterator},
slice::ParallelSlice,
};
use p3::maybe_rayon::prelude::*;

use super::structure::BasefoldCommitmentWithWitness;

Expand Down
2 changes: 1 addition & 1 deletion crates/mpcs/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub(crate) fn codeword_fold_with_challenge<E: ExtensionField>(
lo + challenge * (hi - lo)
}

#[cfg(any(test, feature = "benchmark"))]
#[cfg(any(test))]
pub mod test {
use ff_ext::FromUniformBytes;
use rand::{
Expand Down
4 changes: 2 additions & 2 deletions crates/multilinear_extensions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ either.workspace = true
ff_ext.workspace = true
itertools.workspace = true
p3.workspace = true
p3-maybe-rayon.workspace = true
rand.workspace = true
rayon.workspace = true
serde.workspace = true
Expand All @@ -26,9 +27,8 @@ log = "0.4"
serde_json.workspace = true

[features]
default = ["parallel"]
nightly-features = ["p3/nightly-features", "ff_ext/nightly-features"]
parallel = []
parallel = ["p3-maybe-rayon/parallel"]

[[bench]]
harness = false
Expand Down
3 changes: 1 addition & 2 deletions crates/multilinear_extensions/src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use crate::{
};
use ff_ext::{ExtensionField, SmallField};
use itertools::{Either, Itertools, chain, izip};
use p3::field::FieldAlgebra;
use rayon::iter::{IntoParallelIterator, IntoParallelRefIterator, ParallelIterator};
use p3::{field::FieldAlgebra, maybe_rayon::prelude::*};
use serde::de::DeserializeOwned;
use std::{
cmp::max,
Expand Down
12 changes: 4 additions & 8 deletions crates/multilinear_extensions/src/mle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@ use crate::{
};
use either::Either;
use ff_ext::{ExtensionField, FromUniformBytes};
use p3::field::{Field, FieldAlgebra};
use rand::Rng;
use rayon::{
iter::{
IndexedParallelIterator, IntoParallelIterator, IntoParallelRefIterator,
IntoParallelRefMutIterator, ParallelIterator,
},
slice::ParallelSliceMut,
use p3::{
field::{Field, FieldAlgebra},
maybe_rayon::prelude::*,
};
use rand::Rng;
use serde::{Deserialize, Serialize, de::DeserializeOwned};
use std::fmt::Debug;

Expand Down
6 changes: 1 addition & 5 deletions crates/multilinear_extensions/src/virtual_poly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ use crate::{
use either::Either;
use ff_ext::ExtensionField;
use itertools::Itertools;
use p3::field::Field;
use p3::{field::Field, maybe_rayon::prelude::*};
use rand::Rng;
use rayon::{
iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator},
slice::ParallelSliceMut,
};
use serde::{Deserialize, Serialize, de::DeserializeOwned};

pub type MonomialTermsType<'a, E> =
Expand Down
3 changes: 2 additions & 1 deletion crates/whir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ clap.workspace = true
ff_ext = { path = "../ff_ext" }
multilinear_extensions = { path = "../multilinear_extensions" }
p3.workspace = true
p3-maybe-rayon.workspace = true
rand = "0.8"
rand_chacha = "0.3"
rayon = { workspace = true, optional = true }
Expand All @@ -42,6 +43,6 @@ nightly-features = [
"transcript/nightly-features",
"witness/nightly-features",
]
parallel = ["dep:rayon"]
parallel = ["p3-maybe-rayon/parallel","dep:rayon"]
print-trace = ["tracing/log"]
rayon = ["dep:rayon"]
2 changes: 1 addition & 1 deletion crates/whir/src/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use p3::{
Dimensions,
dense::{DenseMatrix, RowMajorMatrix},
},
maybe_rayon::prelude::*,
};
use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator};
use serde::{Deserialize, Serialize, de::DeserializeOwned};
use transcript::Transcript;

Expand Down
4 changes: 2 additions & 2 deletions crates/whir/src/ntt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ mod wavelet;

use self::matrix::MatrixMut;

#[cfg(feature = "parallel")]
use p3::maybe_rayon::prelude::*;
use p3::{
dft::{Radix2DitParallel, TwoAdicSubgroupDft},
field::TwoAdicField,
matrix::Matrix,
};
#[cfg(feature = "parallel")]
use rayon::prelude::*;
use tracing::instrument;
use witness::{InstancePaddingStrategy, RowMajorMatrix};

Expand Down
6 changes: 4 additions & 2 deletions crates/whir/src/ntt/transpose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ use crate::ntt::matrix_skip::MatrixMutSkip;
use super::{super::utils::is_power_of_two, MatrixMut, utils::workload_size};
use std::mem::swap;

use p3::matrix::{Matrix, dense::RowMajorMatrix};
use rayon::iter::{IndexedParallelIterator, IntoParallelRefMutIterator, ParallelIterator};
use p3::{
matrix::{Matrix, dense::RowMajorMatrix},
maybe_rayon::prelude::*,
};
#[cfg(feature = "parallel")]
use rayon::join;
use sumcheck::macros::{entered_span, exit_span};
Expand Down
2 changes: 1 addition & 1 deletion crates/whir/src/ntt/wavelet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use p3::field::Field;
use std::cmp::max;

#[cfg(feature = "parallel")]
use rayon::prelude::*;
use p3::maybe_rayon::prelude::*;

/// Fast Wavelet Transform.
///
Expand Down
4 changes: 2 additions & 2 deletions crates/whir/src/sumcheck/prover_batched.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::proof::SumcheckPolynomial;
use crate::sumcheck::prover_single::SumcheckSingle;
use ff_ext::ExtensionField;
use p3::{field::Field, util::log2_strict_usize};
use p3::{field::Field, maybe_rayon::prelude::*, util::log2_strict_usize};
#[cfg(feature = "parallel")]
use rayon::{join, prelude::*};
use rayon::join;

pub struct SumcheckBatched<F: ExtensionField> {
// The evaluation on each p and eq
Expand Down
14 changes: 6 additions & 8 deletions crates/whir/src/sumcheck/prover_single.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::proof::SumcheckPolynomial;

use ff_ext::ExtensionField;
use p3::util::log2_strict_usize;
use p3::{maybe_rayon::prelude::*, util::log2_strict_usize};
#[cfg(feature = "parallel")]
use rayon::{join, prelude::*};
use rayon::join;

pub struct SumcheckSingle<E: ExtensionField> {
// The evaluation of p
Expand Down Expand Up @@ -261,12 +261,10 @@ mod tests {

let eval = MultilinearExtension::from_evaluations_ext_vec(2, polynomial.clone())
.evaluate(&eval_point);
let mut prover = SumcheckSingle::new(
polynomial,
&[eval_point],
&[E::from_canonical_u64(1)],
&[eval],
);
let mut prover =
SumcheckSingle::new(polynomial, &[eval_point], &[E::from_canonical_u64(1)], &[
eval,
]);

let poly_1 = prover.compute_sumcheck_polynomial();

Expand Down
5 changes: 1 addition & 4 deletions crates/whir/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ use multilinear_extensions::mle::FieldType;
use p3::{
field::Field,
matrix::{Matrix, dense::RowMajorMatrix},
};
use rayon::{
iter::ParallelIterator,
slice::{ParallelSlice, ParallelSliceMut},
maybe_rayon::prelude::*,
};
use std::collections::BTreeSet;
use sumcheck::macros::{entered_span, exit_span};
Expand Down
2 changes: 1 addition & 1 deletion crates/whir/src/whir/batch/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use sumcheck::macros::{entered_span, exit_span};
use transcript::{BasicTranscript, Transcript};

#[cfg(feature = "parallel")]
use rayon::prelude::*;
use p3::maybe_rayon::prelude::*;

#[derive(Debug)]
pub struct Witnesses<E: ExtensionField> {
Expand Down
2 changes: 1 addition & 1 deletion crates/whir/src/whir/batch/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use transcript::Transcript;

use crate::whir::fs_utils::get_challenge_stir_queries;
#[cfg(feature = "parallel")]
use rayon::prelude::*;
use p3::maybe_rayon::prelude::*;

struct RoundStateBatch<'a, E: ExtensionField> {
round_state: RoundState<'a, E>,
Expand Down
3 changes: 1 addition & 2 deletions crates/whir/src/whir/batch/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ use crate::{
use ff_ext::{ExtensionField, PoseidonField};
use itertools::zip_eq;
use multilinear_extensions::{mle::MultilinearExtension, virtual_poly::eq_eval};
use p3::{commit::Mmcs, util::log2_strict_usize};
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use p3::{commit::Mmcs, maybe_rayon::prelude::*, util::log2_strict_usize};
use sumcheck::macros::{entered_span, exit_span};
use transcript::Transcript;

Expand Down
4 changes: 2 additions & 2 deletions crates/whir/src/whir/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use crate::{
parameters::FoldType,
};

#[cfg(feature = "parallel")]
use p3::maybe_rayon::prelude::*;
use p3::{
field::{Field, TwoAdicField},
matrix::Matrix,
};
#[cfg(feature = "parallel")]
use rayon::prelude::*;

/// Given the evaluation of f on the coset specified by coset_offset * <coset_gen>
/// Compute the fold on that point
Expand Down
3 changes: 1 addition & 2 deletions crates/whir/src/whir/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use crate::{
};
use ff_ext::ExtensionField;
use multilinear_extensions::mle::{FieldType, MultilinearExtension};
use p3::matrix::dense::RowMajorMatrix;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use p3::{matrix::dense::RowMajorMatrix, maybe_rayon::prelude::*};
use sumcheck::macros::{entered_span, exit_span};
use transcript::Transcript;

Expand Down
2 changes: 1 addition & 1 deletion crates/whir/src/whir/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use multilinear_extensions::{mle::MultilinearExtension, virtual_poly::eq_eval};
use p3::{
commit::Mmcs,
field::{Field, FieldAlgebra},
maybe_rayon::prelude::*,
};
use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator};
use serde::{Deserialize, Serialize, de::DeserializeOwned};
use std::iter;
use sumcheck::macros::{entered_span, exit_span};
Expand Down
5 changes: 1 addition & 4 deletions crates/witness/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ use multilinear_extensions::mle::{IntoMLE, MultilinearExtension};
use p3::{
field::{Field, FieldAlgebra},
matrix::Matrix,
maybe_rayon::prelude::*,
};
use rand::{Rng, distributions::Standard, prelude::Distribution};
use rayon::{
iter::{IndexedParallelIterator, IntoParallelIterator, ParallelExtend, ParallelIterator},
slice::ParallelSliceMut,
};
use std::{
ops::{Deref, DerefMut, Index},
slice::{Chunks, ChunksMut},
Expand Down
Loading