refactor: remove keys from BS and KS ops in LowLFHE

This commit is contained in:
youben11
2021-08-19 08:57:26 +01:00
committed by Quentin Bourgerie
parent d2a3214bba
commit b6c3eceadd
2 changed files with 18 additions and 10 deletions

View File

@@ -37,7 +37,7 @@ def NegateLweCiphertextOp : LowLFHE_Op<"negate_lwe_ciphertext"> {
def BootstrapLweOp : LowLFHE_Op<"bootstrap_lwe"> {
let arguments = (ins
LweBootstrapKeyType:$bootstrap_key,
// LweBootstrapKeyType:$bootstrap_key,
LweCiphertextType:$input_ciphertext,
GlweCiphertextType:$accumulator
);
@@ -87,7 +87,10 @@ def SetPlaintextListElementOp : LowLFHE_Op<"set_plaintext_list_element">{
}
def KeySwitchLweOp : LowLFHE_Op<"keyswitch_lwe"> {
let arguments = (ins LweKeySwitchKeyType:$keyswitch_key, LweCiphertextType:$ciphertext);
let arguments = (ins
// LweKeySwitchKeyType:$keyswitch_key,
LweCiphertextType:$ciphertext
);
let results = (outs LweCiphertextType:$result);
}
@@ -150,4 +153,9 @@ def ConstCleartextOp : LowLFHE_Op<"const_cleartext", [ConstantLike]> {
let results = (outs CleartextType:$cleartext);
}
def GlweFromTable : LowLFHE_Op<"glwe_from_table"> {
let arguments = (ins TensorOf<[AnyInteger]>:$table, I32Attr:$polynomialSize, I32Attr:$k);
let results = (outs GlweCiphertextType:$result);
}
#endif

View File

@@ -37,12 +37,12 @@ func @negate_lwe_ciphertext(%arg0: !LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.
return %1: !LowLFHE.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @bootstrap_lwe(%arg0: !LowLFHE.lwe_bootstrap_key, %arg1: !LowLFHE.lwe_ciphertext<2048,7>, %arg2: !LowLFHE.glwe_ciphertext) -> !LowLFHE.lwe_ciphertext<2048,7>
func @bootstrap_lwe(%arg0: !LowLFHE.lwe_bootstrap_key, %arg1: !LowLFHE.lwe_ciphertext<2048,7>, %arg2: !LowLFHE.glwe_ciphertext) -> !LowLFHE.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "LowLFHE.bootstrap_lwe"(%arg0, %arg1, %arg2) : (!LowLFHE.lwe_bootstrap_key, !LowLFHE.lwe_ciphertext<2048,7>, !LowLFHE.glwe_ciphertext) -> !LowLFHE.lwe_ciphertext<2048,7>
// CHECK-LABEL: func @bootstrap_lwe(%arg0: !LowLFHE.lwe_ciphertext<2048,7>, %arg1: !LowLFHE.glwe_ciphertext) -> !LowLFHE.lwe_ciphertext<2048,7>
func @bootstrap_lwe(%arg0: !LowLFHE.lwe_ciphertext<2048,7>, %arg1: !LowLFHE.glwe_ciphertext) -> !LowLFHE.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "LowLFHE.bootstrap_lwe"(%arg0, %arg1) : (!LowLFHE.lwe_ciphertext<2048,7>, !LowLFHE.glwe_ciphertext) -> !LowLFHE.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !LowLFHE.lwe_ciphertext<2048,7>
%1 = "LowLFHE.bootstrap_lwe"(%arg0, %arg1, %arg2): (!LowLFHE.lwe_bootstrap_key, !LowLFHE.lwe_ciphertext<2048,7>, !LowLFHE.glwe_ciphertext) -> (!LowLFHE.lwe_ciphertext<2048,7>)
%1 = "LowLFHE.bootstrap_lwe"(%arg0, %arg1): (!LowLFHE.lwe_ciphertext<2048,7>, !LowLFHE.glwe_ciphertext) -> (!LowLFHE.lwe_ciphertext<2048,7>)
return %1: !LowLFHE.lwe_ciphertext<2048,7>
}
@@ -100,12 +100,12 @@ func @set_plaintext_list_element(%arg0: !LowLFHE.plaintext_list, %arg1: index, %
return
}
// CHECK-LABEL: func @keyswitch_lwe(%arg0: !LowLFHE.lwe_key_switch_key, %arg1: !LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.lwe_ciphertext<2048,7>
func @keyswitch_lwe(%arg0: !LowLFHE.lwe_key_switch_key, %arg1: !LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "LowLFHE.keyswitch_lwe"(%arg0, %arg1) : (!LowLFHE.lwe_key_switch_key, !LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.lwe_ciphertext<2048,7>
// CHECK-LABEL: func @keyswitch_lwe(%arg0: !LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.lwe_ciphertext<2048,7>
func @keyswitch_lwe(%arg0: !LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "LowLFHE.keyswitch_lwe"(%arg0) : (!LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !LowLFHE.lwe_ciphertext<2048,7>
%1 = "LowLFHE.keyswitch_lwe"(%arg0, %arg1): (!LowLFHE.lwe_key_switch_key, !LowLFHE.lwe_ciphertext<2048,7>) -> (!LowLFHE.lwe_ciphertext<2048,7>)
%1 = "LowLFHE.keyswitch_lwe"(%arg0): (!LowLFHE.lwe_ciphertext<2048,7>) -> (!LowLFHE.lwe_ciphertext<2048,7>)
return %1: !LowLFHE.lwe_ciphertext<2048,7>
}