mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-09 14:47:56 -05:00
fix(gpu): fix oprf output degree
This commit is contained in:
@@ -6028,6 +6028,8 @@ template <typename Torus> struct int_grouped_oprf_memory {
|
||||
degree, params.message_modulus, params.carry_modulus,
|
||||
params.glwe_dimension, params.polynomial_size, lut_f,
|
||||
allocate_gpu_memory);
|
||||
// In OPRF the degree is hard set to p - 1 instead of the LUT degree
|
||||
degree = p - 1;
|
||||
*luts->get_degree(lut_index) = degree;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,3 +61,23 @@ impl FheBool {
|
||||
Self::new(ciphertext, tag, ReRandomizationMetadata::default())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "gpu")]
|
||||
mod test {
|
||||
use crate::prelude::FheDecrypt;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
#[test]
|
||||
fn test_oprf_boolean() {
|
||||
let config = crate::ConfigBuilder::default().build();
|
||||
let client_key = crate::ClientKey::generate(config);
|
||||
let compressed_server_key = crate::CompressedServerKey::new(&client_key);
|
||||
let gpu_key = compressed_server_key.decompress_to_gpu();
|
||||
crate::set_server_key(gpu_key);
|
||||
|
||||
let rnd = crate::FheBool::generate_oblivious_pseudo_random(Seed(123u128));
|
||||
let decrypted_result: bool = rnd.decrypt(&client_key);
|
||||
println!("Random bool: {decrypted_result}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user