mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-08 22:28:01 -05:00
chore: update dp_ks_ms test to take metaparameters
This commit is contained in:
committed by
IceTDrinker
parent
0da331590c
commit
cbac102a0d
@@ -11,11 +11,11 @@ use crate::shortint::client_key::ClientKey;
|
||||
use crate::shortint::encoding::{PaddingBit, 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::parameterized_test::create_parameterized_test;
|
||||
use crate::shortint::server_key::ServerKey;
|
||||
use rayon::prelude::*;
|
||||
@@ -151,11 +151,8 @@ where
|
||||
|
||||
/// Test function to verify that the noise checking tools match the actual atomic patterns
|
||||
/// implemented in shortint
|
||||
fn sanity_check_encrypt_dp_ks_pbs<P>(params: P)
|
||||
where
|
||||
P: Into<AtomicPatternParameters>,
|
||||
{
|
||||
let params: AtomicPatternParameters = params.into();
|
||||
fn sanity_check_encrypt_dp_ks_pbs(meta_params: MetaParameters) {
|
||||
let params = meta_params.compute_parameters;
|
||||
let cks = ClientKey::new(params);
|
||||
let sks = ServerKey::new(&cks);
|
||||
|
||||
@@ -192,9 +189,9 @@ where
|
||||
}
|
||||
|
||||
create_parameterized_test!(sanity_check_encrypt_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_dp_ks_any_ms_inner_helper(
|
||||
@@ -392,11 +389,8 @@ fn encrypt_dp_ks_any_ms_pfail_helper(
|
||||
after_ms
|
||||
}
|
||||
|
||||
fn noise_check_encrypt_dp_ks_ms_noise<P>(params: P)
|
||||
where
|
||||
P: Into<AtomicPatternParameters>,
|
||||
{
|
||||
let params: AtomicPatternParameters = params.into();
|
||||
fn noise_check_encrypt_dp_ks_ms_noise(meta_params: MetaParameters) {
|
||||
let params = meta_params.compute_parameters;
|
||||
let cks = ClientKey::new(params);
|
||||
let sks = ServerKey::new(&cks);
|
||||
|
||||
@@ -485,17 +479,14 @@ where
|
||||
}
|
||||
|
||||
create_parameterized_test!(noise_check_encrypt_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_dp_ks_ms_pfail<P>(params: P)
|
||||
where
|
||||
P: Into<AtomicPatternParameters>,
|
||||
{
|
||||
fn noise_check_encrypt_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();
|
||||
@@ -554,7 +545,7 @@ where
|
||||
}
|
||||
|
||||
create_parameterized_test!(noise_check_encrypt_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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user