Skip to content

Commit

Permalink
chorre(ci): fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
IceTDrinker committed Jul 18, 2024
1 parent 47e02d3 commit aeb75d4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 33 deletions.
34 changes: 11 additions & 23 deletions src/ordered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ fn measure_n_runs(
stack: PodStack,
) -> Duration {
let n = buf.len();
let (mut scratch, _) = stack.make_aligned_raw::<c64>(n, CACHELINE_ALIGN);
let (scratch, _) = stack.make_aligned_raw::<c64>(n, CACHELINE_ALIGN);
let [fwd, _] = get_fn_ptr(algo, n);

use std::time::Instant;
let now = Instant::now();

for _ in 0..n_runs {
fwd(buf, &mut scratch, twiddles, twiddles_init);
fwd(buf, scratch, twiddles, twiddles_init);
}

now.elapsed()
Expand Down Expand Up @@ -112,7 +112,7 @@ pub(crate) fn measure_fastest(
let (twiddles, stack) = stack.make_aligned_with::<c64, _>(2 * n, align, f);
let twiddles_init = &twiddles[..n];
let twiddles = &twiddles[n..];
let (mut buf, mut stack) = stack.make_aligned_with::<c64, _>(n, align, f);
let (buf, mut stack) = stack.make_aligned_with::<c64, _>(n, align, f);

{
// initialize scratch to load it in the cpu cache
Expand Down Expand Up @@ -142,14 +142,8 @@ pub(crate) fn measure_fastest(
let mut n_runs: u128 = 1;

loop {
let duration = measure_n_runs(
n_runs,
algo,
&mut buf,
twiddles_init,
twiddles,
stack.rb_mut(),
);
let duration =
measure_n_runs(n_runs, algo, buf, twiddles_init, twiddles, stack.rb_mut());

if duration < MIN_DURATION {
n_runs *= 2;
Expand All @@ -164,14 +158,8 @@ pub(crate) fn measure_fastest(
*avg = if n_runs <= init_n_runs {
approx_duration
} else {
let duration = measure_n_runs(
n_runs,
algo,
&mut buf,
twiddles_init,
twiddles,
stack.rb_mut(),
);
let duration =
measure_n_runs(n_runs, algo, buf, twiddles_init, twiddles, stack.rb_mut());
duration_div_f64(duration, n_runs as f64)
};
}
Expand Down Expand Up @@ -346,9 +334,9 @@ impl Plan {
/// ```
pub fn fwd(&self, buf: &mut [c64], stack: PodStack) {
let n = self.fft_size();
let (mut scratch, _) = stack.make_aligned_raw::<c64>(n, CACHELINE_ALIGN);
let (scratch, _) = stack.make_aligned_raw::<c64>(n, CACHELINE_ALIGN);
let (w_init, w) = split_2(&self.twiddles);
(self.fwd)(buf, &mut scratch, w_init, w)
(self.fwd)(buf, scratch, w_init, w)
}

/// Performs an inverse FFT in place, using the provided stack as scratch space.
Expand All @@ -372,9 +360,9 @@ impl Plan {
/// ```
pub fn inv(&self, buf: &mut [c64], stack: PodStack) {
let n = self.fft_size();
let (mut scratch, _) = stack.make_aligned_raw::<c64>(n, CACHELINE_ALIGN);
let (scratch, _) = stack.make_aligned_raw::<c64>(n, CACHELINE_ALIGN);
let (w_init, w) = split_2(&self.twiddles_inv);
(self.inv)(buf, &mut scratch, w_init, w)
(self.inv)(buf, scratch, w_init, w)
}
}

Expand Down
18 changes: 9 additions & 9 deletions src/unordered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,8 @@ fn measure_fastest(
let (w, stack) = stack
.rb_mut()
.make_aligned_with::<c64, _>(n + base_n, align, f);
let (mut scratch, stack) = stack.make_aligned_with::<c64, _>(base_n, align, f);
let (mut z, _) = stack.make_aligned_with::<c64, _>(n, align, f);
let (scratch, stack) = stack.make_aligned_with::<c64, _>(base_n, align, f);
let (z, _) = stack.make_aligned_with::<c64, _>(n, align, f);

let n_runs = min_bench_duration_per_algo.as_secs_f64()
/ (duration.as_secs_f64() * (n / base_n) as f64);
Expand All @@ -614,11 +614,11 @@ fn measure_fastest(
let now = Instant::now();
for _ in 0..n_runs {
fwd_depth(
&mut z,
&w,
z,
w,
base_fn,
base_n,
&mut scratch,
scratch,
fwd_process_x2,
fwd_process_x4,
fwd_process_x8,
Expand Down Expand Up @@ -824,13 +824,13 @@ impl Plan {
/// ```
pub fn fwd(&self, buf: &mut [c64], stack: PodStack) {
assert_eq!(self.fft_size(), buf.len());
let (mut scratch, _) = stack.make_aligned_raw::<c64>(self.algo().1, CACHELINE_ALIGN);
let (scratch, _) = stack.make_aligned_raw::<c64>(self.algo().1, CACHELINE_ALIGN);
fwd_depth(
buf,
&self.twiddles,
self.base_fn_fwd,
self.base_n,
&mut scratch,
scratch,
self.fwd_process_x2,
self.fwd_process_x4,
self.fwd_process_x8,
Expand Down Expand Up @@ -925,13 +925,13 @@ impl Plan {
/// ```
pub fn inv(&self, buf: &mut [c64], stack: PodStack) {
assert_eq!(self.fft_size(), buf.len());
let (mut scratch, _) = stack.make_aligned_raw::<c64>(self.algo().1, CACHELINE_ALIGN);
let (scratch, _) = stack.make_aligned_raw::<c64>(self.algo().1, CACHELINE_ALIGN);
inv_depth(
buf,
&self.twiddles_inv,
self.base_fn_inv,
self.base_n,
&mut scratch,
scratch,
self.inv_process_x2,
self.inv_process_x4,
self.inv_process_x8,
Expand Down
2 changes: 1 addition & 1 deletion toolchain.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2024-02-08
nightly-2024-07-18

0 comments on commit aeb75d4

Please sign in to comment.