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

fix poly degree 0 underflow #10

Merged
merged 8 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 6 additions & 4 deletions halo2_proofs/benches/fft.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[macro_use]
extern crate criterion;

use halo2_proofs::{arithmetic::best_fft, poly::EvaluationDomain};
use group::ff::Field;
use halo2_proofs::{arithmetic::best_fft, poly::EvaluationDomain};
use halo2curves::bn256::Fr as Scalar;

use criterion::{BenchmarkId, Criterion};
Expand All @@ -12,16 +12,18 @@
let j = 5;
let mut group = c.benchmark_group("fft");
for k in 3..19 {
let domain = EvaluationDomain::new(j,k);
let domain = EvaluationDomain::new(j, k);
let omega = domain.get_omega();
let l = 1<<k;
let l = 1 << k;
let data = domain.get_fft_data(l);

group.bench_function(BenchmarkId::new("k", k), |b| {
let mut a = (0..(1 << k)).map(|_| Scalar::random(OsRng)).collect::<Vec<_>>();
let mut a = (0..(1 << k))
.map(|_| Scalar::random(OsRng))
.collect::<Vec<_>>();

b.iter(|| {
best_fft(&mut a, omega, k as u32, data, false);

Check warning on line 26 in halo2_proofs/benches/fft.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`u32` -> `u32`)

warning: casting to the same type is unnecessary (`u32` -> `u32`) --> halo2_proofs/benches/fft.rs:26:41 | 26 | best_fft(&mut a, omega, k as u32, data, false); | ^^^^^^^^ help: try: `k` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `-W clippy::unnecessary-cast` implied by `-W clippy::all`
});
});
}
Expand Down
8 changes: 1 addition & 7 deletions halo2_proofs/src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@

/// Convert coefficient bases group elements to lagrange basis by inverse FFT.
pub fn g_to_lagrange<C: CurveAffine>(g_projective: Vec<C::Curve>, k: u32) -> Vec<C> {
let n_inv = C::Scalar::TWO_INV.pow_vartime(&[k as u64, 0, 0, 0]);

Check failure on line 213 in halo2_proofs/src/arithmetic.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/arithmetic.rs:213:48 | 213 | let n_inv = C::Scalar::TWO_INV.pow_vartime(&[k as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[k as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings`

Check warning on line 213 in halo2_proofs/src/arithmetic.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/arithmetic.rs:213:48 | 213 | let n_inv = C::Scalar::TWO_INV.pow_vartime(&[k as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[k as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-W clippy::needless-borrow` implied by `-W clippy::all`

Check warning on line 213 in halo2_proofs/src/arithmetic.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/arithmetic.rs:213:48 | 213 | let n_inv = C::Scalar::TWO_INV.pow_vartime(&[k as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[k as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-W clippy::needless-borrow` implied by `-W clippy::all`
let omega = C::Scalar::ROOT_OF_UNITY;
let mut omega_inv = C::Scalar::ROOT_OF_UNITY_INV;
for _ in k..C::Scalar::S {
Expand All @@ -221,13 +221,7 @@
let n = g_lagrange_projective.len();
let fft_data = FFTData::new(n, omega, omega_inv);

best_fft(
&mut g_lagrange_projective,
omega_inv,
k,
&fft_data,
false,
);
best_fft(&mut g_lagrange_projective, omega_inv, k, &fft_data, false);
parallelize(&mut g_lagrange_projective, |g, _| {
for g in g.iter_mut() {
*g *= n_inv;
Expand Down Expand Up @@ -265,7 +259,7 @@
{
scope.spawn(move |_| {
let start = chunk_idx * chunk_size;
out[0] = evaluate(poly, point) * point.pow_vartime(&[start as u64, 0, 0, 0]);

Check failure on line 262 in halo2_proofs/src/arithmetic.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/arithmetic.rs:262:72 | 262 | out[0] = evaluate(poly, point) * point.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 262 in halo2_proofs/src/arithmetic.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/arithmetic.rs:262:72 | 262 | out[0] = evaluate(poly, point) * point.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 262 in halo2_proofs/src/arithmetic.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/arithmetic.rs:262:72 | 262 | out[0] = evaluate(poly, point) * point.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
});
}
});
Expand Down Expand Up @@ -316,7 +310,7 @@
pub fn parallelize<T: Send, F: Fn(&mut [T], usize) + Send + Sync + Clone>(v: &mut [T], f: F) {
let n = v.len();
let num_threads = multicore::current_num_threads();
let mut chunk = (n as usize) / num_threads;

Check failure on line 313 in halo2_proofs/src/arithmetic.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/arithmetic.rs:313:21 | 313 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `-D clippy::unnecessary-cast` implied by `-D warnings`

Check warning on line 313 in halo2_proofs/src/arithmetic.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/arithmetic.rs:313:21 | 313 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `-W clippy::unnecessary-cast` implied by `-W clippy::all`

Check warning on line 313 in halo2_proofs/src/arithmetic.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/arithmetic.rs:313:21 | 313 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `-W clippy::unnecessary-cast` implied by `-W clippy::all`
if chunk < num_threads {
chunk = 1;
}
Expand Down
64 changes: 47 additions & 17 deletions halo2_proofs/src/fft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
log_info("=== Parallel FFT ===".to_string());
parallel::fft(a, omega, log_n, data, inverse)
}
Ok(fft_impl) if fft_impl == "baseline"=> {
Ok(fft_impl) if fft_impl == "baseline" => {
log_info("=== Baseline FFT ===".to_string());
baseline::fft(a, omega, log_n, data, inverse)
}
Expand All @@ -45,17 +45,17 @@

#[cfg(test)]
mod tests {
use std::{time::Instant, env::var};
use std::{env::var, time::Instant};

use ff::Field;
use halo2curves::bn256::Fr as Scalar;
use rand_core::OsRng;

use crate::{
arithmetic::{best_fft, eval_polynomial, lagrange_interpolate},
fft::{self, recursive::FFTData},
multicore,
arithmetic::{eval_polynomial, lagrange_interpolate, best_fft},
plonk::{start_measure, log_info, stop_measure},
plonk::{log_info, start_measure, stop_measure},
poly::EvaluationDomain,
};

Expand All @@ -67,7 +67,6 @@
.expect("Cannot parse DEGREE env var as usize")
}


#[test]
fn test_fft_parallel() {
let max_log_n = 22;
Expand Down Expand Up @@ -126,18 +125,30 @@
let num_threads = multicore::current_num_threads();

let mut a = input.clone();
let l_a= a.len();
let l_a = a.len();
let start = start_measure(format!("best fft {} ({})", a.len(), num_threads), false);
fft::baseline::fft(&mut a, domain.get_omega(), k, domain.get_fft_data(l_a), false);
fft::baseline::fft(
&mut a,
domain.get_omega(),
k,
domain.get_fft_data(l_a),
false,
);
stop_measure(start);

let mut b = input;
let l_b= b.len();
let l_b = b.len();
let start = start_measure(
format!("recursive fft {} ({})", a.len(), num_threads),
false,
);
fft::recursive::fft(&mut b, domain.get_omega(), k, domain.get_fft_data(l_b), false);
fft::recursive::fft(
&mut b,
domain.get_omega(),
k,
domain.get_fft_data(l_b),
false,
);
stop_measure(start);

for i in 0..n {
Expand Down Expand Up @@ -165,7 +176,13 @@
format!("baseline fft {} ({})", data_baseline.len(), num_threads),
false,
);
fft::baseline::fft(&mut data_baseline, domain.get_omega(), k, domain.get_fft_data(l_baseline), false);
fft::baseline::fft(
&mut data_baseline,
domain.get_omega(),
k,
domain.get_fft_data(l_baseline),
false,
);
stop_measure(start);

let mut data_parallel = input.clone();
Expand All @@ -174,7 +191,13 @@
format!("parallel fft {} ({})", data_parallel.len(), num_threads),
false,
);
fft::parallel::fft(&mut data_parallel, domain.get_omega(), k, domain.get_fft_data(l_parallel), false);
fft::parallel::fft(
&mut data_parallel,
domain.get_omega(),
k,
domain.get_fft_data(l_parallel),
false,
);
stop_measure(start);

let mut data_recursive = input;
Expand Down Expand Up @@ -215,21 +238,28 @@
let num_threads = multicore::current_num_threads();

let start = start_measure(format!("fft {} ({})", input.len(), num_threads), false);
fft::fft(&mut input, domain.get_omega(), k, domain.get_fft_data(l), false);
fft::fft(
&mut input,
domain.get_omega(),
k,
domain.get_fft_data(l),
false,
);
stop_measure(start);
}

#[test]
fn test_mem_leak() {
let j = 1;
let k = 3;
let domain = EvaluationDomain::new(j,k);
let domain = EvaluationDomain::new(j, k);
let omega = domain.get_omega();
let l = 1<<k;
let l = 1 << k;
let data = domain.get_fft_data(l);
let mut a = (0..(1 << k)).map(|_| Scalar::random(OsRng)).collect::<Vec<_>>();
let mut a = (0..(1 << k))
.map(|_| Scalar::random(OsRng))
.collect::<Vec<_>>();

best_fft(&mut a, omega, k as u32, data, false);

Check warning on line 263 in halo2_proofs/src/fft.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`u32` -> `u32`)

warning: casting to the same type is unnecessary (`u32` -> `u32`) --> halo2_proofs/src/fft.rs:263:33 | 263 | best_fft(&mut a, omega, k as u32, data, false); | ^^^^^^^^ help: try: `k` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
}

}
}
2 changes: 1 addition & 1 deletion halo2_proofs/src/fft/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
fn best_fft_opt<Scalar: Field, G: FftGroup<Scalar>>(a: &mut [G], omega: Scalar, log_n: u32) {
let threads = multicore::current_num_threads();
let log_split = log2_floor(threads) as usize;
let n = a.len() as usize;

Check failure on line 24 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:24:13 | 24 | let n = a.len() as usize; | ^^^^^^^^^^^^^^^^ help: try: `a.len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 24 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:24:13 | 24 | let n = a.len() as usize; | ^^^^^^^^^^^^^^^^ help: try: `a.len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 24 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:24:13 | 24 | let n = a.len() as usize; | ^^^^^^^^^^^^^^^^ help: try: `a.len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
let sub_n = n >> log_split;
let split_m = 1 << log_split;

Expand All @@ -39,13 +39,13 @@
for k in 0..n as usize {
let rk = arithmetic::bitreverse(k, log_n as usize);
if k < rk {
a.swap(rk as usize, k as usize);

Check failure on line 42 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:42:33 | 42 | a.swap(rk as usize, k as usize); | ^^^^^^^^^^ help: try: `k` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check failure on line 42 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:42:20 | 42 | a.swap(rk as usize, k as usize); | ^^^^^^^^^^^ help: try: `rk` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 42 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:42:33 | 42 | a.swap(rk as usize, k as usize); | ^^^^^^^^^^ help: try: `k` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 42 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:42:20 | 42 | a.swap(rk as usize, k as usize); | ^^^^^^^^^^^ help: try: `rk` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 42 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:42:33 | 42 | a.swap(rk as usize, k as usize); | ^^^^^^^^^^ help: try: `k` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 42 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:42:20 | 42 | a.swap(rk as usize, k as usize); | ^^^^^^^^^^^ help: try: `rk` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
}
}

let mut m = 1;
for _ in 0..log_n {
let w_m: Scalar = omega.pow_vartime(&[u64::from(n / (2 * m)), 0, 0, 0]);

Check failure on line 48 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:48:45 | 48 | let w_m: Scalar = omega.pow_vartime(&[u64::from(n / (2 * m)), 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[u64::from(n / (2 * m)), 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 48 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:48:45 | 48 | let w_m: Scalar = omega.pow_vartime(&[u64::from(n / (2 * m)), 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[u64::from(n / (2 * m)), 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 48 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:48:45 | 48 | let w_m: Scalar = omega.pow_vartime(&[u64::from(n / (2 * m)), 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[u64::from(n / (2 * m)), 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

let mut k = 0;
while k < n {
Expand Down Expand Up @@ -120,12 +120,12 @@
let tmp_filler_val = tmp[0];
let mut t1 = vec![tmp_filler_val; split_m];
for i in 0..split_m {
t1[arithmetic::bitreverse(i, log_split)] = a[(i * sub_n + sub_fft_offset)];
t1[arithmetic::bitreverse(i, log_split)] = a[i * sub_n + sub_fft_offset];
smtmfft marked this conversation as resolved.
Show resolved Hide resolved
}
serial_split_fft(&mut t1, twiddle_lut, sub_n, log_split as u32);

let sparse_degree = SPARSE_TWIDDLE_DEGREE;
let omega_idx = sub_fft_offset as usize;

Check failure on line 128 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:128:21 | 128 | let omega_idx = sub_fft_offset as usize; | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sub_fft_offset` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 128 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:128:21 | 128 | let omega_idx = sub_fft_offset as usize; | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sub_fft_offset` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 128 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:128:21 | 128 | let omega_idx = sub_fft_offset as usize; | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sub_fft_offset` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
let low_idx = omega_idx % (1 << sparse_degree);
let high_idx = omega_idx >> sparse_degree;
let mut omega = twiddle_lut[low_idx];
Expand Down Expand Up @@ -154,7 +154,7 @@
if is_lut_len_large {
let mut twiddle_lut = vec![F::ZERO; (1 << log_n) as usize];
parallelize(&mut twiddle_lut, |twiddle_lut, start| {
let mut w_n = omega.pow_vartime(&[start as u64, 0, 0, 0]);

Check failure on line 157 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:157:45 | 157 | let mut w_n = omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 157 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:157:45 | 157 | let mut w_n = omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 157 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:157:45 | 157 | let mut w_n = omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
for twiddle_lut in twiddle_lut.iter_mut() {
*twiddle_lut = w_n;
w_n = w_n * omega;
Expand All @@ -166,22 +166,22 @@
// sparse
let low_degree_lut_len = 1 << sparse_degree;
let high_degree_lut_len = 1 << (log_n - sparse_degree - without_last_level as u32);
let mut twiddle_lut = vec![F::ZERO; (low_degree_lut_len + high_degree_lut_len) as usize];

Check failure on line 169 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:169:41 | 169 | let mut twiddle_lut = vec![F::ZERO; (low_degree_lut_len + high_degree_lut_len) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(low_degree_lut_len + high_degree_lut_len)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 169 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:169:41 | 169 | let mut twiddle_lut = vec![F::ZERO; (low_degree_lut_len + high_degree_lut_len) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(low_degree_lut_len + high_degree_lut_len)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 169 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:169:41 | 169 | let mut twiddle_lut = vec![F::ZERO; (low_degree_lut_len + high_degree_lut_len) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(low_degree_lut_len + high_degree_lut_len)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
parallelize(
&mut twiddle_lut[..low_degree_lut_len],
|twiddle_lut, start| {
let mut w_n = omega.pow_vartime(&[start as u64, 0, 0, 0]);

Check failure on line 173 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:173:45 | 173 | let mut w_n = omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 173 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:173:45 | 173 | let mut w_n = omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 173 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:173:45 | 173 | let mut w_n = omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
for twiddle_lut in twiddle_lut.iter_mut() {
*twiddle_lut = w_n;
w_n = w_n * omega;
}
},
);
let high_degree_omega = omega.pow_vartime(&[(1 << sparse_degree) as u64, 0, 0, 0]);

Check failure on line 180 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:180:47 | 180 | let high_degree_omega = omega.pow_vartime(&[(1 << sparse_degree) as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[(1 << sparse_degree) as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 180 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:180:47 | 180 | let high_degree_omega = omega.pow_vartime(&[(1 << sparse_degree) as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[(1 << sparse_degree) as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 180 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:180:47 | 180 | let high_degree_omega = omega.pow_vartime(&[(1 << sparse_degree) as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[(1 << sparse_degree) as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
parallelize(
&mut twiddle_lut[low_degree_lut_len..],
|twiddle_lut, start| {
let mut w_n = high_degree_omega.pow_vartime(&[start as u64, 0, 0, 0]);

Check failure on line 184 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:184:57 | 184 | let mut w_n = high_degree_omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 184 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:184:57 | 184 | let mut w_n = high_degree_omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 184 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:184:57 | 184 | let mut w_n = high_degree_omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
for twiddle_lut in twiddle_lut.iter_mut() {
*twiddle_lut = w_n;
w_n = w_n * high_degree_omega;
Expand All @@ -193,12 +193,12 @@

/// The parallel implementation
fn parallel_fft<Scalar: Field, G: FftGroup<Scalar>>(a: &mut [G], omega: Scalar, log_n: u32) {
let n = a.len() as usize;

Check failure on line 196 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:196:13 | 196 | let n = a.len() as usize; | ^^^^^^^^^^^^^^^^ help: try: `a.len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 196 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:196:13 | 196 | let n = a.len() as usize; | ^^^^^^^^^^^^^^^^ help: try: `a.len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 196 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:196:13 | 196 | let n = a.len() as usize; | ^^^^^^^^^^^^^^^^ help: try: `a.len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
assert_eq!(n, 1 << log_n);

let log_split = log2_floor(multicore::current_num_threads()) as usize;
let split_m = 1 << log_split;
let sub_n = n >> log_split as usize;

Check failure on line 201 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:201:22 | 201 | let sub_n = n >> log_split as usize; | ^^^^^^^^^^^^^^^^^^ help: try: `log_split` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 201 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:201:22 | 201 | let sub_n = n >> log_split as usize; | ^^^^^^^^^^^^^^^^^^ help: try: `log_split` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 201 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:201:22 | 201 | let sub_n = n >> log_split as usize; | ^^^^^^^^^^^^^^^^^^ help: try: `log_split` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
let twiddle_lut = generate_twiddle_lookup_table(omega, log_n, SPARSE_TWIDDLE_DEGREE, true);

// split fft
Expand Down Expand Up @@ -229,7 +229,7 @@
});

// sub fft
let new_omega = omega.pow_vartime(&[split_m as u64, 0, 0, 0]);

Check failure on line 232 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:232:39 | 232 | let new_omega = omega.pow_vartime(&[split_m as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[split_m as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 232 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:232:39 | 232 | let new_omega = omega.pow_vartime(&[split_m as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[split_m as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 232 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/parallel.rs:232:39 | 232 | let new_omega = omega.pow_vartime(&[split_m as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[split_m as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
multicore::scope(|scope| {
for a in a.chunks_mut(sub_n) {
scope.spawn(move |_| {
Expand Down Expand Up @@ -259,9 +259,9 @@
fn parallelize<T: Send, F: Fn(&mut [T], usize) + Send + Sync + Clone>(v: &mut [T], f: F) {
let n = v.len();
let num_threads = multicore::current_num_threads();
let mut chunk = (n as usize) / num_threads;

Check failure on line 262 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:262:21 | 262 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 262 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:262:21 | 262 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
if chunk < num_threads {
chunk = n as usize;

Check failure on line 264 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:264:17 | 264 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 264 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:264:17 | 264 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 264 in halo2_proofs/src/fft/parallel.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/parallel.rs:264:17 | 264 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
}

multicore::scope(|scope| {
Expand Down
4 changes: 3 additions & 1 deletion halo2_proofs/src/fft/recursive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
impl<F: arithmetic::Field> FFTData<F> {
/// Create FFT data
pub fn new(n: usize, omega: F, omega_inv: F) -> Self {
let stages = get_stages(n as usize, vec![]);

Check failure on line 87 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:87:33 | 87 | let stages = get_stages(n as usize, vec![]); | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 87 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:87:33 | 87 | let stages = get_stages(n as usize, vec![]); | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 87 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:87:33 | 87 | let stages = get_stages(n as usize, vec![]); | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
let mut f_twiddles = vec![];
let mut inv_twiddles = vec![];
let mut scratch = vec![F::ZERO; n];
Expand All @@ -104,7 +104,7 @@
// Twiddles
parallelize(twiddles, |twiddles, start| {
let w_m = o;
let mut w = o.pow_vartime(&[start as u64, 0, 0, 0]);

Check failure on line 107 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/fft/recursive.rs:107:43 | 107 | let mut w = o.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 107 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/recursive.rs:107:43 | 107 | let mut w = o.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 107 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/fft/recursive.rs:107:43 | 107 | let mut w = o.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
for value in twiddles.iter_mut() {
*value = w;
w *= w_m;
Expand Down Expand Up @@ -145,7 +145,9 @@
}

/// Return private field `n`
pub fn get_n(&self) -> usize { self.n }
pub fn get_n(&self) -> usize {
self.n
}
}

/// Radix 2 butterfly
Expand Down Expand Up @@ -180,9 +182,9 @@
num_threads: usize,
) {
let n = out.len();
let mut chunk = (n as usize) / num_threads;

Check failure on line 185 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:185:21 | 185 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 185 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:185:21 | 185 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 185 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:185:21 | 185 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
if chunk < num_threads {
chunk = n as usize;

Check failure on line 187 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:187:17 | 187 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 187 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:187:17 | 187 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 187 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:187:17 | 187 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
}

multicore::scope(|scope| {
Expand Down Expand Up @@ -273,9 +275,9 @@
let j = twiddles[twiddles.len() - 1];

let n = out.len();
let mut chunk = (n as usize) / num_threads;

Check failure on line 278 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:278:21 | 278 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 278 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:278:21 | 278 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 278 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:278:21 | 278 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
if chunk < num_threads {
chunk = n as usize;

Check failure on line 280 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:280:17 | 280 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 280 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:280:17 | 280 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 280 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:280:17 | 280 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
}
multicore::scope(|scope| {
//let mut parts: Vec<&mut [F]> = out.chunks_mut(4).collect();
Expand Down Expand Up @@ -436,9 +438,9 @@
f: F,
) {
let n = v.len();
let mut chunk = (n as usize) / num_threads;

Check failure on line 441 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:441:21 | 441 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 441 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:441:21 | 441 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 441 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:441:21 | 441 | let mut chunk = (n as usize) / num_threads; | ^^^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
if chunk < num_threads {
chunk = n as usize;

Check failure on line 443 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:443:17 | 443 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 443 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:443:17 | 443 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 443 in halo2_proofs/src/fft/recursive.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/fft/recursive.rs:443:17 | 443 | chunk = n as usize; | ^^^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
}

multicore::scope(|scope| {
Expand Down
34 changes: 29 additions & 5 deletions halo2_proofs/src/plonk/evaluation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
.enumerate()
.take(num_clusters)
{
cluster.resize(1 << cluster_idx, domain.empty_lagrange());
cluster.resize(1 << cluster_idx, domain.empty_lagrange());
smtmfft marked this conversation as resolved.
Show resolved Hide resolved
}

// Calculate the quotient polynomial for each part
Expand Down Expand Up @@ -539,7 +539,6 @@
constraint_idx += self.num_custom_gate_constraints;
stop_measure(start);


// Permutations
let start = start_measure("permutations", false);
let sets = &permutation.sets;
Expand Down Expand Up @@ -692,7 +691,7 @@
[compute_part_idx_in_cluster(part_idx, running_prod_cluster)],
|values, start| {
let mut beta_term = current_extended_omega
* omega.pow_vartime(&[start as u64, 0, 0, 0]);

Check failure on line 694 in halo2_proofs/src/plonk/evaluation.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/plonk/evaluation.rs:694:57 | 694 | ... * omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 694 in halo2_proofs/src/plonk/evaluation.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/plonk/evaluation.rs:694:57 | 694 | ... * omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 694 in halo2_proofs/src/plonk/evaluation.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/plonk/evaluation.rs:694:57 | 694 | ... * omega.pow_vartime(&[start as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[start as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
for (i, value) in values.iter_mut().enumerate() {
let idx = start + i;
let r_next = get_rotation_idx(idx, 1, rot_scale, isize);
Expand Down Expand Up @@ -976,10 +975,15 @@
}

fn compute_cluster_idx(degree: usize, max_cluster_idx: usize) -> usize {
let mut idx = (31 - (degree as u32).leading_zeros()) as usize;
if 1 << idx < degree {
idx = idx + 1;
let mut idx = 0;
if degree != 0 {
// same as unstable degree.ilog()
idx = (degree as f32).log2().floor() as usize;

Choose a reason for hiding this comment

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

Good catch with the versioning.

I would prefer idx = (31 - (degree as u32).leading_zeros()) as usize over introducing floating-point math.

Copy link
Author

Choose a reason for hiding this comment

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

NP, let's back to the origin code :)

if !degree.is_power_of_two() {
idx += 1;
}
}

std::cmp::min(max_cluster_idx, idx)
}
}
Expand Down Expand Up @@ -1245,3 +1249,23 @@
});
values
}

mod test {
use halo2curves::{secp256k1::Secp256k1Affine, CurveAffine};

#[test]
#[should_panic(expected = "attempt to subtract with overflow")]
fn compute_cluster_idx_underflow() {
smtmfft marked this conversation as resolved.
Show resolved Hide resolved
let degree = 0;
let idx = (31 - (degree as u32).leading_zeros()) as usize;
println!("idx = {}", idx);
}

#[test]
fn compute_cluster_idx_new() {
for degree in 0..17usize {
let idx = super::Evaluator::<Secp256k1Affine>::compute_cluster_idx(degree, 10);
println!("degree = {}, idx = {}", degree, idx);
}
}
}
3 changes: 1 addition & 2 deletions halo2_proofs/src/plonk/permutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ where
impl<C: CurveAffine> ProvingKey<C> {
/// Gets the total number of bytes in the serialization of `self`
pub(super) fn bytes_length(&self) -> usize {
polynomial_slice_byte_length(&self.permutations)
+ polynomial_slice_byte_length(&self.polys)
polynomial_slice_byte_length(&self.permutations) + polynomial_slice_byte_length(&self.polys)
}
}
7 changes: 5 additions & 2 deletions halo2_proofs/src/plonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
ChallengeY, Error, Expression, ProvingKey,
};
use crate::arithmetic::MULTIEXP_TOTAL_TIME;
use crate::plonk::{start_measure, stop_measure, log_info};
use crate::plonk::{log_info, start_measure, stop_measure};
use crate::poly::FFT_TOTAL_TIME;
use crate::{
arithmetic::{eval_polynomial, CurveAffine},
Expand Down Expand Up @@ -551,7 +551,7 @@
let vanishing = vanishing.construct(params, domain, h_poly, &mut rng, transcript)?;

let x: ChallengeX<_> = transcript.squeeze_challenge_scalar();
let xn = x.pow(&[params.n() as u64, 0, 0, 0]);

Check failure on line 554 in halo2_proofs/src/plonk/prover.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`u64` -> `u64`)

error: casting to the same type is unnecessary (`u64` -> `u64`) --> halo2_proofs/src/plonk/prover.rs:554:22 | 554 | let xn = x.pow(&[params.n() as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^ help: try: `params.n()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check failure on line 554 in halo2_proofs/src/plonk/prover.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/plonk/prover.rs:554:20 | 554 | let xn = x.pow(&[params.n() as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[params.n() as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 554 in halo2_proofs/src/plonk/prover.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`u64` -> `u64`)

warning: casting to the same type is unnecessary (`u64` -> `u64`) --> halo2_proofs/src/plonk/prover.rs:554:22 | 554 | let xn = x.pow(&[params.n() as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^ help: try: `params.n()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 554 in halo2_proofs/src/plonk/prover.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/plonk/prover.rs:554:20 | 554 | let xn = x.pow(&[params.n() as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[params.n() as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 554 in halo2_proofs/src/plonk/prover.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`u64` -> `u64`)

warning: casting to the same type is unnecessary (`u64` -> `u64`) --> halo2_proofs/src/plonk/prover.rs:554:22 | 554 | let xn = x.pow(&[params.n() as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^ help: try: `params.n()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 554 in halo2_proofs/src/plonk/prover.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/plonk/prover.rs:554:20 | 554 | let xn = x.pow(&[params.n() as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[params.n() as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

let start = start_measure("instance eval_polynomial", false);
if P::QUERY_INSTANCE {
Expand Down Expand Up @@ -697,7 +697,10 @@
#[allow(unsafe_code)]
unsafe {
log_info(format!("·FFT: {}s", (FFT_TOTAL_TIME as f32) / 1000000.0));
log_info(format!("·MultiExps: {}s", (MULTIEXP_TOTAL_TIME as f32) / 1000000.0));
log_info(format!(
"·MultiExps: {}s",
(MULTIEXP_TOTAL_TIME as f32) / 1000000.0
));
}

proof
Expand Down
39 changes: 28 additions & 11 deletions halo2_proofs/src/poly/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
{
// Compute the evaluations of t(X) = X^n - 1 in the coset evaluation domain.
// We don't have to compute all of them, because it will repeat.
let orig = F::ZETA.pow_vartime(&[n as u64, 0, 0, 0]);

Check failure on line 102 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`u64` -> `u64`)

error: casting to the same type is unnecessary (`u64` -> `u64`) --> halo2_proofs/src/poly/domain.rs:102:46 | 102 | let orig = F::ZETA.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check failure on line 102 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:102:44 | 102 | let orig = F::ZETA.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[n as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 102 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`u64` -> `u64`)

warning: casting to the same type is unnecessary (`u64` -> `u64`) --> halo2_proofs/src/poly/domain.rs:102:46 | 102 | let orig = F::ZETA.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 102 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:102:44 | 102 | let orig = F::ZETA.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[n as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 102 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`u64` -> `u64`)

warning: casting to the same type is unnecessary (`u64` -> `u64`) --> halo2_proofs/src/poly/domain.rs:102:46 | 102 | let orig = F::ZETA.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 102 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:102:44 | 102 | let orig = F::ZETA.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[n as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
let step = extended_omega.pow_vartime(&[n as u64, 0, 0, 0]);

Check failure on line 103 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`u64` -> `u64`)

error: casting to the same type is unnecessary (`u64` -> `u64`) --> halo2_proofs/src/poly/domain.rs:103:53 | 103 | let step = extended_omega.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check failure on line 103 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:103:51 | 103 | let step = extended_omega.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[n as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 103 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`u64` -> `u64`)

warning: casting to the same type is unnecessary (`u64` -> `u64`) --> halo2_proofs/src/poly/domain.rs:103:53 | 103 | let step = extended_omega.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 103 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:103:51 | 103 | let step = extended_omega.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[n as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 103 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`u64` -> `u64`)

warning: casting to the same type is unnecessary (`u64` -> `u64`) --> halo2_proofs/src/poly/domain.rs:103:53 | 103 | let step = extended_omega.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^ help: try: `n` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 103 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:103:51 | 103 | let step = extended_omega.pow_vartime(&[n as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[n as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
let mut cur = orig;
loop {
t_evaluations.push(cur);
Expand Down Expand Up @@ -192,7 +192,7 @@
&self,
values: Vec<Polynomial<F, LagrangeCoeff>>,
) -> Polynomial<F, ExtendedLagrangeCoeff> {
assert_eq!(values.len(), (self.extended_len() >> self.k) as usize);

Check failure on line 195 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

casting to the same type is unnecessary (`usize` -> `usize`)

error: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/poly/domain.rs:195:34 | 195 | assert_eq!(values.len(), (self.extended_len() >> self.k) as usize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.extended_len() >> self.k)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 195 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/poly/domain.rs:195:34 | 195 | assert_eq!(values.len(), (self.extended_len() >> self.k) as usize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.extended_len() >> self.k)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 195 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/poly/domain.rs:195:34 | 195 | assert_eq!(values.len(), (self.extended_len() >> self.k) as usize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.extended_len() >> self.k)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
assert_eq!(values[0].len(), self.n as usize);

// transpose the values in parallel
Expand Down Expand Up @@ -474,15 +474,21 @@

parallelize(&mut result[0..(self.n << i) as usize], |result, start| {
for (other, current) in result.iter_mut().zip(a_poly[start..].iter()) {
* other += current;
*other += current;
}
});
}
let data = self.get_fft_data(result.len());
best_fft(&mut result, self.extended_omega, self.extended_k, data, false);
best_fft(
&mut result,
self.extended_omega,
self.extended_k,
data,
false,
);
parallelize(&mut result_poly.values, |values, start| {
for (value, other) in values.iter_mut().zip(result[start..].iter()) {
* value += other;
*value += other;
}
});
result_poly
Expand Down Expand Up @@ -541,9 +547,9 @@
///
fn distribute_powers(&self, a: &mut [F], c: F) {
parallelize(a, |a, index| {
let mut c_power = c.pow_vartime(&[index as u64, 0, 0, 0]);

Check failure on line 550 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:550:45 | 550 | let mut c_power = c.pow_vartime(&[index as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[index as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 550 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:550:45 | 550 | let mut c_power = c.pow_vartime(&[index as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[index as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 550 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:550:45 | 550 | let mut c_power = c.pow_vartime(&[index as u64, 0, 0, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[index as u64, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
for a in a {
* a *= c_power;
*a *= c_power;
c_power = c_power * c;
}
});
Expand Down Expand Up @@ -607,11 +613,11 @@
pub fn rotate_omega(&self, value: F, rotation: Rotation) -> F {
let mut point = value;
if rotation.0 >= 0 {
point *= &self.get_omega().pow_vartime(&[rotation.0 as u64]);

Check failure on line 616 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:616:52 | 616 | point *= &self.get_omega().pow_vartime(&[rotation.0 as u64]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[rotation.0 as u64]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 616 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:616:52 | 616 | point *= &self.get_omega().pow_vartime(&[rotation.0 as u64]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[rotation.0 as u64]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 616 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:616:52 | 616 | point *= &self.get_omega().pow_vartime(&[rotation.0 as u64]); | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `[rotation.0 as u64]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
} else {
point *= &self
.get_omega_inv()
.pow_vartime(&[(rotation.0 as i64).unsigned_abs()]);

Check failure on line 620 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (1.56.1)

the borrowed expression implements the required traits

error: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:620:30 | 620 | .pow_vartime(&[(rotation.0 as i64).unsigned_abs()]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[(rotation.0 as i64).unsigned_abs()]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 620 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:620:30 | 620 | .pow_vartime(&[(rotation.0 as i64).unsigned_abs()]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[(rotation.0 as i64).unsigned_abs()]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 620 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:620:30 | 620 | .pow_vartime(&[(rotation.0 as i64).unsigned_abs()]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `[(rotation.0 as i64).unsigned_abs()]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
}
point
}
Expand Down Expand Up @@ -687,7 +693,9 @@
}

/// Get the private field `n`
pub fn get_n(&self) -> u64 { self.n }
pub fn get_n(&self) -> u64 {
self.n
}

/// Get the private `fft_data`
pub fn get_fft_data(&self, l: usize) -> &FFTData<F> {
Expand All @@ -709,10 +717,7 @@
}

#[cfg(test)]
use std::{
env,
time::Instant,
};
use std::{env, time::Instant};

#[test]
fn test_rotate() {
Expand Down Expand Up @@ -766,7 +771,7 @@
let mut l = vec![];
let mut points = vec![];
for i in 0..8 {
points.push(domain.omega.pow(&[i, 0, 0, 0]));

Check warning on line 774 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:774:38 | 774 | points.push(domain.omega.pow(&[i, 0, 0, 0])); | ^^^^^^^^^^^^^ help: change this to: `[i, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
}
for i in 0..8 {
let mut l_i = vec![Scalar::zero(); 8];
Expand All @@ -776,7 +781,7 @@
}

let x = Scalar::random(OsRng);
let xn = x.pow(&[8, 0, 0, 0]);

Check warning on line 784 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> halo2_proofs/src/poly/domain.rs:784:20 | 784 | let xn = x.pow(&[8, 0, 0, 0]); | ^^^^^^^^^^^^^ help: change this to: `[8, 0, 0, 0]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

let evaluations = domain.l_i_range(x, xn, -7..=7);
for i in 0..8 {
Expand Down Expand Up @@ -872,9 +877,15 @@
.collect();
poly_lagrange_vecs.push(transposed_poly);
// poly under extended representation.
poly.resize(domain.extended_len() as usize, Scalar::zero());

Check warning on line 880 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/poly/domain.rs:880:21 | 880 | poly.resize(domain.extended_len() as usize, Scalar::zero()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `domain.extended_len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
let data = domain.get_fft_data(poly.len());
best_fft(&mut poly, domain.extended_omega, domain.extended_k, data, false);
best_fft(
&mut poly,
domain.extended_omega,
domain.extended_k,
data,
false,
);
let poly = {
let mut p = domain.empty_extended();
p.values = poly;
Expand Down Expand Up @@ -924,9 +935,15 @@
.collect();
poly_lagrange_vecs.push(transposed_poly);
// poly under extended representation.
poly.resize(domain.extended_len() as usize, Scalar::zero());

Check warning on line 938 in halo2_proofs/src/poly/domain.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> halo2_proofs/src/poly/domain.rs:938:21 | 938 | poly.resize(domain.extended_len() as usize, Scalar::zero()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `domain.extended_len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
let data = domain.get_fft_data(poly.len());
best_fft(&mut poly, domain.extended_omega, domain.extended_k, data, false);
best_fft(
&mut poly,
domain.extended_omega,
domain.extended_k,
data,
false,
);
let poly = {
let mut p = domain.empty_extended();
p.values = poly;
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.64.0
1.66.0
Loading