mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-10 04:35:03 -05:00
fix(compiler/lowlfhe): Fix wrong shift value for EncodeIntOp lowering
That's work before because we enfoce 6 as global constraint while our runJit tests are on 7 bits
This commit is contained in:
@@ -149,8 +149,7 @@ struct LowLFHEEncodeIntOpPattern
|
||||
mlir::Value castedInt = rewriter.create<mlir::ZeroExtendIOp>(
|
||||
op.getLoc(), rewriter.getIntegerType(64), op->getOperands().front());
|
||||
mlir::Value constantShiftOp = rewriter.create<mlir::ConstantOp>(
|
||||
op.getLoc(),
|
||||
rewriter.getI64IntegerAttr(64 - (op.getType().getP() - 1)));
|
||||
op.getLoc(), rewriter.getI64IntegerAttr(64 - op.getType().getP()));
|
||||
|
||||
mlir::Type resultType = rewriter.getIntegerType(64);
|
||||
rewriter.replaceOpWithNewOp<mlir::ShiftLeftOp>(op, resultType, castedInt,
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace mlir {
|
||||
namespace zamalang {
|
||||
|
||||
// This is temporary while we doesn't yet have the high-level verification pass
|
||||
FHECircuitConstraint defaultGlobalFHECircuitConstraint{.norm2 = 20, .p = 6};
|
||||
FHECircuitConstraint defaultGlobalFHECircuitConstraint{.norm2 = 10, .p = 7};
|
||||
|
||||
void initLLVMNativeTarget() {
|
||||
// Initialize LLVM targets.
|
||||
|
||||
@@ -119,7 +119,7 @@ V0Parameter *getV0Parameter(size_t norm, size_t p) {
|
||||
if (norm > NORM2_MAX) {
|
||||
return nullptr;
|
||||
}
|
||||
if (p >= P_MAX) {
|
||||
if (p > P_MAX) {
|
||||
return nullptr;
|
||||
}
|
||||
// - 1 is an offset as norm and p are in [1, ...] and not [0, ...]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// RUN: zamacompiler %s --run-jit --jit-args 2 2>&1| FileCheck %s
|
||||
// RUN: zamacompiler %s --run-jit --jit-args 3 2>&1| FileCheck %s
|
||||
|
||||
// CHECK-LABEL: 3
|
||||
// CHECK-LABEL: 42
|
||||
func @main(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = constant 45 : i8
|
||||
%1 = "HLFHE.sub_int_eint"(%0, %arg0): (i8, !HLFHE.eint<7>) -> (!HLFHE.eint<7>)
|
||||
return %1: !HLFHE.eint<7>
|
||||
}
|
||||
Reference in New Issue
Block a user