-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(optimizer): fix leveled noise propagation #933
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
Benchmark suite | Current: af7d986 | Previous: dd8cb06 | Ratio |
---|---|---|---|
v0 PBS table generation |
60049852 ns/iter (± 376730 ) |
60058969 ns/iter (± 940607 ) |
1.00 |
v0 PBS simulate dag table generation |
37623699 ns/iter (± 443648 ) |
37806462 ns/iter (± 292750 ) |
1.00 |
v0 WoP-PBS table generation |
68694502 ns/iter (± 2861756 ) |
68533645 ns/iter (± 388289 ) |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
376a65d
to
e6912b4
Compare
a0eae73
to
4ab336f
Compare
compilers/concrete-compiler/compiler/lib/Dialect/FHE/Analysis/ConcreteOptimizer.cpp
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/lib/Dialect/FHE/Analysis/MANP.cpp
Outdated
Show resolved
Hide resolved
compilers/concrete-optimizer/concrete-optimizer/src/dag/unparametrized.rs
Outdated
Show resolved
Hide resolved
...ilers/concrete-optimizer/concrete-optimizer/src/optimization/dag/multi_parameters/analyze.rs
Outdated
Show resolved
Hide resolved
...ilers/concrete-optimizer/concrete-optimizer/src/optimization/dag/multi_parameters/analyze.rs
Outdated
Show resolved
Hide resolved
...rete-optimizer/concrete-optimizer/src/optimization/dag/multi_parameters/symbolic_variance.rs
Outdated
Show resolved
Hide resolved
compilers/concrete-optimizer/concrete-optimizer/src/optimization/dag/solo_key/analyze.rs
Outdated
Show resolved
Hide resolved
...ilers/concrete-optimizer/concrete-optimizer/src/optimization/dag/multi_parameters/analyze.rs
Show resolved
Hide resolved
compilers/concrete-optimizer/concrete-optimizer/src/dag/unparametrized.rs
Outdated
Show resolved
Hide resolved
b3d2823
to
dd8cb06
Compare
dd8cb06
to
af7d986
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the conversion between the manp and the average weight for levelled op, it feels to me it's not always right
#[allow(clippy::float_cmp)] | ||
pub fn after_levelled_op(&self, manp: f64) -> Self { | ||
let new_coeff = manp * manp; | ||
// detect the previous base manp level | ||
// this is the maximum value of fresh base noise and pbs base noise | ||
let mut current_max: f64 = 0.0; | ||
for partition in PartitionIndex::range(0, self.nb_partitions()) { | ||
let fresh_coeff = self.coeff_input(partition); | ||
let pbs_noise_coeff = self.coeff_pbs(partition); | ||
current_max = current_max.max(fresh_coeff).max(pbs_noise_coeff); | ||
} | ||
// assert!(1.0 <= current_max); | ||
// assert!( | ||
// current_max <= new_coeff, | ||
// "Non monotonious levelled op: {current_max} <= {new_coeff}" | ||
// ); | ||
// replace all current_max by new_coeff | ||
// multiply everything else by new_coeff / current_max | ||
let mut new = self.clone(); | ||
if current_max == 0.0 { | ||
return new; | ||
} | ||
for cell in &mut new.coeffs.values { | ||
if *cell == current_max { | ||
*cell = new_coeff; | ||
} else { | ||
*cell *= new_coeff / current_max; | ||
} | ||
} | ||
new | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.