Update to non-avx builds

This commit is contained in:
Pro7ech
2025-11-21 15:39:04 +01:00
parent 0fb88c9bd3
commit 3c818d292b
24 changed files with 356 additions and 128 deletions

View File

@@ -5,7 +5,13 @@ use poulpy_core::{
prepared::GLWESecretPrepared,
},
};
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::{ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow, VecZnxFillUniform},
layouts::{Module, ScratchOwned},
@@ -31,7 +37,7 @@ fn main() {
let rank: Rank = Rank(1);
// Instantiate Module (DFT Tables)
let module: Module<FFT64Ref> = Module::<FFT64Ref>::new(n.0 as u64);
let module: Module<BackendImpl> = Module::<BackendImpl>::new(n.0 as u64);
let glwe_ct_infos: GLWELayout = GLWELayout {
n,
@@ -53,7 +59,7 @@ fn main() {
let mut source_xa: Source = Source::new([2u8; 32]);
// Scratch space
let mut scratch: ScratchOwned<FFT64Ref> = ScratchOwned::alloc(
let mut scratch: ScratchOwned<BackendImpl> = ScratchOwned::alloc(
GLWE::encrypt_sk_tmp_bytes(&module, &glwe_ct_infos) | GLWE::decrypt_tmp_bytes(&module, &glwe_ct_infos),
);
@@ -62,7 +68,7 @@ fn main() {
sk.fill_ternary_prob(0.5, &mut source_xs);
// Backend-prepared secret
let mut sk_prepared: GLWESecretPrepared<Vec<u8>, FFT64Ref> = GLWESecretPrepared::alloc(&module, rank);
let mut sk_prepared: GLWESecretPrepared<Vec<u8>, BackendImpl> = GLWESecretPrepared::alloc(&module, rank);
sk_prepared.prepare(&module, &sk);
// Uniform plaintext