simplification(optimizer): remove max_log2_base

This commit is contained in:
Mayeul@Zama
2022-11-16 15:35:22 +01:00
committed by mayeul-zama
parent 1c35a59192
commit f4bd2df44b
4 changed files with 2 additions and 21 deletions

View File

@@ -3,7 +3,6 @@ use std::sync::Arc;
use crate::computing_cost::complexity_model::ComplexityModel;
use crate::computing_cost::cpu::CpuComplexity;
use crate::computing_cost::gpu::GpuComplexity;
use crate::optimization::config::{MAX_LOG2_BASE_CPU, MAX_LOG2_BASE_GPU};
#[derive(Clone, Copy)]
pub enum ProcessingUnit {
@@ -21,13 +20,6 @@ pub enum GpuPbsType {
}
impl ProcessingUnit {
pub fn max_br_base_log(self) -> u64 {
match self {
Self::Cpu => MAX_LOG2_BASE_CPU,
Self::Gpu { .. } => MAX_LOG2_BASE_GPU,
}
}
pub fn ks_to_string(self) -> &'static str {
match self {
Self::Cpu => "cpu",

View File

@@ -86,9 +86,3 @@ impl SearchSpace {
}
}
}
// https://github.com/zama-ai/concrete-core/blob/6b52182ab44c4b39ddebca1c457e1096fb687801/concrete-cuda/cuda/src/bootstrap_amortized.cu#L77
// https://github.com/zama-ai/concrete-core/blob/6b52182ab44c4b39ddebca1c457e1096fb687801/concrete-cuda/cuda/src/bootstrap_low_latency.cu#L153
pub const MAX_LOG2_BASE_GPU: u64 = 64;
pub const MAX_LOG2_BASE_CPU: u64 = 64;

View File

@@ -23,18 +23,17 @@ pub fn pareto_quantities(
security_level: u64,
internal_dim: u64,
glwe_params: GlweParameters,
max_log2_base: u64,
) -> Vec<BrComplexityNoise> {
assert!(ciphertext_modulus_log == 64);
let variance_bsk = glwe_params.minimal_variance(ciphertext_modulus_log, security_level);
let mut quantities = Vec::with_capacity(max_log2_base as usize);
let mut quantities = Vec::with_capacity(ciphertext_modulus_log as usize);
let mut increasing_complexity = 0.0;
let mut decreasing_variance = f64::INFINITY;
let mut counting_no_progress = 0;
let mut prev_best_log2_base = max_log2_base;
let mut prev_best_log2_base = ciphertext_modulus_log as u64;
for level in 1..=ciphertext_modulus_log as u64 {
// detect increasing noise
@@ -121,7 +120,6 @@ pub fn cache(
let hardware = processing_unit.br_to_string();
let path = format!("{cache_dir}/br-decomp-{hardware}-64-{security_level}");
let max_log2_base = processing_unit.max_br_base_log();
let function = move |(glwe_params, internal_dim): MacroParam| {
pareto_quantities(
complexity_model.as_ref(),
@@ -129,7 +127,6 @@ pub fn cache(
security_level,
internal_dim,
glwe_params,
max_log2_base,
)
};
PersistentCacheHashMap::new_no_read(&path, VERSION, function)

View File

@@ -88,7 +88,6 @@ pub fn cache(
let hardware = processing_unit.br_to_string();
let path = format!("{cache_dir}/bc-decomp-{hardware}-64-{security_level}");
let max_log2_base = processing_unit.max_br_base_log();
let function = move |(glwe_params, internal_dim): MacroParam| {
let br = blind_rotate::pareto_quantities(
complexity_model.as_ref(),
@@ -96,7 +95,6 @@ pub fn cache(
security_level,
internal_dim,
glwe_params,
max_log2_base,
);
pareto_quantities(
complexity_model.as_ref(),