mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
feat: parameterize KS operation
This commit is contained in:
committed by
Quentin Bourgerie
parent
14f171bef9
commit
6e2ac3af4e
@@ -185,10 +185,23 @@ mlir::Value createPBS(mlir::PatternRewriter rewriter, mlir::Location loc,
|
||||
|
||||
// keyswitch
|
||||
auto ct_type = ct.getType().cast<GLWECipherTextType>();
|
||||
mlir::SmallVector<mlir::Value, 1> ksArgs{ct};
|
||||
mlir::SmallVector<mlir::NamedAttribute, 6> ksAttrs{
|
||||
mlir::NamedAttribute(
|
||||
mlir::Identifier::get("inputLweSize", rewriter.getContext()), k),
|
||||
// TODO: get the actual output size
|
||||
mlir::NamedAttribute(
|
||||
mlir::Identifier::get("outputLweSize", rewriter.getContext()), k),
|
||||
mlir::NamedAttribute(
|
||||
mlir::Identifier::get("level", rewriter.getContext()), levelKS),
|
||||
mlir::NamedAttribute(
|
||||
mlir::Identifier::get("baseLog", rewriter.getContext()), baseLogKS),
|
||||
};
|
||||
mlir::Value keyswitched =
|
||||
rewriter
|
||||
.create<mlir::zamalang::LowLFHE::KeySwitchLweOp>(
|
||||
loc, convertTypeGLWEToLWE(rewriter.getContext(), ct_type), ct)
|
||||
loc, convertTypeGLWEToLWE(rewriter.getContext(), ct_type), ksArgs,
|
||||
ksAttrs)
|
||||
.result();
|
||||
|
||||
// convert result type
|
||||
|
||||
@@ -93,7 +93,11 @@ def SetPlaintextListElementOp : LowLFHE_Op<"set_plaintext_list_element">{
|
||||
def KeySwitchLweOp : LowLFHE_Op<"keyswitch_lwe"> {
|
||||
let arguments = (ins
|
||||
// LweKeySwitchKeyType:$keyswitch_key,
|
||||
LweCiphertextType:$ciphertext
|
||||
LweCiphertextType:$ciphertext,
|
||||
I32Attr:$inputLweSize,
|
||||
I32Attr:$outputLweSize,
|
||||
I32Attr:$level,
|
||||
I32Attr:$baseLog
|
||||
);
|
||||
let results = (outs LweCiphertextType:$result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user