Skip to content
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(hlapi): ciphertext list decompress after safe_deser #2019

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tfhe/src/core_crypto/gpu/entities/glwe_ciphertext_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,8 @@ impl<T: UnsignedInteger> CudaGlweCiphertextList<T> {
pub(crate) fn ciphertext_modulus(&self) -> CiphertextModulus<T> {
self.0.ciphertext_modulus
}

pub fn duplicate(&self, streams: &CudaStreams) -> Self {
Self(self.0.duplicate(streams))
}
}
18 changes: 18 additions & 0 deletions tfhe/src/core_crypto/gpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,24 @@ pub struct CudaGlweList<T: UnsignedInteger> {
pub ciphertext_modulus: CiphertextModulus<T>,
}

impl<T: UnsignedInteger> CudaGlweList<T> {
pub fn duplicate(&self, streams: &CudaStreams) -> Self {
let d_vec = unsafe {
let mut d_vec = CudaVec::new_async(self.d_vec.len(), streams, 0);
d_vec.copy_from_gpu_async(&self.d_vec, streams, 0);
d_vec
};
streams.synchronize();

Self {
d_vec,
glwe_ciphertext_count: self.glwe_ciphertext_count,
glwe_dimension: self.glwe_dimension,
polynomial_size: self.polynomial_size,
ciphertext_modulus: self.ciphertext_modulus,
}
}
}
/// Get the number of GPUs on the machine
pub fn get_number_of_gpus() -> i32 {
unsafe { cuda_get_number_of_gpus() }
Expand Down
Loading
Loading