Skip to content

Commit

Permalink
fix compatibility for non-x86 build targets
Browse files Browse the repository at this point in the history
  • Loading branch information
cf committed Mar 14, 2024
1 parent 252ebc8 commit 7cb7f12
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion benches/bit_rev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use criterion::Criterion;

#[cfg(target_arch = "x86_64")]
pub fn cpu_bit_rev(c: &mut criterion::Criterion) {
use stwo::core::fields::m31::BaseField;

Expand Down Expand Up @@ -51,4 +50,9 @@ criterion::criterion_group!(
name=avx_bit_rev;
config = Criterion::default().sample_size(10);
targets=avx512_bit_rev, cpu_bit_rev);
#[cfg(not(target_arch = "x86_64"))]
criterion::criterion_group!(
name=avx_bit_rev;
config = Criterion::default().sample_size(10);
targets=cpu_bit_rev);
criterion::criterion_main!(avx_bit_rev);
11 changes: 10 additions & 1 deletion benches/fft.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#![feature(iter_array_chunks)]

use criterion::Criterion;
use stwo::core::backend::avx512::fft::ifft::get_itwiddle_dbls;

#[cfg(target_arch = "x86_64")]
pub fn avx512_ifft(c: &mut criterion::Criterion) {
use stwo::core::backend::avx512::fft::ifft;
use stwo::core::backend::avx512::fft::ifft::get_itwiddle_dbls;
use stwo::core::backend::avx512::BaseFieldVec;
use stwo::core::fields::m31::BaseField;
use stwo::core::poly::circle::CanonicCoset;
Expand Down Expand Up @@ -37,6 +38,14 @@ pub fn avx512_ifft(c: &mut criterion::Criterion) {
});
}



#[cfg(not(target_arch = "x86_64"))]
pub fn avx512_ifft(_: &mut criterion::Criterion) {
// todo: add benchmark for cpu backend?
// ifft code needs to separated out of the CPUBackend's implementation of PolyOps.interpolate
return;
}
criterion::criterion_group!(
name=avx_ifft;
config = Criterion::default().sample_size(10);
Expand Down
1 change: 1 addition & 0 deletions src/core/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use super::fields::qm31::SecureField;
use super::fields::FieldOps;
use super::poly::circle::PolyOps;

#[cfg(target_arch = "x86_64")]
pub mod avx512;
pub mod cpu;

Expand Down
1 change: 0 additions & 1 deletion src/core/fields/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::ops::{Mul, MulAssign, Neg};

use num_traits::{NumAssign, NumAssignOps, NumOps, One};

#[cfg(target_arch = "x86_64")]
pub mod cm31;
pub mod m31;
pub mod qm31;
Expand Down

0 comments on commit 7cb7f12

Please sign in to comment.