Skip to content

Commit

Permalink
fix(gpu): fix ilog2 result when input is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
agnesLeroy committed Mar 3, 2025
1 parent ce327b7 commit 27cdcd2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tfhe/src/integer/gpu/server_key/radix/ilog2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use crate::integer::gpu::ciphertext::{
use crate::integer::gpu::reverse_blocks_inplace_async;
use crate::integer::gpu::server_key::CudaServerKey;
use crate::integer::server_key::radix_parallel::ilog2::{BitValue, Direction};
use crate::shortint::ciphertext::Degree;
use crate::shortint::parameters::NoiseLevel;

impl CudaServerKey {
/// This function takes a ciphertext in radix representation
Expand Down Expand Up @@ -502,6 +504,15 @@ impl CudaServerKey {
.unwrap();

carry_blocks_last.copy_from_gpu_async(&trivial_last_block_slice, streams, 0);
carry_blocks.as_mut().info.blocks.last_mut().unwrap().degree =
Degree(self.message_modulus.0 - 1);
carry_blocks
.as_mut()
.info
.blocks
.last_mut()
.unwrap()
.noise_level = NoiseLevel::ZERO;

self.apply_lookup_table_async(
carry_blocks.as_mut(),
Expand Down

0 comments on commit 27cdcd2

Please sign in to comment.