diff --git a/tfhe/src/shortint/parameters/test_params.rs b/tfhe/src/shortint/parameters/test_params.rs index 569dda490..ca195604e 100644 --- a/tfhe/src/shortint/parameters/test_params.rs +++ b/tfhe/src/shortint/parameters/test_params.rs @@ -1,7 +1,8 @@ +use super::current_params::meta::cpu::*; use super::current_params::*; use super::{ AtomicPatternParameters, ClassicPBSParameters, CompactPublicKeyEncryptionParameters, - CompressionParameters, KeySwitch32PBSParameters, MultiBitPBSParameters, + CompressionParameters, KeySwitch32PBSParameters, MetaParameters, MultiBitPBSParameters, NoiseSquashingCompressionParameters, NoiseSquashingParameters, ShortintKeySwitchingParameters, }; @@ -227,3 +228,12 @@ pub const TEST_PARAM_NOISE_SQUASHING_COMP_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFOR pub const TEST_PARAM_NOISE_SQUASHING_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128: NoiseSquashingParameters = V1_5_NOISE_SQUASHING_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128; + +pub const TEST_META_PARAM_CPU_2_2_KS_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128: MetaParameters = + V1_5_META_PARAM_CPU_2_2_KS_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128; + +pub const TEST_META_PARAM_CPU_2_2_KS32_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128: MetaParameters = + V1_5_META_PARAM_CPU_2_2_KS32_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128; + +pub const TEST_META_PARAM_CPU_2_2_KS_PBS_GAUSSIAN_2M128: MetaParameters = + V1_5_META_PARAM_CPU_2_2_KS_PBS_GAUSSIAN_2M128; diff --git a/tfhe/src/shortint/server_key/tests/noise_distribution/br_dp_ks_ms.rs b/tfhe/src/shortint/server_key/tests/noise_distribution/br_dp_ks_ms.rs index 6b0a0e717..a980d97a7 100644 --- a/tfhe/src/shortint/server_key/tests/noise_distribution/br_dp_ks_ms.rs +++ b/tfhe/src/shortint/server_key/tests/noise_distribution/br_dp_ks_ms.rs @@ -18,11 +18,11 @@ use crate::shortint::client_key::ClientKey; use crate::shortint::encoding::ShortintEncoding; use crate::shortint::engine::ShortintEngine; use crate::shortint::parameters::test_params::{ - TEST_PARAM_MESSAGE_2_CARRY_2_KS32_PBS_TUNIFORM_2M128, - TEST_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M128, - TEST_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128, + TEST_META_PARAM_CPU_2_2_KS32_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128, + TEST_META_PARAM_CPU_2_2_KS_PBS_GAUSSIAN_2M128, + TEST_META_PARAM_CPU_2_2_KS_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128, }; -use crate::shortint::parameters::{AtomicPatternParameters, CarryModulus}; +use crate::shortint::parameters::{AtomicPatternParameters, CarryModulus, MetaParameters}; use crate::shortint::server_key::tests::noise_distribution::utils::noise_simulation::NoiseSimulationModulus; use crate::shortint::server_key::tests::parameterized_test::create_parameterized_test; use crate::shortint::server_key::ServerKey; @@ -110,11 +110,8 @@ where /// Test function to verify that the noise checking tools match the actual atomic patterns /// implemented in shortint -fn sanity_check_encrypt_br_dp_ks_pbs

(params: P) -where - P: Into, -{ - let params: AtomicPatternParameters = params.into(); +fn sanity_check_encrypt_br_dp_ks_pbs(meta_params: MetaParameters) { + let params = meta_params.compute_parameters; let cks = ClientKey::new(params); let sks = ServerKey::new(&cks); @@ -169,9 +166,9 @@ where } create_parameterized_test!(sanity_check_encrypt_br_dp_ks_pbs { - TEST_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M128, - TEST_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128, - TEST_PARAM_MESSAGE_2_CARRY_2_KS32_PBS_TUNIFORM_2M128, + TEST_META_PARAM_CPU_2_2_KS_PBS_GAUSSIAN_2M128, + TEST_META_PARAM_CPU_2_2_KS_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128, + TEST_META_PARAM_CPU_2_2_KS32_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128, }); fn encrypt_br_dp_ks_any_ms_inner_helper( @@ -393,11 +390,8 @@ fn encrypt_br_dp_ks_any_ms_pfail_helper( after_ms } -fn noise_check_encrypt_br_dp_ks_ms_noise

(params: P) -where - P: Into, -{ - let params: AtomicPatternParameters = params.into(); +fn noise_check_encrypt_br_dp_ks_ms_noise(meta_params: MetaParameters) { + let params = meta_params.compute_parameters; let cks = ClientKey::new(params); let sks = ServerKey::new(&cks); @@ -505,17 +499,14 @@ where } create_parameterized_test!(noise_check_encrypt_br_dp_ks_ms_noise { - TEST_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M128, - TEST_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128, - TEST_PARAM_MESSAGE_2_CARRY_2_KS32_PBS_TUNIFORM_2M128, + TEST_META_PARAM_CPU_2_2_KS_PBS_GAUSSIAN_2M128, + TEST_META_PARAM_CPU_2_2_KS_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128, + TEST_META_PARAM_CPU_2_2_KS32_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128, }); -fn noise_check_encrypt_br_dp_ks_ms_pfail

(params: P) -where - P: Into, -{ +fn noise_check_encrypt_br_dp_ks_ms_pfail(meta_params: MetaParameters) { let (pfail_test_meta, params) = { - let mut ap_params: AtomicPatternParameters = params.into(); + let mut ap_params = meta_params.compute_parameters; let original_message_modulus = ap_params.message_modulus(); let original_carry_modulus = ap_params.carry_modulus(); @@ -574,7 +565,7 @@ where } create_parameterized_test!(noise_check_encrypt_br_dp_ks_ms_pfail { - TEST_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M128, - TEST_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128, - TEST_PARAM_MESSAGE_2_CARRY_2_KS32_PBS_TUNIFORM_2M128, + TEST_META_PARAM_CPU_2_2_KS_PBS_GAUSSIAN_2M128, + TEST_META_PARAM_CPU_2_2_KS_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128, + TEST_META_PARAM_CPU_2_2_KS32_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128, });