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

Conditional Compilation #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 2 additions & 0 deletions src/intrinsic/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[cfg(target_arch = "x86_64")]
pub mod intrinfft;
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod freq_scale;
pub mod intrinfft;
#[cfg(target_arch = "x86_64")]
pub mod intrinsic;
pub mod pfft;
pub mod rfft;
pub mod sfft;
Expand Down
44 changes: 25 additions & 19 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
mod intrinfft;
mod pfft;
mod rfft;
mod sfft;
mod splitfft;
mod utils;
mod splitfft;
mod intrinsic;

#[cfg(target_arch = "x86_64")]
use intrinsic::intrinfft;

use num_complex::Complex;
use rustfft::FftPlanner;
Expand Down Expand Up @@ -63,23 +66,26 @@ fn main() {
);
utils::dump_result("rayon", &mut result, output_filename).unwrap();

let mut result = bench_fft(
intrinfft::simd_fft,
intrinfft::simd_ifft,
benchname,
"SIMD",
bench_niter,
);
utils::dump_result("simd", &mut result, output_filename).unwrap();

let mut result = bench_fft(
intrinfft::rayon_simd_fft,
intrinfft::rayon_simd_ifft,
benchname,
"Rayon SIMD",
bench_niter,
);
utils::dump_result("rayon simd", &mut result, output_filename).unwrap();
#[cfg(target_arch = "x86_64")]
{
let mut result = bench_fft(
intrinfft::simd_fft,
intrinfft::simd_ifft,
benchname,
"SIMD",
bench_niter,
);
utils::dump_result("simd", &mut result, output_filename).unwrap();

let mut result = bench_fft(
intrinfft::rayon_simd_fft,
intrinfft::rayon_simd_ifft,
benchname,
"Rayon SIMD",
bench_niter,
);
utils::dump_result("rayon simd", &mut result, output_filename).unwrap();
}

let mut result = bench_fft(
splitfft::fft,
Expand Down
5 changes: 4 additions & 1 deletion tests/accuracy.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use ffrust::freq_scale;
use ffrust::intrinfft;
#[cfg(target_arch = "x86_64")]
use ffrust::intrinsic::intrinfft;
use ffrust::pfft;
use ffrust::rfft;
use ffrust::sfft;
Expand Down Expand Up @@ -53,11 +54,13 @@ fn test_rayon_fft() {
run_fft_ifft(pfft::rayon_fft, pfft::rayon_ifft, "rayon_recon.wav");
}

#[cfg(target_arch = "x86_64")]
#[test]
fn test_simd_fft() {
run_fft_ifft(intrinfft::simd_fft, intrinfft::simd_ifft, "simd_recon.wav");
}

#[cfg(target_arch = "x86_64")]
#[test]
fn test_rayon_simd_fft() {
run_fft_ifft(
Expand Down