mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 20:25:34 -05:00
feat(compiler): parameterize pbs ops via attr
This commit is contained in:
committed by
Quentin Bourgerie
parent
55043c24f1
commit
7104e2600c
@@ -5,6 +5,7 @@
|
||||
#include <mlir/IR/BuiltinTypes.h>
|
||||
#include <mlir/Interfaces/SideEffectInterfaces.h>
|
||||
#include <mlir/Interfaces/ControlFlowInterfaces.h>
|
||||
#include <mlir/IR/Builders.h>
|
||||
|
||||
|
||||
#include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h"
|
||||
|
||||
@@ -45,7 +45,7 @@ def PBSRegion : Region<
|
||||
"pbs region needs one block with one any integer argument">;
|
||||
|
||||
def PBSOp : MidLFHE_Op<"pbs"> {
|
||||
let arguments = (ins CipherTextType:$x);
|
||||
let arguments = (ins CipherTextType:$x, I32Attr:$big_n, I32Attr:$log_noise, I32Attr:$base_log, I32Attr:$level);
|
||||
let results = (outs CipherTextType:$result);
|
||||
let regions = (region PBSRegion:$region);
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ func @pbs_ciphertext(%arg0: !MidLFHE.ciphertext, %arg1: i32) -> !MidLFHE.ciphert
|
||||
// CHECK-NEXT: ^bb0(%[[V2:.*]]: i32): // no predecessors
|
||||
// CHECK-NEXT: %[[V4:.*]] = divi_unsigned %[[V2]], %arg1 : i32
|
||||
// CHECK-NEXT: "MidLFHE.pbs_return"(%[[V4]]) : (i32) -> ()
|
||||
// CHECK-NEXT: }) : (!MidLFHE.ciphertext) -> !MidLFHE.ciphertext
|
||||
// CHECK-NEXT: }) {base_log = 8 : i32, big_n = 1024 : i32, level = 2 : i32, log_noise = -20 : i32} : (!MidLFHE.ciphertext) -> !MidLFHE.ciphertext
|
||||
// CHECK-NEXT: return %[[V1]] : !MidLFHE.ciphertext
|
||||
%0 = "MidLFHE.pbs"(%arg0)({
|
||||
^bb0(%a:i32):
|
||||
%1 = std.divi_unsigned %a, %arg1 : i32
|
||||
"MidLFHE.pbs_return"(%1) : (i32) -> ()
|
||||
}) : (!MidLFHE.ciphertext) -> !MidLFHE.ciphertext
|
||||
}){big_n=1024: i32, log_noise=-20: i32, base_log=8 : i32, level=2 : i32} : (!MidLFHE.ciphertext) -> !MidLFHE.ciphertext
|
||||
|
||||
return %0 : !MidLFHE.ciphertext
|
||||
}
|
||||
Reference in New Issue
Block a user