mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-09 14:47:56 -05:00
chore(gpu): update 4_1_1 params to match specialized pbs
This commit is contained in:
committed by
Agnès Leroy
parent
34743ea304
commit
a8f391a442
@@ -13,11 +13,11 @@ The following example shows how to use parallelized bootstrapping by choosing mu
|
||||
```rust
|
||||
use tfhe::prelude::*;
|
||||
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint32};
|
||||
use tfhe::shortint::parameters::current_params::V1_3_PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64;
|
||||
use tfhe::shortint::parameters::current_params::V1_4_PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = ConfigBuilder::default()
|
||||
.use_custom_parameters(V1_3_PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64)
|
||||
.use_custom_parameters(V1_4_PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64)
|
||||
.build();
|
||||
|
||||
let (keys, server_keys) = generate_keys(config);
|
||||
@@ -45,12 +45,12 @@ Here's an example:
|
||||
```rust
|
||||
use tfhe::prelude::*;
|
||||
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint32};
|
||||
use tfhe::shortint::parameters::current_params::V1_3_PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64;
|
||||
use tfhe::shortint::parameters::current_params::V1_4_PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = ConfigBuilder::default()
|
||||
.use_custom_parameters(
|
||||
V1_3_PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64.with_deterministic_execution(),
|
||||
V1_4_PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64.with_deterministic_execution(),
|
||||
)
|
||||
.build();
|
||||
|
||||
|
||||
@@ -106,11 +106,11 @@ use tfhe::zk::{CompactPkeCrs, ZkComputeLoad};
|
||||
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut rng = thread_rng();
|
||||
|
||||
let params = tfhe::shortint::parameters::current_params::V1_3_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128;
|
||||
let params = tfhe::shortint::parameters::current_params::V1_4_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128;
|
||||
// Indicate which parameters to use for the Compact Public Key encryption
|
||||
let cpk_params = tfhe::shortint::parameters::current_params::compact_public_key_only::p_fail_2_minus_128::ks_pbs::V1_3_PARAM_PKE_TO_SMALL_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128_ZKV1;
|
||||
let cpk_params = tfhe::shortint::parameters::current_params::compact_public_key_only::p_fail_2_minus_128::ks_pbs::V1_4_PARAM_PKE_TO_SMALL_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128_ZKV1;
|
||||
// And parameters allowing to keyswitch/cast to the computation parameters.
|
||||
let casting_params = tfhe::shortint::parameters::current_params::key_switching::p_fail_2_minus_128::ks_pbs::V1_3_PARAM_KEYSWITCH_PKE_TO_SMALL_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128_ZKV1;
|
||||
let casting_params = tfhe::shortint::parameters::current_params::key_switching::p_fail_2_minus_128::ks_pbs::V1_4_PARAM_KEYSWITCH_PKE_TO_SMALL_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128_ZKV1;
|
||||
// Enable the dedicated parameters on the config
|
||||
let config = tfhe::ConfigBuilder::with_custom_parameters(params)
|
||||
.use_dedicated_compact_public_key_parameters((cpk_params, casting_params)).build();
|
||||
|
||||
@@ -50,11 +50,11 @@ You can override the default parameters with the `with_custom_parameters(block_p
|
||||
|
||||
```rust
|
||||
use tfhe::{ConfigBuilder, generate_keys};
|
||||
use tfhe::shortint::parameters::current_params::V1_3_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M128;
|
||||
use tfhe::shortint::parameters::current_params::V1_4_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M128;
|
||||
|
||||
fn main() {
|
||||
let config =
|
||||
ConfigBuilder::with_custom_parameters(V1_3_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M128)
|
||||
ConfigBuilder::with_custom_parameters(V1_4_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M128)
|
||||
.build();
|
||||
|
||||
// Client-side
|
||||
|
||||
@@ -37,7 +37,7 @@ function fhe_uint32_example() {
|
||||
|
||||
const U32_MAX = 4294967295;
|
||||
|
||||
const block_params = new ShortintParameters(ShortintParametersName.V1_3_PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS_GAUSSIAN_2M64);
|
||||
const block_params = new ShortintParameters(ShortintParametersName.V1_4_PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS_GAUSSIAN_2M64);
|
||||
let config = TfheConfigBuilder.default()
|
||||
.build();
|
||||
|
||||
@@ -90,7 +90,7 @@ async function example() {
|
||||
await initThreadPool(navigator.hardwareConcurrency);
|
||||
await init_panic_hook();
|
||||
|
||||
const block_params = new ShortintParameters(ShortintParametersName.V1_3_PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS_GAUSSIAN_2M64);
|
||||
const block_params = new ShortintParameters(ShortintParametersName.V1_4_PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS_GAUSSIAN_2M64);
|
||||
// ....
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user