mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
Update to non-avx builds
This commit is contained in:
@@ -9,6 +9,9 @@ repository = "https://github.com/phantomzone-org/poulpy"
|
||||
homepage = "https://github.com/phantomzone-org/poulpy"
|
||||
documentation = "https://docs.rs/poulpy"
|
||||
|
||||
[features]
|
||||
enable-avx = []
|
||||
|
||||
[dependencies]
|
||||
poulpy-cpu-avx = {workspace = true}
|
||||
poulpy-cpu-ref = {workspace = true}
|
||||
|
||||
@@ -8,10 +8,12 @@ use poulpy_core::{
|
||||
GLWESecretPreparedFactory, LWE, LWELayout, LWESecret,
|
||||
},
|
||||
};
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use poulpy_cpu_avx::FFT64Avx;
|
||||
#[cfg(not(target_arch = "x86_64"))]
|
||||
use poulpy_cpu_ref::FFT64Ref;
|
||||
|
||||
#[cfg(all(feature = "enable-avx", target_arch = "x86_64"))]
|
||||
pub use poulpy_cpu_avx::FFT64Avx as BackendImpl;
|
||||
|
||||
#[cfg(not(all(feature = "enable-avx", target_arch = "x86_64")))]
|
||||
pub use poulpy_cpu_ref::FFT64Ref as BackendImpl;
|
||||
|
||||
use poulpy_hal::{
|
||||
api::{ModuleN, ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow, VecZnxRotateInplace},
|
||||
@@ -130,7 +132,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
for params in [Params {
|
||||
let params: Params = Params {
|
||||
name: String::from("1-bit"),
|
||||
extension_factor: 1,
|
||||
k_pt: 1,
|
||||
@@ -174,27 +176,22 @@ where
|
||||
rank: 2_u32.into(),
|
||||
},
|
||||
},
|
||||
}] {
|
||||
let id: BenchmarkId = BenchmarkId::from_parameter(params.name.clone());
|
||||
let mut runner = runner::<BE, BRA>(¶ms);
|
||||
group.bench_with_input(id, &(), |b, _| b.iter(&mut runner));
|
||||
}
|
||||
};
|
||||
|
||||
let id: BenchmarkId = BenchmarkId::from_parameter(params.name.clone());
|
||||
let mut runner = runner::<BE, BRA>(¶ms);
|
||||
group.bench_with_input(id, &(), |b, _| b.iter(&mut runner));
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "x86_64"))]
|
||||
fn bench_circuit_bootstrapping_cpu_ref_fft64(c: &mut Criterion) {
|
||||
benc_circuit_bootstrapping::<FFT64Ref, CGGI>(c, "fft64_ref");
|
||||
fn bench_circuit_bootstrapping_fft64(c: &mut Criterion) {
|
||||
#[cfg(all(feature = "enable-avx", target_arch = "x86_64"))]
|
||||
let label = "fft64_avx";
|
||||
#[cfg(not(all(feature = "enable-avx", target_arch = "x86_64")))]
|
||||
let label = "fft64_ref";
|
||||
benc_circuit_bootstrapping::<BackendImpl, CGGI>(c, label);
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn bench_circuit_bootstrapping_cpu_avx_fft64(c: &mut Criterion) {
|
||||
benc_circuit_bootstrapping::<FFT64Avx, CGGI>(c, "fft64_avx");
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
criterion_group!(benches, bench_circuit_bootstrapping_cpu_ref_fft64, bench_circuit_bootstrapping_cpu_avx_fft64,);
|
||||
#[cfg(not(target_arch = "x86_64"))]
|
||||
criterion_group!(benches, bench_circuit_bootstrapping_cpu_ref_fft64,);
|
||||
criterion_group!(benches, bench_circuit_bootstrapping_fft64);
|
||||
criterion_main!(benches);
|
||||
|
||||
@@ -8,10 +8,10 @@ use poulpy_core::{
|
||||
};
|
||||
use std::time::Instant;
|
||||
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
|
||||
#[cfg(all(feature = "enable-avx", target_arch = "x86_64", target_feature = "avx2", target_feature = "fma"))]
|
||||
use poulpy_cpu_avx::FFT64Avx as BackendImpl;
|
||||
|
||||
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
|
||||
#[cfg(not(all(feature = "enable-avx", target_arch = "x86_64", target_feature = "avx2", target_feature = "fma")))]
|
||||
use poulpy_cpu_ref::FFT64Ref as BackendImpl;
|
||||
|
||||
use poulpy_hal::{
|
||||
|
||||
@@ -5,7 +5,7 @@ use poulpy_cpu_avx::FFT64Avx;
|
||||
use crate::bin_fhe::{bdd_arithmetic::tests::test_suite, blind_rotation::CGGI};
|
||||
|
||||
static TEST_CONTEXT_CGGI_FFT64_REF: LazyLock<test_suite::TestContext<CGGI, FFT64Avx>> =
|
||||
LazyLock::new(|| test_suite::TestContext::<CGGI, FFT64Avx>::new());
|
||||
LazyLock::new(test_suite::TestContext::<CGGI, FFT64Avx>::new);
|
||||
|
||||
#[test]
|
||||
fn glwe_blind_retriever() {
|
||||
|
||||
@@ -5,7 +5,7 @@ use poulpy_cpu_ref::FFT64Ref;
|
||||
use crate::bin_fhe::{bdd_arithmetic::tests::test_suite, blind_rotation::CGGI};
|
||||
|
||||
static TEST_CONTEXT_CGGI_FFT64_REF: LazyLock<test_suite::TestContext<CGGI, FFT64Ref>> =
|
||||
LazyLock::new(|| test_suite::TestContext::<CGGI, FFT64Ref>::new());
|
||||
LazyLock::new(test_suite::TestContext::<CGGI, FFT64Ref>::new);
|
||||
|
||||
#[test]
|
||||
fn glwe_blind_retriever() {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
pub mod test_suite;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
|
||||
#[cfg(not(all(feature = "enable-avx", target_arch = "x86_64", target_feature = "avx2", target_feature = "fma")))]
|
||||
mod fft64_ref;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
|
||||
#[cfg(all(feature = "enable-avx", target_arch = "x86_64", target_feature = "avx2", target_feature = "fma"))]
|
||||
mod fft64_avx;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#[cfg(test)]
|
||||
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
|
||||
#[cfg(not(all(feature = "enable-avx", target_arch = "x86_64", target_feature = "avx2", target_feature = "fma")))]
|
||||
mod fft64_ref;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
|
||||
#[cfg(all(feature = "enable-avx", target_arch = "x86_64", target_feature = "avx2", target_feature = "fma"))]
|
||||
mod fft64_avx;
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
pub mod circuit_bootstrapping;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
|
||||
#[cfg(not(all(feature = "enable-avx", target_arch = "x86_64", target_feature = "avx2", target_feature = "fma")))]
|
||||
mod fft64_ref;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
|
||||
#[cfg(all(feature = "enable-avx", target_arch = "x86_64", target_feature = "avx2", target_feature = "fma"))]
|
||||
mod fft64_avx;
|
||||
|
||||
Reference in New Issue
Block a user