forked from zama-ai/tfhe-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(shortint): add multi bit GPU alias
- add easy access to compact PK tuniform params
- Loading branch information
1 parent
d1fe49f
commit bea9b77
Showing
11 changed files
with
200 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
156 changes: 156 additions & 0 deletions
156
tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_40/ks_pbs_gpu.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
use crate::core_crypto::prelude::*; | ||
use crate::shortint::ciphertext::MaxNoiseLevel; | ||
use crate::shortint::parameters::multi_bit::MultiBitPBSParameters; | ||
use crate::shortint::parameters::{CarryModulus, MessageModulus}; | ||
|
||
// Group 2 | ||
pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M40: | ||
MultiBitPBSParameters = MultiBitPBSParameters { | ||
lwe_dimension: LweDimension(764), | ||
glwe_dimension: GlweDimension(3), | ||
polynomial_size: PolynomialSize(512), | ||
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.000006025673585415336, | ||
)), | ||
glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.0000000000039666089171633006, | ||
)), | ||
pbs_base_log: DecompositionBaseLog(18), | ||
pbs_level: DecompositionLevelCount(1), | ||
ks_base_log: DecompositionBaseLog(6), | ||
ks_level: DecompositionLevelCount(2), | ||
message_modulus: MessageModulus(2), | ||
carry_modulus: CarryModulus(2), | ||
max_noise_level: MaxNoiseLevel::new(3), | ||
log2_p_fail: -40., | ||
ciphertext_modulus: CiphertextModulus::new_native(), | ||
encryption_key_choice: EncryptionKeyChoice::Big, | ||
grouping_factor: LweBskGroupingFactor(2), | ||
deterministic_execution: false, | ||
}; | ||
|
||
pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M40: | ||
MultiBitPBSParameters = MultiBitPBSParameters { | ||
lwe_dimension: LweDimension(818), | ||
glwe_dimension: GlweDimension(1), | ||
polynomial_size: PolynomialSize(2048), | ||
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.000002226459789930014, | ||
)), | ||
glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.0000000000000003152931493498455, | ||
)), | ||
pbs_base_log: DecompositionBaseLog(22), | ||
pbs_level: DecompositionLevelCount(1), | ||
ks_base_log: DecompositionBaseLog(5), | ||
ks_level: DecompositionLevelCount(3), | ||
message_modulus: MessageModulus(4), | ||
carry_modulus: CarryModulus(4), | ||
max_noise_level: MaxNoiseLevel::new(5), | ||
log2_p_fail: -40., | ||
ciphertext_modulus: CiphertextModulus::new_native(), | ||
encryption_key_choice: EncryptionKeyChoice::Big, | ||
grouping_factor: LweBskGroupingFactor(2), | ||
deterministic_execution: false, | ||
}; | ||
|
||
pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M40: | ||
MultiBitPBSParameters = MultiBitPBSParameters { | ||
lwe_dimension: LweDimension(922), | ||
glwe_dimension: GlweDimension(1), | ||
polynomial_size: PolynomialSize(8192), | ||
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.0000003272369292345697, | ||
)), | ||
glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.0000000000000000002168404344971009, | ||
)), | ||
pbs_base_log: DecompositionBaseLog(14), | ||
pbs_level: DecompositionLevelCount(2), | ||
ks_base_log: DecompositionBaseLog(4), | ||
ks_level: DecompositionLevelCount(4), | ||
message_modulus: MessageModulus(8), | ||
carry_modulus: CarryModulus(8), | ||
max_noise_level: MaxNoiseLevel::new(9), | ||
log2_p_fail: -40., | ||
ciphertext_modulus: CiphertextModulus::new_native(), | ||
encryption_key_choice: EncryptionKeyChoice::Big, | ||
grouping_factor: LweBskGroupingFactor(2), | ||
deterministic_execution: false, | ||
}; | ||
|
||
// Group 3 | ||
pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M40: | ||
MultiBitPBSParameters = MultiBitPBSParameters { | ||
lwe_dimension: LweDimension(765), | ||
glwe_dimension: GlweDimension(3), | ||
polynomial_size: PolynomialSize(512), | ||
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.000005915594083804978, | ||
)), | ||
glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.0000000000039666089171633006, | ||
)), | ||
pbs_base_log: DecompositionBaseLog(18), | ||
pbs_level: DecompositionLevelCount(1), | ||
ks_base_log: DecompositionBaseLog(6), | ||
ks_level: DecompositionLevelCount(2), | ||
message_modulus: MessageModulus(2), | ||
carry_modulus: CarryModulus(2), | ||
max_noise_level: MaxNoiseLevel::new(3), | ||
log2_p_fail: -40., | ||
ciphertext_modulus: CiphertextModulus::new_native(), | ||
encryption_key_choice: EncryptionKeyChoice::Big, | ||
grouping_factor: LweBskGroupingFactor(3), | ||
deterministic_execution: false, | ||
}; | ||
|
||
pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M40: | ||
MultiBitPBSParameters = MultiBitPBSParameters { | ||
lwe_dimension: LweDimension(888), | ||
glwe_dimension: GlweDimension(1), | ||
polynomial_size: PolynomialSize(2048), | ||
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.0000006125031601933181, | ||
)), | ||
glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.0000000000000003152931493498455, | ||
)), | ||
pbs_base_log: DecompositionBaseLog(21), | ||
pbs_level: DecompositionLevelCount(1), | ||
ks_base_log: DecompositionBaseLog(7), | ||
ks_level: DecompositionLevelCount(2), | ||
message_modulus: MessageModulus(4), | ||
carry_modulus: CarryModulus(4), | ||
max_noise_level: MaxNoiseLevel::new(5), | ||
log2_p_fail: -40., | ||
ciphertext_modulus: CiphertextModulus::new_native(), | ||
encryption_key_choice: EncryptionKeyChoice::Big, | ||
grouping_factor: LweBskGroupingFactor(3), | ||
deterministic_execution: false, | ||
}; | ||
|
||
pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M40: | ||
MultiBitPBSParameters = MultiBitPBSParameters { | ||
lwe_dimension: LweDimension(972), | ||
glwe_dimension: GlweDimension(1), | ||
polynomial_size: PolynomialSize(8192), | ||
lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.00000013016688349592805, | ||
)), | ||
glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( | ||
0.0000000000000000002168404344971009, | ||
)), | ||
pbs_base_log: DecompositionBaseLog(14), | ||
pbs_level: DecompositionLevelCount(2), | ||
ks_base_log: DecompositionBaseLog(6), | ||
ks_level: DecompositionLevelCount(3), | ||
message_modulus: MessageModulus(8), | ||
carry_modulus: CarryModulus(8), | ||
max_noise_level: MaxNoiseLevel::new(9), | ||
log2_p_fail: -40., | ||
ciphertext_modulus: CiphertextModulus::new_native(), | ||
encryption_key_choice: EncryptionKeyChoice::Big, | ||
grouping_factor: LweBskGroupingFactor(3), | ||
deterministic_execution: false, | ||
}; |
1 change: 1 addition & 0 deletions
1
tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_40/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod ks_pbs; | ||
pub mod ks_pbs_gpu; |