From 0979879f002aead76a930ec247d134db3a67a51a Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 5 Nov 2024 09:45:58 -0300 Subject: [PATCH] chore(gpu): update pbs test parameters to match tfhe-rs' integer tests --- .../tests/test_classical_pbs.cpp | 146 +----------------- .../tests/test_multibit_pbs.cpp | 86 ++++------- 2 files changed, 37 insertions(+), 195 deletions(-) diff --git a/backends/tfhe-cuda-backend/cuda/tests_and_benchmarks/tests/test_classical_pbs.cpp b/backends/tfhe-cuda-backend/cuda/tests_and_benchmarks/tests/test_classical_pbs.cpp index 5ddb1430f2..11e4dd3122 100644 --- a/backends/tfhe-cuda-backend/cuda/tests_and_benchmarks/tests/test_classical_pbs.cpp +++ b/backends/tfhe-cuda-backend/cuda/tests_and_benchmarks/tests/test_classical_pbs.cpp @@ -233,147 +233,15 @@ ::testing::internal::ParamGenerator // n, k, N, lwe_variance, glwe_variance, pbs_base_log, pbs_level, // message_modulus, carry_modulus, number_of_inputs, repetitions, // samples - // BOOLEAN_DEFAULT_PARAMETERS + // PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64 (ClassicalProgrammableBootstrapTestParams){ - 777, 3, 512, new_gaussian_from_std_dev(sqrt(1.3880686109937e-11)), - new_gaussian_from_std_dev(sqrt(1.1919984450689246e-23)), 18, 1, 2, - 2, 2, 2, 40}, - // BOOLEAN_TFHE_LIB_PARAMETERS + 887, 1, 2048, new_t_uniform(46), new_t_uniform(17), 22, 1, 4, 4, + 100, 1, 1}, + // PARAM_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64 (ClassicalProgrammableBootstrapTestParams){ - 830, 2, 1024, - new_gaussian_from_std_dev(sqrt(1.994564705573226e-12)), - new_gaussian_from_std_dev(sqrt(8.645717832544903e-32)), 23, 1, 2, 2, - 2, 2, 40}, - // SHORTINT_PARAM_MESSAGE_1_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 678, 5, 256, new_gaussian_from_std_dev(sqrt(5.203010004723453e-10)), - new_gaussian_from_std_dev(sqrt(1.3996292326131784e-19)), 15, 1, 2, - 1, 2, 2, 40}, - // SHORTINT_PARAM_MESSAGE_1_CARRY_1 - (ClassicalProgrammableBootstrapTestParams){ - 684, 3, 512, new_gaussian_from_std_dev(sqrt(4.177054989616946e-10)), - new_gaussian_from_std_dev(sqrt(1.1919984450689246e-23)), 18, 1, 2, - 2, 2, 2, 40}, - // SHORTINT_PARAM_MESSAGE_2_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 656, 2, 512, - new_gaussian_from_std_dev(sqrt(1.1641198952558192e-09)), - new_gaussian_from_std_dev(sqrt(1.6434266310406663e-15)), 8, 2, 4, 1, - 2, 2, 40}, - // SHORTINT_PARAM_MESSAGE_1_CARRY_2 - // SHORTINT_PARAM_MESSAGE_2_CARRY_1 - // SHORTINT_PARAM_MESSAGE_3_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 742, 2, 1024, - new_gaussian_from_std_dev(sqrt(4.998277131225527e-11)), - new_gaussian_from_std_dev(sqrt(8.645717832544903e-32)), 23, 1, 2, 4, - 2, 2, 40}, - // SHORTINT_PARAM_MESSAGE_1_CARRY_3 - // SHORTINT_PARAM_MESSAGE_2_CARRY_2 - // SHORTINT_PARAM_MESSAGE_3_CARRY_1 - // SHORTINT_PARAM_MESSAGE_4_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 745, 1, 2048, - new_gaussian_from_std_dev(sqrt(4.478453795193731e-11)), - new_gaussian_from_std_dev(sqrt(8.645717832544903e-32)), 23, 1, 2, 8, - 2, 2, 40}, - // SHORTINT_PARAM_MESSAGE_5_CARRY_0 - // SHORTINT_PARAM_MESSAGE_3_CARRY_2 - (ClassicalProgrammableBootstrapTestParams){ - 807, 1, 4096, - new_gaussian_from_std_dev(sqrt(4.629015039118823e-12)), - new_gaussian_from_std_dev(sqrt(4.70197740328915e-38)), 22, 1, 32, 1, - 2, 1, 40}, - // SHORTINT_PARAM_MESSAGE_6_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 915, 1, 8192, - new_gaussian_from_std_dev(sqrt(8.883173851180252e-14)), - new_gaussian_from_std_dev(sqrt(4.70197740328915e-38)), 22, 1, 64, 1, - 2, 1, 2}, - // SHORTINT_PARAM_MESSAGE_3_CARRY_3 - (ClassicalProgrammableBootstrapTestParams){ - 864, 1, 8192, - new_gaussian_from_std_dev(sqrt(1.5843564961097632e-15)), - new_gaussian_from_std_dev(sqrt(4.70197740328915e-38)), 15, 2, 8, 8, - 2, 1, 2}, - // SHORTINT_PARAM_MESSAGE_4_CARRY_3 - // SHORTINT_PARAM_MESSAGE_7_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 930, 1, 16384, - new_gaussian_from_std_dev(sqrt(5.129877458078009e-14)), - new_gaussian_from_std_dev(sqrt(4.70197740328915e-38)), 15, 2, 128, - 1, 2, 1, 1}, - - // BOOLEAN_DEFAULT_PARAMETERS - (ClassicalProgrammableBootstrapTestParams){ - 777, 3, 512, new_gaussian_from_std_dev(sqrt(1.3880686109937e-11)), - new_gaussian_from_std_dev(sqrt(1.1919984450689246e-23)), 18, 1, 2, - 2, 100, 2, 40}, - // BOOLEAN_TFHE_LIB_PARAMETERS - (ClassicalProgrammableBootstrapTestParams){ - 830, 2, 1024, - new_gaussian_from_std_dev(sqrt(1.994564705573226e-12)), - new_gaussian_from_std_dev(sqrt(8.645717832544903e-32)), 23, 1, 2, 2, - 100, 2, 40}, - // SHORTINT_PARAM_MESSAGE_1_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 678, 5, 256, new_gaussian_from_std_dev(sqrt(5.203010004723453e-10)), - new_gaussian_from_std_dev(sqrt(1.3996292326131784e-19)), 15, 1, 2, - 1, 100, 2, 40}, - // SHORTINT_PARAM_MESSAGE_1_CARRY_1 - (ClassicalProgrammableBootstrapTestParams){ - 684, 3, 512, new_gaussian_from_std_dev(sqrt(4.177054989616946e-10)), - new_gaussian_from_std_dev(sqrt(1.1919984450689246e-23)), 18, 1, 2, - 2, 100, 2, 40}, - // SHORTINT_PARAM_MESSAGE_2_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 656, 2, 512, - new_gaussian_from_std_dev(sqrt(1.1641198952558192e-09)), - new_gaussian_from_std_dev(sqrt(1.6434266310406663e-15)), 8, 2, 4, 1, - 100, 2, 40}, - // SHORTINT_PARAM_MESSAGE_1_CARRY_2 - // SHORTINT_PARAM_MESSAGE_2_CARRY_1 - // SHORTINT_PARAM_MESSAGE_3_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 742, 2, 1024, - new_gaussian_from_std_dev(sqrt(4.998277131225527e-11)), - new_gaussian_from_std_dev(sqrt(8.645717832544903e-32)), 23, 1, 2, 4, - 100, 2, 40}, - // SHORTINT_PARAM_MESSAGE_1_CARRY_3 - // SHORTINT_PARAM_MESSAGE_2_CARRY_2 - // SHORTINT_PARAM_MESSAGE_3_CARRY_1 - // SHORTINT_PARAM_MESSAGE_4_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 745, 1, 2048, - new_gaussian_from_std_dev(sqrt(4.478453795193731e-11)), - new_gaussian_from_std_dev(sqrt(8.645717832544903e-32)), 23, 1, 2, 8, - 100, 2, 40}, - // SHORTINT_PARAM_MESSAGE_5_CARRY_0 - // SHORTINT_PARAM_MESSAGE_3_CARRY_2 - (ClassicalProgrammableBootstrapTestParams){ - 807, 1, 4096, - new_gaussian_from_std_dev(sqrt(4.629015039118823e-12)), - new_gaussian_from_std_dev(sqrt(4.70197740328915e-38)), 22, 1, 32, 1, - 100, 1, 40}, - // SHORTINT_PARAM_MESSAGE_6_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 915, 1, 8192, - new_gaussian_from_std_dev(sqrt(8.883173851180252e-14)), - new_gaussian_from_std_dev(sqrt(4.70197740328915e-38)), 22, 1, 64, 1, - 100, 1, 2}, - // SHORTINT_PARAM_MESSAGE_3_CARRY_3 - (ClassicalProgrammableBootstrapTestParams){ - 864, 1, 8192, - new_gaussian_from_std_dev(sqrt(1.5843564961097632e-15)), - new_gaussian_from_std_dev(sqrt(4.70197740328915e-38)), 15, 2, 8, 8, - 100, 1, 2}, - // SHORTINT_PARAM_MESSAGE_4_CARRY_3 - // SHORTINT_PARAM_MESSAGE_7_CARRY_0 - (ClassicalProgrammableBootstrapTestParams){ - 930, 1, 16384, - new_gaussian_from_std_dev(sqrt(5.129877458078009e-14)), - new_gaussian_from_std_dev(sqrt(4.70197740328915e-38)), 15, 2, 128, - 1, 100, 1, 1}); + 977, 1, 8192, new_gaussian_from_std_dev(3.0144389706858286e-07), + new_gaussian_from_std_dev(2.168404344971009e-19), 16, 2, 8, 8, 100, + 1, 1}); std::string printParamName( ::testing::TestParamInfo p) { ClassicalProgrammableBootstrapTestParams params = p.param; diff --git a/backends/tfhe-cuda-backend/cuda/tests_and_benchmarks/tests/test_multibit_pbs.cpp b/backends/tfhe-cuda-backend/cuda/tests_and_benchmarks/tests/test_multibit_pbs.cpp index 1adfd773b0..eec69ddd38 100644 --- a/backends/tfhe-cuda-backend/cuda/tests_and_benchmarks/tests/test_multibit_pbs.cpp +++ b/backends/tfhe-cuda-backend/cuda/tests_and_benchmarks/tests/test_multibit_pbs.cpp @@ -171,70 +171,44 @@ TEST_P(MultiBitProgrammableBootstrapTestPrimitives_u64, } } +/** + int lwe_dimension; + int glwe_dimension; + int polynomial_size; + DynamicDistribution lwe_noise_distribution; + DynamicDistribution glwe_noise_distribution; + int pbs_base_log; + int pbs_level; + int message_modulus; + int carry_modulus; + int number_of_inputs; + int grouping_factor; + int repetitions; + int samples; + */ // Defines for which parameters set the PBS will be tested. // It executes each src for all pairs on phis X qs (Cartesian product) ::testing::internal::ParamGenerator multipbs_params_u64 = ::testing::Values( - // fast src - (MultiBitProgrammableBootstrapTestParams){ - 16, 1, 256, new_gaussian_from_std_dev(sqrt(1.3880686109937e-11)), - new_gaussian_from_std_dev(sqrt(1.1919984450689246e-23)), 23, 1, 2, - 2, 1, 2, 1, 10}, - (MultiBitProgrammableBootstrapTestParams){ - 16, 1, 256, new_gaussian_from_std_dev(sqrt(1.3880686109937e-11)), - new_gaussian_from_std_dev(sqrt(1.1919984450689246e-23)), 23, 1, 2, - 2, 128, 2, 1, 10}, - // 4_bits_multi_bit_group_2 - (MultiBitProgrammableBootstrapTestParams){ - 818, 1, 2048, new_gaussian_from_std_dev(sqrt(1.3880686109937e-11)), - new_gaussian_from_std_dev(sqrt(1.1919984450689246e-23)), 22, 1, 2, - 2, 1, 2, 1, 10}, - (MultiBitProgrammableBootstrapTestParams){ - 818, 1, 2048, new_gaussian_from_std_dev(sqrt(1.3880686109937e-15)), - new_gaussian_from_std_dev(sqrt(1.1919984450689246e-24)), 22, 1, 2, - 2, 128, 2, 1, 10}, - // 4_bits_multi_bit_group_3 - (MultiBitProgrammableBootstrapTestParams){ - 888, 1, 2048, - new_gaussian_from_std_dev(sqrt(4.9571231961752025e-12)), - new_gaussian_from_std_dev(sqrt(9.9409770026944e-32)), 21, 1, 2, 2, - 1, 3, 1, 10}, - (MultiBitProgrammableBootstrapTestParams){ - 888, 1, 16384, - new_gaussian_from_std_dev(sqrt(4.9571231961752025e-12)), - new_gaussian_from_std_dev(sqrt(9.9409770026944e-32)), 21, 1, 2, 2, - 1, 3, 1, 1}, - - (MultiBitProgrammableBootstrapTestParams){ - 888, 1, 1024, - new_gaussian_from_std_dev(sqrt(4.9571231961752025e-12)), - new_gaussian_from_std_dev(sqrt(9.9409770026944e-32)), 21, 1, 2, 2, - 128, 3, 1, 10}, - (MultiBitProgrammableBootstrapTestParams){ - 888, 1, 2048, - new_gaussian_from_std_dev(sqrt(4.9571231961752025e-12)), - new_gaussian_from_std_dev(sqrt(9.9409770026944e-32)), 21, 1, 2, 2, - 128, 3, 1, 10}, + // PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64 (MultiBitProgrammableBootstrapTestParams){ - 888, 1, 4096, - new_gaussian_from_std_dev(sqrt(4.9571231961752025e-12)), - new_gaussian_from_std_dev(sqrt(9.9409770026944e-32)), 21, 1, 2, 2, - 128, 3, 1, 10}, + 882, 1, 2048, new_t_uniform(46), new_t_uniform(17), 14, 2, 8, 8, + 100, 3, 1, 1}, + // PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64 (MultiBitProgrammableBootstrapTestParams){ - 888, 1, 8192, - new_gaussian_from_std_dev(sqrt(4.9571231961752025e-12)), - new_gaussian_from_std_dev(sqrt(9.9409770026944e-32)), 21, 1, 2, 2, - 128, 3, 1, 1}, + 978, 1, 8192, new_gaussian_from_std_dev((2.962875621642539e-07)), + new_gaussian_from_std_dev((2.168404344971009e-19)), 14, 2, 8, 8, + 100, 3, 1, 1}, + // PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64 (MultiBitProgrammableBootstrapTestParams){ - 888, 1, 16384, - new_gaussian_from_std_dev(sqrt(4.9571231961752025e-12)), - new_gaussian_from_std_dev(sqrt(9.9409770026944e-32)), 21, 1, 2, 2, - 128, 3, 1, 1}, + 836, 1, 2048, new_gaussian_from_std_dev((3.433444883863949e-06)), + new_gaussian_from_std_dev((2.845267479601915e-15)), 22, 2, 4, 4, + 100, 2, 1, 1}, + // PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64 (MultiBitProgrammableBootstrapTestParams){ - 972, 1, 8192, - new_gaussian_from_std_dev(sqrt(4.9571231961752025e-12)), - new_gaussian_from_std_dev(sqrt(9.9409770026944e-32)), 14, 2, 8, 8, - 68, 3, 1, 1}); + 978, 1, 8192, new_gaussian_from_std_dev((2.962875621642539e-07)), + new_gaussian_from_std_dev((2.168404344971009e-19)), 14, 2, 8, 8, + 100, 2, 1, 1}); std::string printParamName( ::testing::TestParamInfo p) {