From 40b9497dbfdd446374bab558e20f734c2c9f8822 Mon Sep 17 00:00:00 2001 From: Arthur Meyre Date: Mon, 3 Apr 2023 10:22:49 +0200 Subject: [PATCH] chore(core): remove feature gate for multi-bit PBS --- tfhe/Cargo.toml | 3 +- tfhe/src/core_crypto/algorithms/mod.rs | 6 ---- .../commons/generators/encryption.rs | 6 +--- tfhe/src/core_crypto/commons/parameters.rs | 31 +++++++------------ tfhe/src/core_crypto/entities/mod.rs | 2 -- 5 files changed, 14 insertions(+), 34 deletions(-) diff --git a/tfhe/Cargo.toml b/tfhe/Cargo.toml index 77931cbbf..371fcd4bf 100644 --- a/tfhe/Cargo.toml +++ b/tfhe/Cargo.toml @@ -66,8 +66,7 @@ integer = ["shortint"] internal-keycache = ["lazy_static", "fs2", "bincode"] # Experimental section -experimental = ["experimental-multi_bit_pbs"] -experimental-multi_bit_pbs = [] +experimental = [] experimental-force_fft_algo_dif4 = [] # End experimental section diff --git a/tfhe/src/core_crypto/algorithms/mod.rs b/tfhe/src/core_crypto/algorithms/mod.rs index 7621cd616..bb5982120 100644 --- a/tfhe/src/core_crypto/algorithms/mod.rs +++ b/tfhe/src/core_crypto/algorithms/mod.rs @@ -13,11 +13,8 @@ pub mod lwe_encryption; pub mod lwe_keyswitch; pub mod lwe_keyswitch_key_generation; pub mod lwe_linear_algebra; -#[cfg(feature = "experimental-multi_bit_pbs")] pub mod lwe_multi_bit_bootstrap_key_conversion; -#[cfg(feature = "experimental-multi_bit_pbs")] pub mod lwe_multi_bit_bootstrap_key_generation; -#[cfg(feature = "experimental-multi_bit_pbs")] pub mod lwe_multi_bit_programmable_bootstrapping; pub mod lwe_private_functional_packing_keyswitch; pub mod lwe_private_functional_packing_keyswitch_key_generation; @@ -50,11 +47,8 @@ pub use lwe_encryption::*; pub use lwe_keyswitch::*; pub use lwe_keyswitch_key_generation::*; pub use lwe_linear_algebra::*; -#[cfg(feature = "experimental-multi_bit_pbs")] pub use lwe_multi_bit_bootstrap_key_conversion::*; -#[cfg(feature = "experimental-multi_bit_pbs")] pub use lwe_multi_bit_bootstrap_key_generation::*; -#[cfg(feature = "experimental-multi_bit_pbs")] pub use lwe_multi_bit_programmable_bootstrapping::*; pub use lwe_private_functional_packing_keyswitch::*; pub use lwe_private_functional_packing_keyswitch_key_generation::*; diff --git a/tfhe/src/core_crypto/commons/generators/encryption.rs b/tfhe/src/core_crypto/commons/generators/encryption.rs index 4cf799537..39f516ae6 100644 --- a/tfhe/src/core_crypto/commons/generators/encryption.rs +++ b/tfhe/src/core_crypto/commons/generators/encryption.rs @@ -7,11 +7,9 @@ use crate::core_crypto::commons::math::random::{ }; use crate::core_crypto::commons::math::torus::UnsignedTorus; use crate::core_crypto::commons::numeric::UnsignedInteger; -#[cfg(feature = "experimental-multi_bit_pbs")] -use crate::core_crypto::commons::parameters::LweBskGroupingFactor; use crate::core_crypto::commons::parameters::{ DecompositionLevelCount, FunctionalPackingKeyswitchKeyCount, GlweDimension, GlweSize, - LweCiphertextCount, LweDimension, LweSize, PolynomialSize, + LweBskGroupingFactor, LweCiphertextCount, LweDimension, LweSize, PolynomialSize, }; use concrete_csprng::generators::ForkError; use rayon::prelude::*; @@ -75,7 +73,6 @@ impl EncryptionRandomGenerator { } // Forks the generator, when splitting a multi_bit bootstrap key into ggsw ciphertext groups. - #[cfg(feature = "experimental-multi_bit_pbs")] pub(crate) fn fork_multi_bit_bsk_to_ggsw_group( &mut self, lwe_dimension: LweDimension, @@ -265,7 +262,6 @@ impl EncryptionRandomGenerator { } // Forks the generator, when splitting a multi_bit bootstrap key into ggsw ct. - #[cfg(feature = "experimental-multi_bit_pbs")] pub(crate) fn par_fork_multi_bit_bsk_to_ggsw_group( &mut self, lwe_dimension: LweDimension, diff --git a/tfhe/src/core_crypto/commons/parameters.rs b/tfhe/src/core_crypto/commons/parameters.rs index 71bff2a50..922f9a5a8 100644 --- a/tfhe/src/core_crypto/commons/parameters.rs +++ b/tfhe/src/core_crypto/commons/parameters.rs @@ -205,27 +205,20 @@ pub struct FunctionalPackingKeyswitchKeyCount(pub usize); #[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)] pub struct CiphertextModulusLog(pub usize); -#[cfg(feature = "experimental-multi_bit_pbs")] -pub mod experimental_multi_bit_pbs { - use serde::{Deserialize, Serialize}; - /// The number of cpu execution thread to use - #[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)] - pub struct ThreadCount(pub usize); +/// The number of cpu execution thread to use +#[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)] +pub struct ThreadCount(pub usize); - /// The number of key bits grouped together in the multi_bit PBS - #[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)] - pub struct LweBskGroupingFactor(pub usize); +/// The number of key bits grouped together in the multi_bit PBS +#[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)] +pub struct LweBskGroupingFactor(pub usize); - impl LweBskGroupingFactor { - pub fn ggsw_per_multi_bit_element(&self) -> GgswPerLweMultiBitBskElement { - GgswPerLweMultiBitBskElement(1 << self.0) - } +impl LweBskGroupingFactor { + pub fn ggsw_per_multi_bit_element(&self) -> GgswPerLweMultiBitBskElement { + GgswPerLweMultiBitBskElement(1 << self.0) } - - /// The number of GGSW ciphertexts required per multi_bit BSK element - #[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)] - pub struct GgswPerLweMultiBitBskElement(pub usize); } -#[cfg(feature = "experimental-multi_bit_pbs")] -pub use experimental_multi_bit_pbs::*; +/// The number of GGSW ciphertexts required per multi_bit BSK element +#[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)] +pub struct GgswPerLweMultiBitBskElement(pub usize); diff --git a/tfhe/src/core_crypto/entities/mod.rs b/tfhe/src/core_crypto/entities/mod.rs index 11ee168af..57f16938e 100644 --- a/tfhe/src/core_crypto/entities/mod.rs +++ b/tfhe/src/core_crypto/entities/mod.rs @@ -14,7 +14,6 @@ pub mod lwe_bootstrap_key; pub mod lwe_ciphertext; pub mod lwe_ciphertext_list; pub mod lwe_keyswitch_key; -#[cfg(feature = "experimental-multi_bit_pbs")] pub mod lwe_multi_bit_bootstrap_key; pub mod lwe_private_functional_packing_keyswitch_key; pub mod lwe_private_functional_packing_keyswitch_key_list; @@ -50,7 +49,6 @@ pub use lwe_bootstrap_key::*; pub use lwe_ciphertext::*; pub use lwe_ciphertext_list::*; pub use lwe_keyswitch_key::*; -#[cfg(feature = "experimental-multi_bit_pbs")] pub use lwe_multi_bit_bootstrap_key::*; pub use lwe_private_functional_packing_keyswitch_key::*; pub use lwe_private_functional_packing_keyswitch_key_list::*;