|
| 1 | +!Z1056763241666817029_i64 = !mod_arith.int<1056763241666817029 : i64> |
| 2 | +!Z1106058412451299513_i64 = !mod_arith.int<1106058412451299513 : i64> |
| 3 | +!Z957769724367225479_i64 = !mod_arith.int<957769724367225479 : i64> |
| 4 | +#inverse_canonical_encoding = #lwe.inverse_canonical_encoding<scaling_factor = 60> |
| 5 | +#inverse_canonical_encoding1 = #lwe.inverse_canonical_encoding<scaling_factor = 40> |
| 6 | +#inverse_canonical_encoding2 = #lwe.inverse_canonical_encoding<scaling_factor = 100> |
| 7 | +#key = #lwe.key<> |
| 8 | +#modulus_chain_L1_C1 = #lwe.modulus_chain<elements = <1106058412451299513 : i64, 1056763241666817029 : i64>, current = 1> |
| 9 | +#modulus_chain_L2_C2 = #lwe.modulus_chain<elements = <1106058412451299513 : i64, 1056763241666817029 : i64, 957769724367225479 : i64>, current = 2> |
| 10 | +#ring_f64_1_x131072 = #polynomial.ring<coefficientType = f64, polynomialModulus = <1 + x**131072>> |
| 11 | +!rns_L1 = !rns.rns<!Z1106058412451299513_i64, !Z1056763241666817029_i64> |
| 12 | +!rns_L2 = !rns.rns<!Z1106058412451299513_i64, !Z1056763241666817029_i64, !Z957769724367225479_i64> |
| 13 | +!pt = !lwe.lwe_plaintext<application_data = <message_type = tensor<65536xf64>>, plaintext_space = <ring = #ring_f64_1_x131072, encoding = #inverse_canonical_encoding1>> |
| 14 | +#ring_rns_L1_1_x131072 = #polynomial.ring<coefficientType = !rns_L1, polynomialModulus = <1 + x**131072>> |
| 15 | +#ring_rns_L2_1_x131072 = #polynomial.ring<coefficientType = !rns_L2, polynomialModulus = <1 + x**131072>> |
| 16 | +#ciphertext_space_L1 = #lwe.ciphertext_space<ring = #ring_rns_L1_1_x131072, encryption_type = mix> |
| 17 | +#ciphertext_space_L2 = #lwe.ciphertext_space<ring = #ring_rns_L2_1_x131072, encryption_type = mix> |
| 18 | +!ct_L1 = !lwe.lwe_ciphertext<application_data = <message_type = tensor<65536xf64>>, plaintext_space = <ring = #ring_f64_1_x131072, encoding = #inverse_canonical_encoding1>, ciphertext_space = #ciphertext_space_L1, key = #key, modulus_chain = #modulus_chain_L1_C1> |
| 19 | +!ct_L2 = !lwe.lwe_ciphertext<application_data = <message_type = tensor<65536xf64>>, plaintext_space = <ring = #ring_f64_1_x131072, encoding = #inverse_canonical_encoding>, ciphertext_space = #ciphertext_space_L2, key = #key, modulus_chain = #modulus_chain_L2_C2> |
| 20 | +!ct_L2_1 = !lwe.lwe_ciphertext<application_data = <message_type = tensor<65536xf64>>, plaintext_space = <ring = #ring_f64_1_x131072, encoding = #inverse_canonical_encoding2>, ciphertext_space = #ciphertext_space_L2, key = #key, modulus_chain = #modulus_chain_L2_C2> |
| 21 | +module attributes {ckks.schemeParam = #ckks.scheme_param<logN = 17, Q = [1106058412451299513, 1056763241666817029, 957769724367225479, 919081519653443687, 1030837924888066153, 1084354410096143723, 1135846243351935917, 1087115004561311021, 997960547764032911, 892538949448853293, 1002528331340998513, 1100798419621231379, 981696679688787961, 1061922508412786269], P = [1152921504606846976], logDefaultScale = 60>, scheme.ckks} { |
| 22 | + func.func @in_place(%ct: !ct_L2) -> !ct_L1 { |
| 23 | + %ct_0 = ckks.rotate %ct {offset = 0 : i32} : !ct_L2 |
| 24 | + %cst = arith.constant dense<0.000000e+00> : tensor<65536xf64> |
| 25 | + %pt = lwe.rlwe_encode %cst {encoding = #inverse_canonical_encoding1, ring = #ring_f64_1_x131072} : tensor<65536xf64> -> !pt |
| 26 | + %ct_1 = ckks.mul_plain %ct_0, %pt : (!ct_L2, !pt) -> !ct_L2_1 |
| 27 | + %ct_2 = ckks.rescale %ct_1 {to_ring = #ring_rns_L1_1_x131072} : !ct_L2_1 -> !ct_L1 |
| 28 | + %ct_3 = ckks.rotate %ct {offset = 1 : i32} : !ct_L2 |
| 29 | + %cst_4 = arith.constant dense<0.000000e+00> : tensor<65536xf64> |
| 30 | + %pt_5 = lwe.rlwe_encode %cst_4 {encoding = #inverse_canonical_encoding1, ring = #ring_f64_1_x131072} : tensor<65536xf64> -> !pt |
| 31 | + %ct_6 = ckks.mul_plain %ct_3, %pt_5 : (!ct_L2, !pt) -> !ct_L2_1 |
| 32 | + %ct_7 = ckks.rescale %ct_6 {to_ring = #ring_rns_L1_1_x131072} : !ct_L2_1 -> !ct_L1 |
| 33 | + %ct_8 = ckks.add %ct_2, %ct_7 : (!ct_L1, !ct_L1) -> !ct_L1 |
| 34 | + %ct_9 = ckks.rotate %ct {offset = 2 : i32} : !ct_L2 |
| 35 | + %cst_10 = arith.constant dense<0.000000e+00> : tensor<65536xf64> |
| 36 | + %pt_11 = lwe.rlwe_encode %cst_10 {encoding = #inverse_canonical_encoding1, ring = #ring_f64_1_x131072} : tensor<65536xf64> -> !pt |
| 37 | + %ct_12 = ckks.mul_plain %ct_9, %pt_11 : (!ct_L2, !pt) -> !ct_L2_1 |
| 38 | + %ct_13 = ckks.rescale %ct_12 {to_ring = #ring_rns_L1_1_x131072} : !ct_L2_1 -> !ct_L1 |
| 39 | + %ct_14 = ckks.add %ct_8, %ct_13 : (!ct_L1, !ct_L1) -> !ct_L1 |
| 40 | + %ct_15 = ckks.rotate %ct {offset = 3 : i32} : !ct_L2 |
| 41 | + %cst_16 = arith.constant dense<0.000000e+00> : tensor<65536xf64> |
| 42 | + %pt_17 = lwe.rlwe_encode %cst_16 {encoding = #inverse_canonical_encoding1, ring = #ring_f64_1_x131072} : tensor<65536xf64> -> !pt |
| 43 | + %ct_18 = ckks.mul_plain %ct_15, %pt_17 : (!ct_L2, !pt) -> !ct_L2_1 |
| 44 | + %ct_19 = ckks.rescale %ct_18 {to_ring = #ring_rns_L1_1_x131072} : !ct_L2_1 -> !ct_L1 |
| 45 | + %ct_20 = ckks.add %ct_14, %ct_19 : (!ct_L1, !ct_L1) -> !ct_L1 |
| 46 | + %ct_21 = ckks.rotate %ct {offset = 4 : i32} : !ct_L2 |
| 47 | + %cst_22 = arith.constant dense<0.000000e+00> : tensor<65536xf64> |
| 48 | + %pt_23 = lwe.rlwe_encode %cst_22 {encoding = #inverse_canonical_encoding1, ring = #ring_f64_1_x131072} : tensor<65536xf64> -> !pt |
| 49 | + %ct_24 = ckks.mul_plain %ct_21, %pt_23 : (!ct_L2, !pt) -> !ct_L2_1 |
| 50 | + %ct_25 = ckks.rescale %ct_24 {to_ring = #ring_rns_L1_1_x131072} : !ct_L2_1 -> !ct_L1 |
| 51 | + %ct_26 = ckks.add %ct_20, %ct_25 : (!ct_L1, !ct_L1) -> !ct_L1 |
| 52 | + %ct_27 = ckks.rotate %ct {offset = 5 : i32} : !ct_L2 |
| 53 | + %cst_28 = arith.constant dense<0.000000e+00> : tensor<65536xf64> |
| 54 | + %pt_29 = lwe.rlwe_encode %cst_28 {encoding = #inverse_canonical_encoding1, ring = #ring_f64_1_x131072} : tensor<65536xf64> -> !pt |
| 55 | + %ct_30 = ckks.mul_plain %ct_27, %pt_29 : (!ct_L2, !pt) -> !ct_L2_1 |
| 56 | + %ct_31 = ckks.rescale %ct_30 {to_ring = #ring_rns_L1_1_x131072} : !ct_L2_1 -> !ct_L1 |
| 57 | + %ct_32 = ckks.add %ct_26, %ct_31 : (!ct_L1, !ct_L1) -> !ct_L1 |
| 58 | + %ct_33 = ckks.rotate %ct {offset = 6 : i32} : !ct_L2 |
| 59 | + %cst_34 = arith.constant dense<0.000000e+00> : tensor<65536xf64> |
| 60 | + %pt_35 = lwe.rlwe_encode %cst_34 {encoding = #inverse_canonical_encoding1, ring = #ring_f64_1_x131072} : tensor<65536xf64> -> !pt |
| 61 | + %ct_36 = ckks.mul_plain %ct_33, %pt_35 : (!ct_L2, !pt) -> !ct_L2_1 |
| 62 | + %ct_37 = ckks.rescale %ct_36 {to_ring = #ring_rns_L1_1_x131072} : !ct_L2_1 -> !ct_L1 |
| 63 | + %ct_38 = ckks.add %ct_32, %ct_37 : (!ct_L1, !ct_L1) -> !ct_L1 |
| 64 | + return %ct_38 : !ct_L1 |
| 65 | + } |
| 66 | +} |
0 commit comments