diff --git a/README.md b/README.md index 3a23e7f4bd..6aa7db07c4 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ To run this code, use the following command: > Note that when running code that uses `TFHE-rs`, it is highly recommended to run in release mode with cargo's `--release` flag to have the best performances possible. -*Find an example with more explanations in [this part of the documentation](https://docs.zama.ai/tfhe-rs/getting-started/quick_start)* +*Find an example with more explanations in [this part of the documentation](https://docs.zama.ai/tfhe-rs/get-started/quick_start)*

↑ Back to top diff --git a/apps/trivium/src/kreyvium/kreyvium.rs b/apps/trivium/src/kreyvium/kreyvium.rs index 695607cffd..9ada5bfe5e 100644 --- a/apps/trivium/src/kreyvium/kreyvium.rs +++ b/apps/trivium/src/kreyvium/kreyvium.rs @@ -148,10 +148,9 @@ where /// Computes one turn of the stream, updating registers and outputting the new bit. pub fn next_bool(&mut self) -> T { - match &self.fhe_key { - Some(sk) => set_server_key(sk.clone()), - None => (), - }; + if let Some(sk) = &self.fhe_key { + set_server_key(sk.clone()); + } let [o, a, b, c] = self.get_output_and_values(0); @@ -226,18 +225,12 @@ where /// Computes 64 turns of the stream, outputting the 64 bits all at once in a /// Vec (first value is oldest, last is newest) pub fn next_64(&mut self) -> Vec { - match &self.fhe_key { - Some(sk) => { - rayon::broadcast(|_| set_server_key(sk.clone())); - } - None => (), + if let Some(sk) = &self.fhe_key { + rayon::broadcast(|_| set_server_key(sk.clone())); } let mut values = self.get_64_output_and_values(); - match &self.fhe_key { - Some(_) => { - rayon::broadcast(|_| unset_server_key()); - } - None => (), + if self.fhe_key.is_some() { + rayon::broadcast(|_| unset_server_key()); } let mut ret = Vec::::with_capacity(64); diff --git a/apps/trivium/src/kreyvium/kreyvium_byte.rs b/apps/trivium/src/kreyvium/kreyvium_byte.rs index d2a3450143..0ebc0ce607 100644 --- a/apps/trivium/src/kreyvium/kreyvium_byte.rs +++ b/apps/trivium/src/kreyvium/kreyvium_byte.rs @@ -237,18 +237,12 @@ where /// Computes 64 turns of the stream, outputting the 64 bits (in 8 bytes) all at once in a /// Vec (first value is oldest, last is newest) pub fn next_64(&mut self) -> Vec { - match &self.fhe_key { - Some(sk) => { - rayon::broadcast(|_| set_server_key(sk.clone())); - } - None => (), + if let Some(sk) = &self.fhe_key { + rayon::broadcast(|_| set_server_key(sk.clone())); } let values = self.get_64_output_and_values(); - match &self.fhe_key { - Some(_) => { - rayon::broadcast(|_| unset_server_key()); - } - None => (), + if self.fhe_key.is_some() { + rayon::broadcast(|_| unset_server_key()); } let mut bytes = Vec::::with_capacity(8); diff --git a/apps/trivium/src/trivium/trivium_bool.rs b/apps/trivium/src/trivium/trivium_bool.rs index 4e46927c31..b4243c2112 100644 --- a/apps/trivium/src/trivium/trivium_bool.rs +++ b/apps/trivium/src/trivium/trivium_bool.rs @@ -120,10 +120,9 @@ where /// Computes one turn of the stream, updating registers and outputting the new bit. pub fn next_bool(&mut self) -> T { - match &self.fhe_key { - Some(sk) => set_server_key(sk.clone()), - None => (), - }; + if let Some(sk) = &self.fhe_key { + set_server_key(sk.clone()); + } let [o, a, b, c] = self.get_output_and_values(0); @@ -196,18 +195,12 @@ where /// Computes 64 turns of the stream, outputting the 64 bits all at once in a /// Vec (first value is oldest, last is newest) pub fn next_64(&mut self) -> Vec { - match &self.fhe_key { - Some(sk) => { - rayon::broadcast(|_| set_server_key(sk.clone())); - } - None => (), + if let Some(sk) = &self.fhe_key { + rayon::broadcast(|_| set_server_key(sk.clone())); } let mut values = self.get_64_output_and_values(); - match &self.fhe_key { - Some(_) => { - rayon::broadcast(|_| unset_server_key()); - } - None => (), + if self.fhe_key.is_some() { + rayon::broadcast(|_| unset_server_key()); } let mut ret = Vec::::with_capacity(64); diff --git a/apps/trivium/src/trivium/trivium_byte.rs b/apps/trivium/src/trivium/trivium_byte.rs index edb417ef9c..3059e866dc 100644 --- a/apps/trivium/src/trivium/trivium_byte.rs +++ b/apps/trivium/src/trivium/trivium_byte.rs @@ -187,18 +187,12 @@ where /// Computes 64 turns of the stream, outputting the 64 bits (in 8 bytes) all at once in a /// Vec (first value is oldest, last is newest) pub fn next_64(&mut self) -> Vec { - match &self.fhe_key { - Some(sk) => { - rayon::broadcast(|_| set_server_key(sk.clone())); - } - None => (), + if let Some(sk) = &self.fhe_key { + rayon::broadcast(|_| set_server_key(sk.clone())); } let values = self.get_64_output_and_values(); - match &self.fhe_key { - Some(_) => { - rayon::broadcast(|_| unset_server_key()); - } - None => (), + if self.fhe_key.is_some() { + rayon::broadcast(|_| unset_server_key()); } let mut bytes = Vec::::with_capacity(8); diff --git a/tfhe/Cargo.toml b/tfhe/Cargo.toml index db70c8d1c1..d1a764cb2d 100644 --- a/tfhe/Cargo.toml +++ b/tfhe/Cargo.toml @@ -64,7 +64,7 @@ rayon = { version = "1.5.0" } bincode = "1.3.3" concrete-fft = { version = "0.4.1", features = ["serde", "fft128"] } concrete-ntt = { version = "0.1.2" } -pulp = "0.18.8" +pulp = "0.18.22" tfhe-cuda-backend = { version = "0.4.0-alpha.0", path = "../backends/tfhe-cuda-backend", optional = true } aligned-vec = { version = "0.5", features = ["serde"] } dyn-stack = { version = "0.9" } diff --git a/tfhe/benches/shortint/oprf.rs b/tfhe/benches/shortint/oprf.rs index e08d29e6de..f40bb262b4 100644 --- a/tfhe/benches/shortint/oprf.rs +++ b/tfhe/benches/shortint/oprf.rs @@ -14,7 +14,7 @@ fn oprf(c: &mut Criterion) { let keys = KEY_CACHE.get_from_param(param); let sks = keys.server_key(); - bench_group.bench_function(&format!("2-bits-oprf::{}", param.name()), |b| { + bench_group.bench_function(format!("2-bits-oprf::{}", param.name()), |b| { b.iter(|| { _ = black_box(sks.generate_oblivious_pseudo_random(Seed(0), 2)); }) diff --git a/toolchain.txt b/toolchain.txt index 9be8e78c5c..d146fddb10 100644 --- a/toolchain.txt +++ b/toolchain.txt @@ -1 +1 @@ -nightly-2024-07-05 +nightly-2024-08-19