feat(compiler): Add verifier to TFHE.encode_expand_lut_for_bootstrap

This commit is contained in:
Andi Drebes
2024-01-29 11:55:25 +01:00
parent ea07239732
commit 8d71dc2028
2 changed files with 20 additions and 0 deletions

View File

@@ -100,6 +100,8 @@ def TFHE_EncodeExpandLutForBootstrapOp : TFHE_Op<"encode_expand_lut_for_bootstra
);
let results = (outs 1DTensorOf<[I64]> : $result);
let hasVerifier = 1;
}
def TFHE_EncodeLutForCrtWopPBSOp : TFHE_Op<"encode_lut_for_crt_woppbs", [Pure]> {

View File

@@ -117,6 +117,24 @@ mlir::LogicalResult MulGLWEIntOp::verify() {
*this);
}
mlir::LogicalResult EncodeExpandLutForBootstrapOp::verify() {
mlir::IntegerAttr polySizeAttr = this->getPolySizeAttr();
mlir::RankedTensorType rtt =
this->getResult().getType().template cast<mlir::RankedTensorType>();
if (rtt.getNumElements() != polySizeAttr.getInt()) {
this->emitError("The number of elements of the output tensor of ")
<< rtt.getNumElements()
<< " does not match the size of the polynomial of "
<< polySizeAttr.getInt();
return mlir::failure();
}
return mlir::success();
}
template <typename BootstrapOpT>
mlir::LogicalResult verifyBootstrapSingleLUTConstraints(BootstrapOpT &op) {
GLWEBootstrapKeyAttr keyAttr = op.getKeyAttr();