Skip to content

Commit

Permalink
chore(gpu): add tests for N=8192 multi-bit PBS
Browse files Browse the repository at this point in the history
  • Loading branch information
agnesLeroy authored and pdroalves committed Apr 12, 2024
1 parent 9f36cf7 commit 7033762
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,13 @@ fn std_lwe_encrypt_multi_bit_deterministic_pbs_decrypt_custom_mod<Scalar>(
#[test]
pub fn test_lwe_encrypt_multi_bit_pbs_decrypt_factor_2_thread_5_native_mod() {
lwe_encrypt_multi_bit_pbs_decrypt_custom_mod::<u64>(MULTI_BIT_2_2_2_PARAMS);
lwe_encrypt_multi_bit_pbs_decrypt_custom_mod::<u64>(MULTI_BIT_3_3_2_PARAMS);
}

#[test]
pub fn test_lwe_encrypt_multi_bit_pbs_decrypt_factor_3_thread_12_native_mod() {
lwe_encrypt_multi_bit_pbs_decrypt_custom_mod::<u64>(MULTI_BIT_2_2_3_PARAMS);
lwe_encrypt_multi_bit_pbs_decrypt_custom_mod::<u64>(MULTI_BIT_3_3_3_PARAMS);
}

#[test]
Expand Down
36 changes: 36 additions & 0 deletions tfhe/src/core_crypto/algorithms/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,24 @@ pub const MULTI_BIT_2_2_2_PARAMS: MultiBitTestParams<u64> = MultiBitTestParams {
thread_count: ThreadCount(5),
};

pub const MULTI_BIT_3_3_2_PARAMS: MultiBitTestParams<u64> = MultiBitTestParams {
input_lwe_dimension: LweDimension(922),
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev(
0.0000003272369292345697,
)),
decomp_base_log: DecompositionBaseLog(14),
decomp_level_count: DecompositionLevelCount(2),
glwe_dimension: GlweDimension(1),
polynomial_size: PolynomialSize(8192),
glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev(
0.0000000000000000002168404344971009,
)),
message_modulus_log: CiphertextModulusLog(6),
ciphertext_modulus: CiphertextModulus::new_native(),
grouping_factor: LweBskGroupingFactor(2),
thread_count: ThreadCount(5),
};

pub const MULTI_BIT_2_2_2_CUSTOM_MOD_PARAMS: MultiBitTestParams<u64> = MultiBitTestParams {
input_lwe_dimension: LweDimension(818),
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev(
Expand Down Expand Up @@ -232,6 +250,24 @@ pub const MULTI_BIT_2_2_3_PARAMS: MultiBitTestParams<u64> = MultiBitTestParams {
thread_count: ThreadCount(12),
};

pub const MULTI_BIT_3_3_3_PARAMS: MultiBitTestParams<u64> = MultiBitTestParams {
input_lwe_dimension: LweDimension(972),
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev(
0.00000013016688349592805,
)),
decomp_base_log: DecompositionBaseLog(14),
decomp_level_count: DecompositionLevelCount(2),
glwe_dimension: GlweDimension(1),
polynomial_size: PolynomialSize(8192),
glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev(
0.0000000000000000002168404344971009,
)),
message_modulus_log: CiphertextModulusLog(6),
ciphertext_modulus: CiphertextModulus::new_native(),
grouping_factor: LweBskGroupingFactor(3),
thread_count: ThreadCount(5),
};

pub const MULTI_BIT_2_2_3_CUSTOM_MOD_PARAMS: MultiBitTestParams<u64> = MultiBitTestParams {
input_lwe_dimension: LweDimension(888),
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev(
Expand Down
4 changes: 3 additions & 1 deletion tfhe/src/core_crypto/gpu/algorithms/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ macro_rules! create_gpu_multi_bit_parametrized_test{
create_gpu_multi_bit_parametrized_test!($name
{
MULTI_BIT_2_2_2_PARAMS,
MULTI_BIT_2_2_3_PARAMS
MULTI_BIT_2_2_3_PARAMS,
MULTI_BIT_3_3_2_PARAMS,
MULTI_BIT_3_3_3_PARAMS
});
};
}
Expand Down

0 comments on commit 7033762

Please sign in to comment.