google / google/heir

lwe-add-client-interface: error when there is multiple input function

Open
#1,478 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
MLIR
Stars
906
Forks
171
Avg merge
4d 12h
Merged PRs (30d)
32

Description

For the following IR. `--lwe-add-client-interface` would complain the following. Seems that that pass tries to add client interface again on the newly created client interface.

```mlir
error: Func op has no RLWE ciphertext arguments
note: see current operation:
"func.func"() <{function_type = (tensor<8xi16>, .... sym_name = "dot_product__encrypt__arg0"}>
error: Failed to add client interface for func
```

```mlir
!Z1073750017_i64_ = !mod_arith.int<1073750017 : i64>
!Z16801793_i64_ = !mod_arith.int<16801793 : i64>
!Z65537_i64_ = !mod_arith.int<65537 : i64>
#full_crt_packing_encoding = #lwe.full_crt_packing_encoding
#key = #lwe.key<>
#modulus_chain_L1_C0_ = #lwe.modulus_chain, current = 0>
#modulus_chain_L1_C1_ = #lwe.modulus_chain, current = 1>
!rns_L0_ = !rns.rns
!rns_L1_ = !rns.rns
#ring_Z65537_i64_1_x8_ = #polynomial.ring>
#ring_rns_L0_1_x8_ = #polynomial.ring>
#ring_rns_L1_1_x8_ = #polynomial.ring>
#ciphertext_space_L0_ = #lwe.ciphertext_space
#ciphertext_space_L1_ = #lwe.ciphertext_space
!ct_L0_ = !lwe.new_lwe_ciphertext, plaintext_space = , ciphertext_space = #ciphertext_space_L0_, key = #key, modulus_chain = #modulus_chain_L1_C0_>
!ct_L1_ = !lwe.new_lwe_ciphertext>, plaintext_space = , ciphertext_space = #ciphertext_space_L1_, key = #key, modulus_chain = #modulus_chain_L1_C1_>
!ct_L1_1 = !lwe.new_lwe_ciphertext, plaintext_space = , ciphertext_space = #ciphertext_space_L1_, key = #key, modulus_chain = #modulus_chain_L1_C1_>
module attributes {bgv.schemeParam = #bgv.scheme_param, scheme.bgv} {
func.func @dot_product(%ct: !ct_L1_, %ct_0: !ct_L1_) -> !ct_L0_ attributes {mgmt.openfhe_params = #mgmt.openfhe_params} {
%c1 = arith.constant 1 : index
%ct_1 = bgv.extract %ct, %c1 : (!ct_L1_, index) -> !ct_L1_1
%ct_2 = bgv.modulus_switch %ct_1 {to_ring = #ring_rns_L0_1_x8_} : !ct_L1_1 -> !ct_L0_
return %ct_2 : !ct_L0_
}
func.func @dot_product_2(%ct: !ct_L1_, %ct_0: !ct_L1_) -> !ct_L0_ attributes {mgmt.openfhe_params = #mgmt.openfhe_params} {
%c1 = arith.constant 1 : index
%ct_1 = bgv.extract %ct, %c1 : (!ct_L1_, index) -> !ct_L1_1
%ct_2 = bgv.modulus_switch %ct_1 {to_ring = #ring_rns_L0_1_x8_} : !ct_L1_1 -> !ct_L0_
return %ct_2 : !ct_L0_
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.