mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
@@ -536,13 +536,17 @@ void memref_wop_pbs_crt_buffer(
|
||||
auto extract_bits_output_buffer =
|
||||
new uint64_t[lwe_small_size * total_number_of_bits_per_block]{0};
|
||||
|
||||
// We make a private copy to apply a subtraction on the body
|
||||
auto first_cyphertext = in_aligned + in_offset;
|
||||
auto copy_size = crt_decomp_size * lwe_big_size;
|
||||
std::vector<uint64_t> in_copy(first_cyphertext, first_cyphertext + copy_size);
|
||||
// Extraction of each bit for each block
|
||||
for (int64_t i = crt_decomp_size - 1, extract_bits_output_offset = 0; i >= 0;
|
||||
extract_bits_output_offset += number_of_bits_per_block[i--]) {
|
||||
auto nb_bits_to_extract = number_of_bits_per_block[i];
|
||||
|
||||
auto delta_log = 64 - nb_bits_to_extract;
|
||||
auto in_block = &in_aligned[lwe_big_size * i + in_offset];
|
||||
auto in_block = &in_copy[lwe_big_size * i];
|
||||
|
||||
// trick ( ct - delta/2 + delta/2^4 )
|
||||
uint64_t sub = (uint64_t(1) << (uint64_t(64) - nb_bits_to_extract - 1)) -
|
||||
|
||||
16
compiler/tests/end_to_end_fixture/tests_cpu/bug_865.yaml
Normal file
16
compiler/tests/end_to_end_fixture/tests_cpu/bug_865.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
description: bug_865_due_to_side_effect_in_woppbs
|
||||
program: |
|
||||
func.func @main(%arg0: !FHE.eint<16>, %arg1: !FHE.eint<16>) -> !FHE.eint<16> {
|
||||
%cst = arith.constant dense<0> : tensor<65536xi64>
|
||||
%0 = "FHE.apply_lookup_table"(%arg0, %cst) : (!FHE.eint<16>, tensor<65536xi64>) -> !FHE.eint<16>
|
||||
%1 = "FHE.add_eint"(%0, %arg0) : (!FHE.eint<16>, !FHE.eint<16>) -> !FHE.eint<16>
|
||||
%2 = "FHE.apply_lookup_table"(%1, %cst) : (!FHE.eint<16>, tensor<65536xi64>) -> !FHE.eint<16>
|
||||
return %2 : !FHE.eint<16>
|
||||
}
|
||||
encoding: crt
|
||||
tests:
|
||||
- inputs:
|
||||
- scalar: 0
|
||||
- scalar: 0
|
||||
outputs:
|
||||
- scalar: 0
|
||||
Reference in New Issue
Block a user