chore(compiler): disable bitwidth check for table lookup

This commit is contained in:
youben11
2021-08-27 14:53:16 +01:00
committed by Quentin Bourgerie
parent 8aee5dd5c3
commit 50d2ff82af
4 changed files with 13 additions and 26 deletions

View File

@@ -107,14 +107,15 @@ bool verifyEncryptedIntegerInputsConsistency(::mlir::OpState &op,
"`ct` argument.";
return mlir::failure();
}
// Disable this check for the moment
// Check the witdh of the encrypted integer and the integer of the tabulated
// lambda are equals
if (ct.getWidth() != l_cst.getElementType().cast<IntegerType>().getWidth()) {
op.emitOpError()
<< " should have equals width beetwen the encrypted integer result and "
"integers of the `tabulated_lambda` argument";
return mlir::failure();
}
// if (ct.getWidth() != l_cst.getElementType().cast<IntegerType>().getWidth()) {
// op.emitOpError()
// << " should have equals width beetwen the encrypted integer result and "
// "integers of the `tabulated_lambda` argument";
// return mlir::failure();
// }
return mlir::success();
}

View File

@@ -123,13 +123,14 @@ mlir::LogicalResult verifyApplyLookupTable(ApplyLookupTable &op) {
"`ct` argument.";
return mlir::failure();
}
// Disable this check for the moment
// Check the witdh of the encrypted integer and the integer of the tabulated
// lambda are equals
if (result.getP() < l_cst.getElementType().cast<IntegerType>().getWidth()) {
op.emitOpError() << "should have the width of the constants less or equals "
"than the precision of the encrypted integer";
return mlir::failure();
}
// if (result.getP() < l_cst.getElementType().cast<IntegerType>().getWidth()) {
// op.emitOpError() << "should have the width of the constants less or equals "
// "than the precision of the encrypted integer";
// return mlir::failure();
// }
return mlir::success();
}

View File

@@ -1,7 +0,0 @@
// RUN: not zamacompiler %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'HLFHE.apply_lookup_table' op should have equals width beetwen the encrypted integer result and integers of the `tabulated_lambda` argument
func @apply_lookup_table(%arg0: !HLFHE.eint<2>, %arg1: tensor<4xi3>) -> !HLFHE.eint<2> {
%1 = "HLFHE.apply_lookup_table"(%arg0, %arg1): (!HLFHE.eint<2>, tensor<4xi3>) -> (!HLFHE.eint<2>)
return %1: !HLFHE.eint<2>
}

View File

@@ -7,11 +7,3 @@ func @apply_lookup_table(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>, %arg1: tensor<4x
return %1: !MidLFHE.glwe<{512,10,64}{2}>
}
// -----
// Bad dimension of integer in the lookup table
func @apply_lookup_table(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>, %arg1: tensor<128xi3>) -> !MidLFHE.glwe<{512,10,64}{2}> {
// expected-error @+1 {{'MidLFHE.apply_lookup_table' op should have the width of the constants less or equals than the precision of the encrypted integer}}
%1 = "MidLFHE.apply_lookup_table"(%arg0, %arg1) {k = 1 : i32, polynomialSize = 1024 : i32, levelKS = 2 : i32, baseLogKS = -82 : i32, levelBS = 3 : i32, baseLogBS = -83 : i32}: (!MidLFHE.glwe<{1024,12,64}{7}>, tensor<128xi3>) -> (!MidLFHE.glwe<{512,10,64}{2}>)
return %1: !MidLFHE.glwe<{512,10,64}{2}>
}