chore(cpu): nightly fmt

This commit is contained in:
Mayeul@Zama
2023-03-15 10:14:12 +01:00
committed by Quentin Bourgerie
parent ea79b2108b
commit 4c93b83807
19 changed files with 94 additions and 115 deletions

View File

@@ -1,14 +1,11 @@
use crate::{
c_api::types::{Parallelism, ScratchStatus},
implementation::{fft::Fft, types::*},
};
use crate::c_api::types::{Parallelism, ScratchStatus};
use crate::implementation::fft::Fft;
use crate::implementation::types::*;
use core::slice;
use dyn_stack::DynStack;
use super::{
types::{Csprng, CsprngVtable},
utils::nounwind,
};
use super::types::{Csprng, CsprngVtable};
use super::utils::nounwind;
#[no_mangle]
pub unsafe extern "C" fn concrete_cpu_init_lwe_bootstrap_key_u64(

View File

@@ -1,10 +1,8 @@
use std::io::Read;
use super::types::{Csprng, CsprngVtable, Uint128};
use concrete_csprng::{
generators::{RandomGenerator, SoftwareRandomGenerator},
seeders::Seed,
};
use concrete_csprng::generators::{RandomGenerator, SoftwareRandomGenerator};
use concrete_csprng::seeders::Seed;
use libc::c_int;
type Generator = SoftwareRandomGenerator;

View File

@@ -1,7 +1,5 @@
use super::{
types::{Csprng, CsprngVtable},
utils::nounwind,
};
use super::types::{Csprng, CsprngVtable};
use super::utils::nounwind;
use crate::implementation::types::*;
#[no_mangle]

View File

@@ -1,7 +1,5 @@
use super::{
types::{Csprng, CsprngVtable},
utils::nounwind,
};
use super::types::{Csprng, CsprngVtable};
use super::utils::nounwind;
use crate::implementation::types::{
CsprngMut, DecompParams, GgswCiphertext, GlweCiphertext, GlweParams, GlweSecretKey,
LweCiphertext, LweSecretKey,

View File

@@ -44,7 +44,8 @@ pub enum Parallelism {
#[cfg(test)]
pub mod tests {
use super::*;
use crate::{c_api::csprng::CONCRETE_CSPRNG_VTABLE, implementation::types::CsprngMut};
use crate::c_api::csprng::CONCRETE_CSPRNG_VTABLE;
use crate::implementation::types::CsprngMut;
use concrete_csprng::generators::SoftwareRandomGenerator;
pub fn to_generic(a: &mut SoftwareRandomGenerator) -> CsprngMut<'_, '_> {

View File

@@ -1,17 +1,13 @@
use crate::{
c_api::{types::*, utils::nounwind},
implementation::{
fft::Fft,
types::{
ciphertext_list::LweCiphertextList,
packing_keyswitch_key_list::PackingKeyswitchKeyList, polynomial_list::PolynomialList,
*,
},
wop::{
circuit_bootstrap_boolean_vertical_packing,
circuit_bootstrap_boolean_vertical_packing_scratch, extract_bits, extract_bits_scratch,
},
},
use crate::c_api::types::*;
use crate::c_api::utils::nounwind;
use crate::implementation::fft::Fft;
use crate::implementation::types::ciphertext_list::LweCiphertextList;
use crate::implementation::types::packing_keyswitch_key_list::PackingKeyswitchKeyList;
use crate::implementation::types::polynomial_list::PolynomialList;
use crate::implementation::types::*;
use crate::implementation::wop::{
circuit_bootstrap_boolean_vertical_packing, circuit_bootstrap_boolean_vertical_packing_scratch,
extract_bits, extract_bits_scratch,
};
use core::slice;
use dyn_stack::DynStack;

View File

@@ -2,13 +2,13 @@ use crate::implementation::cmux::cmux_scratch;
use aligned_vec::CACHELINE_ALIGN;
use dyn_stack::*;
use super::{
cmux::cmux,
fft::FftView,
polynomial::{update_with_wrapping_monic_monomial_mul, update_with_wrapping_unit_monomial_div},
types::*,
zip_eq, Split,
use super::cmux::cmux;
use super::fft::FftView;
use super::polynomial::{
update_with_wrapping_monic_monomial_mul, update_with_wrapping_unit_monomial_div,
};
use super::types::*;
use super::{zip_eq, Split};
impl<'a> BootstrapKey<&'a [f64]> {
pub fn blind_rotate_scratch(
@@ -136,17 +136,11 @@ pub fn pbs_modulus_switch(
mod tests {
use std::mem::MaybeUninit;
use crate::{
c_api::types::tests::to_generic,
implementation::{
fft::{Fft, FftView},
types::*,
},
};
use concrete_csprng::{
generators::{RandomGenerator, SoftwareRandomGenerator},
seeders::Seed,
};
use crate::c_api::types::tests::to_generic;
use crate::implementation::fft::{Fft, FftView};
use crate::implementation::types::*;
use concrete_csprng::generators::{RandomGenerator, SoftwareRandomGenerator};
use concrete_csprng::seeders::Seed;
use dyn_stack::DynStack;
struct KeySet {

View File

@@ -1,4 +1,5 @@
use super::{types::*, Split};
use super::types::*;
use super::Split;
impl<'a> GlweCiphertext<&'a [u64]> {
pub fn fill_lwe_with_sample_extraction(self, lwe: LweCiphertext<&mut [u64]>, n_th: usize) {

View File

@@ -1,4 +1,7 @@
use super::{external_product::external_product, fft::FftView, types::*, zip_eq};
use super::external_product::external_product;
use super::fft::FftView;
use super::types::*;
use super::zip_eq;
use crate::implementation::external_product::external_product_scratch;
use dyn_stack::{DynStack, SizeOverflow, StackReq};

View File

@@ -1,9 +1,7 @@
use crate::implementation::{assume_init_mut, from_torus};
use super::{
as_mut_uninit,
fft::{FftView, Twisties},
};
use super::as_mut_uninit;
use super::fft::{FftView, Twisties};
use bytemuck::cast_slice_mut;
use concrete_fft::c64;
use core::mem::MaybeUninit;

View File

@@ -1,4 +1,5 @@
use super::{decomposition::SignedDecompositionIter, types::DecompParams};
use super::decomposition::SignedDecompositionIter;
use super::types::DecompParams;
#[derive(Copy, Clone, Debug)]
#[readonly::make]

View File

@@ -1,4 +1,5 @@
use core::{iter::Map, slice::IterMut};
use core::iter::Map;
use core::slice::IterMut;
use dyn_stack::{DynArray, DynStack};
use super::types::DecompParams;

View File

@@ -1,16 +1,11 @@
use super::{
decomposition::DecompositionTerm,
fpks::LweKeyBitDecomposition,
from_torus,
polynomial::{update_with_wrapping_add_mul, update_with_wrapping_sub_mul},
types::*,
zip_eq,
};
use super::decomposition::DecompositionTerm;
use super::fpks::LweKeyBitDecomposition;
use super::polynomial::{update_with_wrapping_add_mul, update_with_wrapping_sub_mul};
use super::types::*;
use super::{from_torus, zip_eq};
use core::slice;
use rayon::{
prelude::{IndexedParallelIterator, ParallelIterator},
slice::ParallelSliceMut,
};
use rayon::prelude::{IndexedParallelIterator, ParallelIterator};
use rayon::slice::ParallelSliceMut;
use std::cmp::Ordering;
pub fn mask_bytes_per_coef() -> usize {
@@ -655,14 +650,10 @@ impl LweSecretKey<&[u64]> {
#[cfg(test)]
mod tests {
use crate::{
c_api::types::tests::to_generic,
implementation::types::{CsprngMut, LweCiphertext, LweSecretKey},
};
use concrete_csprng::{
generators::{RandomGenerator, SoftwareRandomGenerator},
seeders::Seed,
};
use crate::c_api::types::tests::to_generic;
use crate::implementation::types::{CsprngMut, LweCiphertext, LweSecretKey};
use concrete_csprng::generators::{RandomGenerator, SoftwareRandomGenerator};
use concrete_csprng::seeders::Seed;
fn encrypt_decrypt(
mut csprng: CsprngMut,

View File

@@ -5,12 +5,13 @@ use concrete_fft::c64;
use dyn_stack::{DynArray, DynStack, ReborrowMut, SizeOverflow, StackReq};
use pulp::{as_arrays, as_arrays_mut};
use crate::implementation::{
assume_init_mut, decomposer::SignedDecomposer,
decomposition::TensorSignedDecompositionLendingIter, Split,
};
use crate::implementation::decomposer::SignedDecomposer;
use crate::implementation::decomposition::TensorSignedDecompositionLendingIter;
use crate::implementation::{assume_init_mut, Split};
use super::{as_mut_uninit, fft::FftView, types::*, zip_eq};
use super::fft::FftView;
use super::types::*;
use super::{as_mut_uninit, zip_eq};
impl GgswCiphertext<&mut [f64]> {
pub fn fill_with_forward_fourier(

View File

@@ -82,10 +82,9 @@ mod std_only {
use concrete_fft::unordered::Method;
use core::time::Duration;
use once_cell::sync::OnceCell;
use std::{
collections::{hash_map::Entry, HashMap},
sync::RwLock,
};
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::sync::RwLock;
type PlanMap = RwLock<HashMap<usize, Arc<OnceCell<Arc<(Twisties<ABox<[f64]>>, Plan)>>>>>;
static PLANS: OnceCell<PlanMap> = OnceCell::new();
@@ -132,7 +131,8 @@ mod std_only {
#[cfg(not(feature = "std"))]
mod no_std {
use concrete_fft::{ordered::FftAlgo, unordered::Method};
use concrete_fft::ordered::FftAlgo;
use concrete_fft::unordered::Method;
use super::*;

View File

@@ -1,9 +1,7 @@
use super::{
decomposer::SignedDecomposer,
types::{GlweCiphertext, GlweParams, LweCiphertext, PackingKeyswitchKey},
wop::GlweCiphertextList,
zip_eq, Container,
};
use super::decomposer::SignedDecomposer;
use super::types::{GlweCiphertext, GlweParams, LweCiphertext, PackingKeyswitchKey};
use super::wop::GlweCiphertextList;
use super::{zip_eq, Container};
impl PackingKeyswitchKey<&[u64]> {
pub fn private_functional_keyswitch_ciphertext(

View File

@@ -1,4 +1,6 @@
use super::{decomposer::SignedDecomposer, types::*, zip_eq};
use super::decomposer::SignedDecomposer;
use super::types::*;
use super::zip_eq;
impl LweKeyswitchKey<&[u64]> {
pub fn keyswitch_ciphertext(
@@ -40,11 +42,10 @@ impl LweKeyswitchKey<&[u64]> {
#[cfg(test)]
mod tests {
use crate::{c_api::types::tests::to_generic, implementation::types::*};
use concrete_csprng::{
generators::{RandomGenerator, SoftwareRandomGenerator},
seeders::Seed,
};
use crate::c_api::types::tests::to_generic;
use crate::implementation::types::*;
use concrete_csprng::generators::{RandomGenerator, SoftwareRandomGenerator};
use concrete_csprng::seeders::Seed;
struct KeySet {
in_dim: usize,

View File

@@ -1,5 +1,6 @@
use super::{DecompParams, GgswCiphertext, GlweParams};
use crate::implementation::{fft::FftView, zip_eq, Container, ContainerMut, Split};
use crate::implementation::fft::FftView;
use crate::implementation::{zip_eq, Container, ContainerMut, Split};
use dyn_stack::{DynStack, ReborrowMut};
#[cfg(feature = "parallel")]
use rayon::{

View File

@@ -5,20 +5,21 @@ use std::cmp::Ordering;
use aligned_vec::CACHELINE_ALIGN;
use dyn_stack::{DynStack, ReborrowMut, SizeOverflow, StackReq};
use crate::implementation::{external_product::external_product, types::GlweCiphertext, zip_eq};
use crate::implementation::external_product::external_product;
use crate::implementation::types::GlweCiphertext;
use crate::implementation::zip_eq;
use super::{
cmux::{cmux, cmux_scratch},
external_product::external_product_scratch,
fft::FftView,
polynomial::update_with_wrapping_unit_monomial_div,
types::{
ciphertext_list::LweCiphertextList, packing_keyswitch_key_list::PackingKeyswitchKeyList,
polynomial_list::PolynomialList, BootstrapKey, DecompParams, GgswCiphertext, GlweParams,
LweCiphertext, LweKeyswitchKey,
},
Container, Split,
use super::cmux::{cmux, cmux_scratch};
use super::external_product::external_product_scratch;
use super::fft::FftView;
use super::polynomial::update_with_wrapping_unit_monomial_div;
use super::types::ciphertext_list::LweCiphertextList;
use super::types::packing_keyswitch_key_list::PackingKeyswitchKeyList;
use super::types::polynomial_list::PolynomialList;
use super::types::{
BootstrapKey, DecompParams, GgswCiphertext, GlweParams, LweCiphertext, LweKeyswitchKey,
};
use super::{Container, Split};
pub fn extract_bits_scratch(
lwe_dimension: usize,