mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
chore: update to LLVM 8b7cc93e
major changes: - https://llvm.discourse.group/t/psa-removed-arithmetic-ops-from-standard/4455 - use add_mlir_public_c_api_library helper to correctly add a CAPI library
This commit is contained in:
@@ -47,7 +47,7 @@ def LowLFHEUnparametrize : Pass<"lowlfhe-unparametrize", "mlir::ModuleOp"> {
|
||||
def MLIRLowerableDialectsToLLVM : Pass<"mlir-lowerable-dialects-to-llvm", "mlir::ModuleOp"> {
|
||||
let summary = "Lowers operations from MLIR lowerable dialects to LLVM";
|
||||
let constructor = "mlir::zamalang::createConvertMLIRLowerableDialectsToLLVMPass()";
|
||||
let dependentDialects = ["mlir::StandardOpsDialect", "mlir::scf::SCFDialect", "mlir::LLVM::LLVMDialect"];
|
||||
let dependentDialects = ["mlir::StandardOpsDialect", "mlir::arith::ArithmeticDialect", "mlir::scf::SCFDialect", "mlir::LLVM::LLVMDialect"];
|
||||
let options = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
set(LLVM_OPTIONAL_SOURCES HLFHE.cpp)
|
||||
|
||||
add_mlir_library(ZAMALANGCAPIHLFHE
|
||||
add_mlir_public_c_api_library(ZAMALANGCAPIHLFHE
|
||||
|
||||
HLFHE.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${MLIR_MAIN_INCLUDE_DIR}/mlir-c
|
||||
|
||||
LINK_LIBS PUBLIC
|
||||
MLIRCAPIIR
|
||||
HLFHEDialect
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
set(LLVM_OPTIONAL_SOURCES CompilerEngine.cpp)
|
||||
|
||||
add_mlir_library(ZAMALANGCAPISupport
|
||||
add_mlir_public_c_api_library(ZAMALANGCAPISupport
|
||||
|
||||
CompilerEngine.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${MLIR_MAIN_INCLUDE_DIR}/mlir-c
|
||||
CompilerEngine.cpp
|
||||
|
||||
LINK_LIBS PUBLIC
|
||||
MLIRCAPIIR
|
||||
|
||||
@@ -112,7 +112,7 @@ struct DotToLinalgGeneric : public ::mlir::RewritePattern {
|
||||
// element and use it as a replacement for the result of the dot
|
||||
// operation
|
||||
mlir::Value idx0 =
|
||||
rewriter.create<mlir::ConstantIndexOp>(dotOp.getLoc(), 0);
|
||||
rewriter.create<mlir::arith::ConstantIndexOp>(dotOp.getLoc(), 0);
|
||||
llvm::SmallVector<mlir::Value, 1> indexes{idx0};
|
||||
mlir::Value res = rewriter.create<mlir::tensor::ExtractOp>(
|
||||
dotOp.getLoc(), gop.getResult(0), indexes);
|
||||
@@ -360,6 +360,7 @@ void HLFHETensorOpsToLinalg::runOnFunction() {
|
||||
target.addLegalDialect<mlir::memref::MemRefDialect>();
|
||||
target.addLegalDialect<mlir::zamalang::HLFHE::HLFHEDialect>();
|
||||
target.addLegalDialect<mlir::tensor::TensorDialect>();
|
||||
target.addLegalDialect<mlir::arith::ArithmeticDialect>();
|
||||
target.addIllegalOp<mlir::zamalang::HLFHE::Dot>();
|
||||
target.addIllegalDialect<mlir::zamalang::HLFHELinalg::HLFHELinalgDialect>();
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ mlir::LogicalResult insertForwardDeclarations(mlir::Operation *op,
|
||||
/// ```
|
||||
/// to
|
||||
/// ```
|
||||
/// err = constant 0 : i64
|
||||
/// err = arith.constant 0 : i64
|
||||
/// call_op(err, out, arg0, arg1);
|
||||
/// ```
|
||||
template <typename Op>
|
||||
@@ -350,10 +350,10 @@ struct LowLFHEOpToConcreteCAPICallPattern : public mlir::OpRewritePattern<Op> {
|
||||
// Replace the operation with a call to the `funcName`
|
||||
{
|
||||
// Create the err value
|
||||
auto errOp = rewriter.create<mlir::ConstantOp>(op.getLoc(),
|
||||
rewriter.getIndexAttr(0));
|
||||
auto errOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), rewriter.getIndexAttr(0));
|
||||
// Add the call to the allocation
|
||||
auto lweSizeOp = rewriter.create<mlir::ConstantOp>(
|
||||
auto lweSizeOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), rewriter.getIndexAttr(lweResultType.getSize()));
|
||||
mlir::SmallVector<mlir::Value> allocOperands{errOp, lweSizeOp};
|
||||
auto allocGeneric = rewriter.create<mlir::CallOp>(
|
||||
@@ -411,10 +411,10 @@ struct LowLFHEZeroOpPattern
|
||||
auto lweResultType =
|
||||
resultType.cast<mlir::zamalang::LowLFHE::LweCiphertextType>();
|
||||
// Create the err value
|
||||
auto errOp = rewriter.create<mlir::ConstantOp>(op.getLoc(),
|
||||
rewriter.getIndexAttr(0));
|
||||
auto errOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), rewriter.getIndexAttr(0));
|
||||
// Allocate a fresh new ciphertext
|
||||
auto lweSizeOp = rewriter.create<mlir::ConstantOp>(
|
||||
auto lweSizeOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), rewriter.getIndexAttr(lweResultType.getSize()));
|
||||
mlir::SmallVector<mlir::Value> allocOperands{errOp, lweSizeOp};
|
||||
auto allocGeneric = rewriter.create<mlir::CallOp>(
|
||||
@@ -439,14 +439,14 @@ struct LowLFHEEncodeIntOpPattern
|
||||
matchAndRewrite(mlir::zamalang::LowLFHE::EncodeIntOp op,
|
||||
mlir::PatternRewriter &rewriter) const override {
|
||||
{
|
||||
mlir::Value castedInt = rewriter.create<mlir::ZeroExtendIOp>(
|
||||
mlir::Value castedInt = rewriter.create<mlir::arith::ExtUIOp>(
|
||||
op.getLoc(), rewriter.getIntegerType(64), op->getOperands().front());
|
||||
mlir::Value constantShiftOp = rewriter.create<mlir::ConstantOp>(
|
||||
mlir::Value constantShiftOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), rewriter.getI64IntegerAttr(64 - op.getType().getP()));
|
||||
|
||||
mlir::Type resultType = rewriter.getIntegerType(64);
|
||||
rewriter.replaceOpWithNewOp<mlir::ShiftLeftOp>(op, resultType, castedInt,
|
||||
constantShiftOp);
|
||||
rewriter.replaceOpWithNewOp<mlir::arith::ShLIOp>(
|
||||
op, resultType, castedInt, constantShiftOp);
|
||||
}
|
||||
return mlir::success();
|
||||
};
|
||||
@@ -462,7 +462,7 @@ struct LowLFHEIntToCleartextOpPattern
|
||||
mlir::LogicalResult
|
||||
matchAndRewrite(mlir::zamalang::LowLFHE::IntToCleartextOp op,
|
||||
mlir::PatternRewriter &rewriter) const override {
|
||||
mlir::Value castedInt = rewriter.replaceOpWithNewOp<mlir::ZeroExtendIOp>(
|
||||
mlir::Value castedInt = rewriter.replaceOpWithNewOp<mlir::arith::ExtUIOp>(
|
||||
op, rewriter.getIntegerType(64), op->getOperands().front());
|
||||
return mlir::success();
|
||||
};
|
||||
@@ -507,12 +507,12 @@ struct GlweFromTableOpPattern
|
||||
}
|
||||
}
|
||||
|
||||
auto errOp = rewriter.create<mlir::ConstantOp>(op.getLoc(),
|
||||
rewriter.getIndexAttr(0));
|
||||
auto errOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), rewriter.getIndexAttr(0));
|
||||
// allocate two glwe to build accumulator
|
||||
auto glweSizeOp =
|
||||
rewriter.create<mlir::ConstantOp>(op.getLoc(), op->getAttr("k"));
|
||||
auto polySizeOp = rewriter.create<mlir::ConstantOp>(
|
||||
rewriter.create<mlir::arith::ConstantOp>(op.getLoc(), op->getAttr("k"));
|
||||
auto polySizeOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), op->getAttr("polynomialSize"));
|
||||
mlir::SmallVector<mlir::Value> allocGlweOperands{errOp, glweSizeOp,
|
||||
polySizeOp};
|
||||
@@ -536,11 +536,11 @@ struct GlweFromTableOpPattern
|
||||
op->getOperandTypes().front().cast<mlir::RankedTensorType>();
|
||||
assert(rankedTensorType.getRank() == 1 &&
|
||||
"table lookup must be of a single dimension");
|
||||
auto sizeOp = rewriter.create<mlir::ConstantOp>(
|
||||
auto sizeOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(),
|
||||
rewriter.getI64IntegerAttr(rankedTensorType.getDimSize(0)));
|
||||
auto precisionOp =
|
||||
rewriter.create<mlir::ConstantOp>(op.getLoc(), op->getAttr("p"));
|
||||
rewriter.create<mlir::arith::ConstantOp>(op.getLoc(), op->getAttr("p"));
|
||||
mlir::SmallVector<mlir::Value> ForeignPlaintextListOperands{
|
||||
errOp, op->getOperand(0), sizeOp, precisionOp};
|
||||
auto foreignPlaintextListOp = rewriter.create<mlir::CallOp>(
|
||||
@@ -583,11 +583,11 @@ struct LowLFHEBootstrapLweOpPattern
|
||||
auto resultType = op->getResultTypes().front();
|
||||
auto bstOutputSize =
|
||||
resultType.cast<mlir::zamalang::LowLFHE::LweCiphertextType>().getSize();
|
||||
auto errOp = rewriter.create<mlir::ConstantOp>(op.getLoc(),
|
||||
rewriter.getIndexAttr(0));
|
||||
auto errOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), rewriter.getIndexAttr(0));
|
||||
// allocate the result lwe ciphertext, should be of a generic type, to cast
|
||||
// before return
|
||||
auto lweSizeOp = rewriter.create<mlir::ConstantOp>(
|
||||
auto lweSizeOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), rewriter.getIndexAttr(bstOutputSize));
|
||||
mlir::SmallVector<mlir::Value> allocLweCtOperands{errOp, lweSizeOp};
|
||||
auto allocateGenericLweCtOp = rewriter.create<mlir::CallOp>(
|
||||
@@ -640,11 +640,11 @@ struct LowLFHEKeySwitchLweOpPattern
|
||||
mlir::LogicalResult
|
||||
matchAndRewrite(mlir::zamalang::LowLFHE::KeySwitchLweOp op,
|
||||
mlir::PatternRewriter &rewriter) const override {
|
||||
auto errOp = rewriter.create<mlir::ConstantOp>(op.getLoc(),
|
||||
rewriter.getIndexAttr(0));
|
||||
auto errOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(), rewriter.getIndexAttr(0));
|
||||
// allocate the result lwe ciphertext, should be of a generic type, to cast
|
||||
// before return
|
||||
auto lweSizeOp = rewriter.create<mlir::ConstantOp>(
|
||||
auto lweSizeOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
op.getLoc(),
|
||||
rewriter.getIndexAttr(
|
||||
op->getAttr("outputLweSize").cast<mlir::IntegerAttr>().getInt()));
|
||||
@@ -717,7 +717,8 @@ void LowLFHEToConcreteCAPIPass::runOnOperation() {
|
||||
mlir::ConversionTarget target(getContext());
|
||||
target.addIllegalDialect<mlir::zamalang::LowLFHE::LowLFHEDialect>();
|
||||
target.addLegalDialect<mlir::BuiltinDialect, mlir::StandardOpsDialect,
|
||||
mlir::memref::MemRefDialect>();
|
||||
mlir::memref::MemRefDialect,
|
||||
mlir::arith::ArithmeticDialect>();
|
||||
|
||||
// Setup rewrite patterns
|
||||
mlir::RewritePatternSet patterns(&getContext());
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
|
||||
#include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
|
||||
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
|
||||
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
|
||||
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
|
||||
@@ -54,6 +55,8 @@ void MLIRLowerableDialectsToLLVMPass::runOnOperation() {
|
||||
mlir::RewritePatternSet patterns(&getContext());
|
||||
mlir::populateLoopToStdConversionPatterns(patterns);
|
||||
mlir::populateStdToLLVMConversionPatterns(typeConverter, patterns);
|
||||
mlir::arith::populateArithmeticToLLVMConversionPatterns(typeConverter,
|
||||
patterns);
|
||||
mlir::populateMemRefToLLVMConversionPatterns(typeConverter, patterns);
|
||||
|
||||
// Apply a `FullConversion` to `llvm`.
|
||||
|
||||
@@ -148,8 +148,8 @@ struct MidLFHEApplyLookupTablePaddingPattern
|
||||
op.getType().cast<mlir::zamalang::MidLFHE::GLWECipherTextType>();
|
||||
auto expectedSize = 1 << glweInType.getP();
|
||||
if (tabulatedLambdaType.getShape()[0] < expectedSize) {
|
||||
auto constantOp =
|
||||
mlir::dyn_cast_or_null<mlir::ConstantOp>(op.l_cst().getDefiningOp());
|
||||
auto constantOp = mlir::dyn_cast_or_null<mlir::arith::ConstantOp>(
|
||||
op.l_cst().getDefiningOp());
|
||||
if (constantOp == nullptr) {
|
||||
op.emitError() << "padding for non-constant operator is NYI";
|
||||
return mlir::failure();
|
||||
@@ -174,8 +174,8 @@ struct MidLFHEApplyLookupTablePaddingPattern
|
||||
{expectedSize}, rewriter.getIntegerType(integerSize));
|
||||
auto newDenseVals =
|
||||
mlir::DenseIntElementsAttr::get(newDenseValsType, rawNewDenseVals);
|
||||
auto newConstantOp =
|
||||
rewriter.create<mlir::ConstantOp>(constantOp.getLoc(), newDenseVals);
|
||||
auto newConstantOp = rewriter.create<mlir::arith::ConstantOp>(
|
||||
constantOp.getLoc(), newDenseVals);
|
||||
// Replace the apply_lookup_table with the new constant
|
||||
mlir::SmallVector<mlir::Type> newResultTypes{op.getType()};
|
||||
llvm::SmallVector<mlir::Value> newOperands{op.ct(), newConstantOp};
|
||||
@@ -227,7 +227,7 @@ void populateWithMidLFHEApplyLookupTableParametrizationPattern(
|
||||
void populateWithMidLFHEApplyLookupTablePaddingPattern(
|
||||
mlir::RewritePatternSet &patterns, mlir::ConversionTarget &target) {
|
||||
patterns.add<MidLFHEApplyLookupTablePaddingPattern>(patterns.getContext());
|
||||
target.addLegalOp<mlir::ConstantOp>();
|
||||
target.addLegalOp<mlir::arith::ConstantOp>();
|
||||
target.addDynamicallyLegalOp<mlir::zamalang::MidLFHE::ApplyLookupTable>(
|
||||
[&](mlir::zamalang::MidLFHE::ApplyLookupTable op) {
|
||||
auto glweInType =
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <llvm/ADT/Optional.h>
|
||||
#include <llvm/ADT/SmallString.h>
|
||||
#include <mlir/Analysis/DataFlowAnalysis.h>
|
||||
#include <mlir/Dialect/Arithmetic/IR/Arithmetic.h>
|
||||
#include <mlir/Dialect/StandardOps/IR/Ops.h>
|
||||
#include <mlir/Dialect/Tensor/IR/Tensor.h>
|
||||
#include <mlir/IR/Attributes.h>
|
||||
@@ -210,7 +211,7 @@ static std::string APIntToStringValUnsigned(const llvm::APInt &i) {
|
||||
// Calculates the square of the 2-norm of a tensor initialized with a
|
||||
// dense matrix of constant, signless integers. Aborts if the value
|
||||
// type or initialization of of `cstOp` is incorrect.
|
||||
static llvm::APInt denseCstTensorNorm2Sq(mlir::ConstantOp cstOp) {
|
||||
static llvm::APInt denseCstTensorNorm2Sq(mlir::arith::ConstantOp cstOp) {
|
||||
mlir::DenseIntElementsAttr denseVals =
|
||||
cstOp->getAttrOfType<mlir::DenseIntElementsAttr>("value");
|
||||
|
||||
@@ -272,8 +273,9 @@ static llvm::APInt getSqMANP(
|
||||
"Only dot operations with tensors that are function arguments are "
|
||||
"currently supported");
|
||||
|
||||
mlir::ConstantOp cstOp = llvm::dyn_cast_or_null<mlir::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
mlir::arith::ConstantOp cstOp =
|
||||
llvm::dyn_cast_or_null<mlir::arith::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
|
||||
if (cstOp) {
|
||||
// Dot product between a vector of encrypted integers and a vector
|
||||
@@ -320,8 +322,9 @@ static llvm::APInt getSqMANP(
|
||||
operandMANPs[0]->getValue().getMANP().hasValue() &&
|
||||
"Missing squared Minimal Arithmetic Noise Padding for encrypted operand");
|
||||
|
||||
mlir::ConstantOp cstOp = llvm::dyn_cast_or_null<mlir::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
mlir::arith::ConstantOp cstOp =
|
||||
llvm::dyn_cast_or_null<mlir::arith::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
|
||||
llvm::APInt eNorm = operandMANPs[0]->getValue().getMANP().getValue();
|
||||
llvm::APInt sqNorm;
|
||||
@@ -374,8 +377,9 @@ static llvm::APInt getSqMANP(
|
||||
llvm::APInt eNorm = operandMANPs[1]->getValue().getMANP().getValue();
|
||||
llvm::APInt sqNorm;
|
||||
|
||||
mlir::ConstantOp cstOp = llvm::dyn_cast_or_null<mlir::ConstantOp>(
|
||||
op->getOpOperand(0).get().getDefiningOp());
|
||||
mlir::arith::ConstantOp cstOp =
|
||||
llvm::dyn_cast_or_null<mlir::arith::ConstantOp>(
|
||||
op->getOpOperand(0).get().getDefiningOp());
|
||||
|
||||
if (cstOp) {
|
||||
// For constant plaintext operands simply use the constant value
|
||||
@@ -404,8 +408,9 @@ static llvm::APInt getSqMANP(
|
||||
operandMANPs[0]->getValue().getMANP().hasValue() &&
|
||||
"Missing squared Minimal Arithmetic Noise Padding for encrypted operand");
|
||||
|
||||
mlir::ConstantOp cstOp = llvm::dyn_cast_or_null<mlir::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
mlir::arith::ConstantOp cstOp =
|
||||
llvm::dyn_cast_or_null<mlir::arith::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
|
||||
llvm::APInt eNorm = operandMANPs[0]->getValue().getMANP().getValue();
|
||||
llvm::APInt sqNorm;
|
||||
@@ -445,8 +450,9 @@ static llvm::APInt getSqMANP(
|
||||
llvm::APInt eNorm = operandMANPs[0]->getValue().getMANP().getValue();
|
||||
llvm::APInt sqNorm;
|
||||
|
||||
mlir::ConstantOp cstOp = llvm::dyn_cast_or_null<mlir::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
mlir::arith::ConstantOp cstOp =
|
||||
llvm::dyn_cast_or_null<mlir::arith::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
mlir::DenseIntElementsAttr denseVals =
|
||||
cstOp ? cstOp->getAttrOfType<mlir::DenseIntElementsAttr>("value")
|
||||
: nullptr;
|
||||
@@ -507,8 +513,9 @@ static llvm::APInt getSqMANP(
|
||||
llvm::APInt eNorm = operandMANPs[1]->getValue().getMANP().getValue();
|
||||
llvm::APInt sqNorm;
|
||||
|
||||
mlir::ConstantOp cstOp = llvm::dyn_cast_or_null<mlir::ConstantOp>(
|
||||
op->getOpOperand(0).get().getDefiningOp());
|
||||
mlir::arith::ConstantOp cstOp =
|
||||
llvm::dyn_cast_or_null<mlir::arith::ConstantOp>(
|
||||
op->getOpOperand(0).get().getDefiningOp());
|
||||
mlir::DenseIntElementsAttr denseVals =
|
||||
cstOp ? cstOp->getAttrOfType<mlir::DenseIntElementsAttr>("value")
|
||||
: nullptr;
|
||||
@@ -553,8 +560,9 @@ static llvm::APInt getSqMANP(
|
||||
llvm::APInt eNorm = operandMANPs[0]->getValue().getMANP().getValue();
|
||||
llvm::APInt sqNorm;
|
||||
|
||||
mlir::ConstantOp cstOp = llvm::dyn_cast_or_null<mlir::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
mlir::arith::ConstantOp cstOp =
|
||||
llvm::dyn_cast_or_null<mlir::arith::ConstantOp>(
|
||||
op->getOpOperand(1).get().getDefiningOp());
|
||||
mlir::DenseIntElementsAttr denseVals =
|
||||
cstOp ? cstOp->getAttrOfType<mlir::DenseIntElementsAttr>("value")
|
||||
: nullptr;
|
||||
@@ -734,7 +742,7 @@ struct MANPAnalysis : public mlir::ForwardDataFlowAnalysis<MANPLatticeValue> {
|
||||
}
|
||||
}
|
||||
|
||||
else if (llvm::isa<mlir::ConstantOp>(op)) {
|
||||
else if (llvm::isa<mlir::arith::ConstantOp>(op)) {
|
||||
isDummy = true;
|
||||
} else if (llvm::isa<mlir::zamalang::HLFHE::HLFHEDialect>(
|
||||
*op->getDialect())) {
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
// CHECK-LABEL: func @add_eint_int(%arg0: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}>
|
||||
func @add_eint_int(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i8
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
|
||||
// CHECK-NEXT: %[[V2:.*]] = "MidLFHE.add_glwe_int"(%arg0, %[[V1]]) : (!MidLFHE.glwe<{_,_,_}{7}>, i8) -> !MidLFHE.glwe<{_,_,_}{7}>
|
||||
// CHECK-NEXT: return %[[V2]] : !MidLFHE.glwe<{_,_,_}{7}>
|
||||
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
%1 = "HLFHE.add_eint_int"(%arg0, %0): (!HLFHE.eint<7>, i8) -> (!HLFHE.eint<7>)
|
||||
return %1: !HLFHE.eint<7>
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
// CHECK-LABEL: func @apply_lookup_table_cst(%arg0: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}>
|
||||
func @apply_lookup_table_cst(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> {
|
||||
// CHECK-NEXT: %[[TABLE:.*]] = constant dense<"0x00000000000000000100000000000000020000000000000003000000000000000400000000000000050000000000000006000000000000000700000000000000080000000000000009000000000000000A000000000000000B000000000000000C000000000000000D000000000000000E000000000000000F0000000000000010000000000000001100000000000000120000000000000013000000000000001400000000000000150000000000000016000000000000001700000000000000180000000000000019000000000000001A000000000000001B000000000000001C000000000000001D000000000000001E000000000000001F0000000000000020000000000000002100000000000000220000000000000023000000000000002400000000000000250000000000000026000000000000002700000000000000280000000000000029000000000000002A000000000000002B000000000000002C000000000000002D000000000000002E000000000000002F0000000000000030000000000000003100000000000000320000000000000033000000000000003400000000000000350000000000000036000000000000003700000000000000380000000000000039000000000000003A000000000000003B000000000000003C000000000000003D000000000000003E000000000000003F0000000000000040000000000000004100000000000000420000000000000043000000000000004400000000000000450000000000000046000000000000004700000000000000480000000000000049000000000000004A000000000000004B000000000000004C000000000000004D000000000000004E000000000000004F0000000000000050000000000000005100000000000000520000000000000053000000000000005400000000000000550000000000000056000000000000005700000000000000580000000000000059000000000000005A000000000000005B000000000000005C000000000000005D000000000000005E000000000000005F0000000000000060000000000000006100000000000000620000000000000063000000000000006400000000000000650000000000000066000000000000006700000000000000680000000000000069000000000000006A000000000000006B000000000000006C000000000000006D000000000000006E000000000000006F0000000000000070000000000000007100000000000000720000000000000073000000000000007400000000000000750000000000000076000000000000007700000000000000780000000000000079000000000000007A000000000000007B000000000000007C000000000000007D000000000000007E000000000000007F00000000000000"> : tensor<128xi64>
|
||||
// CHECK-NEXT: %[[TABLE:.*]] = arith.constant dense<"0x00000000000000000100000000000000020000000000000003000000000000000400000000000000050000000000000006000000000000000700000000000000080000000000000009000000000000000A000000000000000B000000000000000C000000000000000D000000000000000E000000000000000F0000000000000010000000000000001100000000000000120000000000000013000000000000001400000000000000150000000000000016000000000000001700000000000000180000000000000019000000000000001A000000000000001B000000000000001C000000000000001D000000000000001E000000000000001F0000000000000020000000000000002100000000000000220000000000000023000000000000002400000000000000250000000000000026000000000000002700000000000000280000000000000029000000000000002A000000000000002B000000000000002C000000000000002D000000000000002E000000000000002F0000000000000030000000000000003100000000000000320000000000000033000000000000003400000000000000350000000000000036000000000000003700000000000000380000000000000039000000000000003A000000000000003B000000000000003C000000000000003D000000000000003E000000000000003F0000000000000040000000000000004100000000000000420000000000000043000000000000004400000000000000450000000000000046000000000000004700000000000000480000000000000049000000000000004A000000000000004B000000000000004C000000000000004D000000000000004E000000000000004F0000000000000050000000000000005100000000000000520000000000000053000000000000005400000000000000550000000000000056000000000000005700000000000000580000000000000059000000000000005A000000000000005B000000000000005C000000000000005D000000000000005E000000000000005F0000000000000060000000000000006100000000000000620000000000000063000000000000006400000000000000650000000000000066000000000000006700000000000000680000000000000069000000000000006A000000000000006B000000000000006C000000000000006D000000000000006E000000000000006F0000000000000070000000000000007100000000000000720000000000000073000000000000007400000000000000750000000000000076000000000000007700000000000000780000000000000079000000000000007A000000000000007B000000000000007C000000000000007D000000000000007E000000000000007F00000000000000"> : tensor<128xi64>
|
||||
// CHECK-NEXT: %[[V0:.*]] = "MidLFHE.apply_lookup_table"(%arg0, %[[TABLE]]) {baseLogBS = -1 : i32, baseLogKS = -1 : i32, k = -1 : i32, levelBS = -1 : i32, levelKS = -1 : i32, outputSizeKS = -1 : i32, polynomialSize = -1 : i32} : (!MidLFHE.glwe<{_,_,_}{7}>, tensor<128xi64>) -> !MidLFHE.glwe<{_,_,_}{7}>
|
||||
// CHECK-NEXT: return %[[V0]] : !MidLFHE.glwe<{_,_,_}{7}>
|
||||
%tlu = std.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]> : tensor<128xi64>
|
||||
%tlu = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]> : tensor<128xi64>
|
||||
%1 = "HLFHE.apply_lookup_table"(%arg0, %tlu): (!HLFHE.eint<7>, tensor<128xi64>) -> (!HLFHE.eint<7>)
|
||||
return %1: !HLFHE.eint<7>
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
// CHECK-LABEL: func @mul_eint_int(%arg0: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}>
|
||||
func @mul_eint_int(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i8
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
|
||||
// CHECK-NEXT: %[[V2:.*]] = "MidLFHE.mul_glwe_int"(%arg0, %[[V1]]) : (!MidLFHE.glwe<{_,_,_}{7}>, i8) -> !MidLFHE.glwe<{_,_,_}{7}>
|
||||
// CHECK-NEXT: return %[[V2]] : !MidLFHE.glwe<{_,_,_}{7}>
|
||||
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
%1 = "HLFHE.mul_eint_int"(%arg0, %0): (!HLFHE.eint<7>, i8) -> (!HLFHE.eint<7>)
|
||||
return %1: !HLFHE.eint<7>
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
// CHECK-LABEL: func @sub_int_eint(%arg0: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}>
|
||||
func @sub_int_eint(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i8
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
|
||||
// CHECK-NEXT: %[[V2:.*]] = "MidLFHE.sub_int_glwe"(%[[V1]], %arg0) : (i8, !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}>
|
||||
// CHECK-NEXT: return %[[V2]] : !MidLFHE.glwe<{_,_,_}{7}>
|
||||
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
%1 = "HLFHE.sub_int_eint"(%0, %arg0): (i8, !HLFHE.eint<7>) -> (!HLFHE.eint<7>)
|
||||
return %1: !HLFHE.eint<7>
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
// CHECK-NEXT: func private @allocate_lwe_ciphertext_u64(index, index) -> !LowLFHE.lwe_ciphertext<_,_>
|
||||
// CHECK-LABEL: func @bootstrap_lwe(%arg0: !LowLFHE.lwe_ciphertext<1024,4>, %arg1: !LowLFHE.glwe_ciphertext) -> !LowLFHE.lwe_ciphertext<1024,4>
|
||||
func @bootstrap_lwe(%arg0: !LowLFHE.lwe_ciphertext<1024,4>, %arg1: !LowLFHE.glwe_ciphertext) -> !LowLFHE.lwe_ciphertext<1024,4> {
|
||||
// CHECK-NEXT: %[[ERR:.*]] = constant 0 : index
|
||||
// CHECK-NEXT: %[[C0:.*]] = constant 1024 : index
|
||||
// CHECK-NEXT: %[[ERR:.*]] = arith.constant 0 : index
|
||||
// CHECK-NEXT: %[[C0:.*]] = arith.constant 1024 : index
|
||||
// CHECK-NEXT: %[[V1:.*]] = call @allocate_lwe_ciphertext_u64(%[[ERR]], %[[C0]]) : (index, index) -> !LowLFHE.lwe_ciphertext<_,_>
|
||||
// CHECK-NEXT: %[[V2:.*]] = call @getGlobalBootstrapKey() : () -> !LowLFHE.lwe_bootstrap_key
|
||||
// CHECK-NEXT: %[[V3:.*]] = builtin.unrealized_conversion_cast %arg0 : !LowLFHE.lwe_ciphertext<1024,4> to !LowLFHE.lwe_ciphertext<_,_>
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
// CHECK-NEXT: func private @allocate_lwe_ciphertext_u64(index, index) -> !LowLFHE.lwe_ciphertext<_,_>
|
||||
// CHECK-LABEL: func @glwe_from_table(%arg0: tensor<16xi64>) -> !LowLFHE.glwe_ciphertext
|
||||
func @glwe_from_table(%arg0: tensor<16xi64>) -> !LowLFHE.glwe_ciphertext {
|
||||
// CHECK-NEXT: %[[V0:.*]] = constant 0 : index
|
||||
// CHECK-NEXT: %[[C0:.*]] = constant 1 : i32
|
||||
// CHECK-NEXT: %[[C1:.*]] = constant 1024 : i32
|
||||
// CHECK-NEXT: %[[V0:.*]] = arith.constant 0 : index
|
||||
// CHECK-NEXT: %[[C0:.*]] = arith.constant 1 : i32
|
||||
// CHECK-NEXT: %[[C1:.*]] = arith.constant 1024 : i32
|
||||
// CHECK-NEXT: %[[V1:.*]] = call @allocate_glwe_ciphertext_u64(%[[V0]], %[[C0]], %[[C1]]) : (index, i32, i32) -> !LowLFHE.glwe_ciphertext
|
||||
// CHECK-NEXT: %[[V2:.*]] = call @allocate_glwe_ciphertext_u64(%[[V0]], %[[C0]], %[[C1]]) : (index, i32, i32) -> !LowLFHE.glwe_ciphertext
|
||||
// CHECK-NEXT: %[[V3:.*]] = call @allocate_plaintext_list_u64(%[[V0]], %[[C1]]) : (index, i32) -> !LowLFHE.plaintext_list
|
||||
// CHECK-NEXT: %[[C2:.*]] = constant 16 : i64
|
||||
// CHECK-NEXT: %[[C3:.*]] = constant 4 : i32
|
||||
// CHECK-NEXT: %[[C2:.*]] = arith.constant 16 : i64
|
||||
// CHECK-NEXT: %[[C3:.*]] = arith.constant 4 : i32
|
||||
// CHECK-NEXT: %[[V4:.*]] = call @runtime_foreign_plaintext_list_u64(%[[V0]], %arg0, %[[C2]], %[[C3]]) : (index, tensor<16xi64>, i64, i32) -> !LowLFHE.foreign_plaintext_list
|
||||
// CHECK-NEXT: call @fill_plaintext_list_with_expansion_u64(%[[V0]], %[[V3]], %[[V4]]) : (index, !LowLFHE.plaintext_list, !LowLFHE.foreign_plaintext_list) -> ()
|
||||
// CHECK-NEXT: call @add_plaintext_list_glwe_ciphertext_u64(%[[V0]], %[[V1]], %[[V2]], %[[V3]]) : (index, !LowLFHE.glwe_ciphertext, !LowLFHE.glwe_ciphertext, !LowLFHE.plaintext_list) -> ()
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
// CHECK-NEXT: func private @allocate_lwe_ciphertext_u64(index, index) -> !LowLFHE.lwe_ciphertext<_,_>
|
||||
// CHECK-LABEL: func @keyswitch_lwe(%arg0: !LowLFHE.lwe_ciphertext<1024,4>) -> !LowLFHE.lwe_ciphertext<1024,4>
|
||||
func @keyswitch_lwe(%arg0: !LowLFHE.lwe_ciphertext<1024,4>) -> !LowLFHE.lwe_ciphertext<1024,4> {
|
||||
// CHECK-NEXT: %[[ERR:.*]] = constant 0 : index
|
||||
// CHECK-NEXT: %[[C0:.*]] = constant 1 : index
|
||||
// CHECK-NEXT: %[[ERR:.*]] = arith.constant 0 : index
|
||||
// CHECK-NEXT: %[[C0:.*]] = arith.constant 1 : index
|
||||
// CHECK-NEXT: %[[V1:.*]] = call @allocate_lwe_ciphertext_u64(%[[ERR]], %[[C0]]) : (index, index) -> !LowLFHE.lwe_ciphertext<_,_>
|
||||
// CHECK-NEXT: %[[V2:.*]] = call @getGlobalKeyswitchKey() : () -> !LowLFHE.lwe_key_switch_key
|
||||
// CHECK-NEXT: %[[V3:.*]] = builtin.unrealized_conversion_cast %arg0 : !LowLFHE.lwe_ciphertext<1024,4> to !LowLFHE.lwe_ciphertext<_,_>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
// CHECK-LABEL: func @add_glwe_const_int(%arg0: !LowLFHE.lwe_ciphertext<1024,7>) -> !LowLFHE.lwe_ciphertext<1024,7>
|
||||
func @add_glwe_const_int(%arg0: !MidLFHE.glwe<{1024,1,64}{7}>) -> !MidLFHE.glwe<{1024,1,64}{7}> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i8
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
|
||||
// CHECK-NEXT: %[[V2:.*]] = "LowLFHE.encode_int"(%[[V1]]) : (i8) -> !LowLFHE.plaintext<8>
|
||||
// CHECK-NEXT: %[[V3:.*]] = "LowLFHE.add_plaintext_lwe_ciphertext"(%arg0, %[[V2]]) : (!LowLFHE.lwe_ciphertext<1024,7>, !LowLFHE.plaintext<8>) -> !LowLFHE.lwe_ciphertext<1024,7>
|
||||
// CHECK-NEXT: return %[[V3]] : !LowLFHE.lwe_ciphertext<1024,7>
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
%1 = "MidLFHE.add_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,1,64}{7}>, i8) -> (!MidLFHE.glwe<{1024,1,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,1,64}{7}>
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
// CHECK-LABEL: func @apply_lookup_table_cst(%arg0: !LowLFHE.lwe_ciphertext<2048,4>) -> !LowLFHE.lwe_ciphertext<2048,4>
|
||||
func @apply_lookup_table_cst(%arg0: !MidLFHE.glwe<{2048,1,64}{4}>) -> !MidLFHE.glwe<{2048,1,64}{4}> {
|
||||
// CHECK-NEXT: %[[TABLE:.*]] = constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : tensor<16xi64>
|
||||
// CHECK-NEXT: %[[TABLE:.*]] = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : tensor<16xi64>
|
||||
// CHECK-NEXT: %[[V1:.*]] = "LowLFHE.glwe_from_table"(%[[TABLE]]) {k = 1 : i32, p = 4 : i32, polynomialSize = 2048 : i32} : (tensor<16xi64>) -> !LowLFHE.glwe_ciphertext
|
||||
// CHECK-NEXT: %[[V2:.*]] = "LowLFHE.keyswitch_lwe"(%arg0) {baseLog = 2 : i32, inputLweSize = 1 : i32, level = 3 : i32, outputLweSize = 600 : i32} : (!LowLFHE.lwe_ciphertext<2048,4>) -> !LowLFHE.lwe_ciphertext<600,4>
|
||||
// CHECK-NEXT: %[[V3:.*]] = "LowLFHE.bootstrap_lwe"(%[[V2]], %[[V1]]) {baseLog = 4 : i32, k = 1 : i32, level = 5 : i32, polynomialSize = 2048 : i32} : (!LowLFHE.lwe_ciphertext<600,4>, !LowLFHE.glwe_ciphertext) -> !LowLFHE.lwe_ciphertext<2048,4>
|
||||
// CHECK-NEXT: return %[[V3]] : !LowLFHE.lwe_ciphertext<2048,4>
|
||||
%tlu = std.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : tensor<16xi64>
|
||||
%tlu = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : tensor<16xi64>
|
||||
%1 = "MidLFHE.apply_lookup_table"(%arg0, %tlu){k=1:i32, polynomialSize=2048:i32, levelKS=3:i32, baseLogKS=2:i32, levelBS=5:i32, baseLogBS=4:i32, outputSizeKS=600:i32}: (!MidLFHE.glwe<{2048,1,64}{4}>, tensor<16xi64>) -> (!MidLFHE.glwe<{2048,1,64}{4}>)
|
||||
return %1: !MidLFHE.glwe<{2048,1,64}{4}>
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
// CHECK-LABEL: func @mul_glwe_const_int(%arg0: !LowLFHE.lwe_ciphertext<1024,7>) -> !LowLFHE.lwe_ciphertext<1024,7>
|
||||
func @mul_glwe_const_int(%arg0: !MidLFHE.glwe<{1024,1,64}{7}>) -> !MidLFHE.glwe<{1024,1,64}{7}> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i8
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
|
||||
// CHECK-NEXT: %[[V2:.*]] = "LowLFHE.int_to_cleartext"(%[[V1]]) : (i8) -> !LowLFHE.cleartext<8>
|
||||
// CHECK-NEXT: %[[V3:.*]] = "LowLFHE.mul_cleartext_lwe_ciphertext"(%arg0, %[[V2]]) : (!LowLFHE.lwe_ciphertext<1024,7>, !LowLFHE.cleartext<8>) -> !LowLFHE.lwe_ciphertext<1024,7>
|
||||
// CHECK-NEXT: return %[[V3]] : !LowLFHE.lwe_ciphertext<1024,7>
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
%1 = "MidLFHE.mul_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,1,64}{7}>, i8) -> (!MidLFHE.glwe<{1024,1,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,1,64}{7}>
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
// CHECK-LABEL: func @sub_const_int_glwe(%arg0: !LowLFHE.lwe_ciphertext<1024,7>) -> !LowLFHE.lwe_ciphertext<1024,7>
|
||||
func @sub_const_int_glwe(%arg0: !MidLFHE.glwe<{1024,1,64}{7}>) -> !MidLFHE.glwe<{1024,1,64}{7}> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i8
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
|
||||
// CHECK-NEXT: %[[NEG:.*]] = "LowLFHE.negate_lwe_ciphertext"(%arg0) : (!LowLFHE.lwe_ciphertext<1024,7>) -> !LowLFHE.lwe_ciphertext<1024,7>
|
||||
// CHECK-NEXT: %[[V2:.*]] = "LowLFHE.encode_int"(%[[V1]]) : (i8) -> !LowLFHE.plaintext<8>
|
||||
// CHECK-NEXT: %[[V3:.*]] = "LowLFHE.add_plaintext_lwe_ciphertext"(%[[NEG]], %[[V2]]) : (!LowLFHE.lwe_ciphertext<1024,7>, !LowLFHE.plaintext<8>) -> !LowLFHE.lwe_ciphertext<1024,7>
|
||||
// CHECK-NEXT: return %[[V3]] : !LowLFHE.lwe_ciphertext<1024,7>
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
%1 = "MidLFHE.sub_int_glwe"(%0, %arg0): (i8, !MidLFHE.glwe<{1024,1,64}{7}>) -> (!MidLFHE.glwe<{1024,1,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,1,64}{7}>
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ func @single_zero() -> !HLFHE.eint<2>
|
||||
|
||||
func @single_cst_dot(%t: tensor<4x!HLFHE.eint<2>>) -> !HLFHE.eint<2>
|
||||
{
|
||||
%cst = constant dense<[1, 2, 3, 4]> : tensor<4xi3>
|
||||
%cst = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi3>
|
||||
|
||||
// CHECK: %[[ret:.*]] = "HLFHE.dot_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 6 : ui{{[[0-9]+}}} : (tensor<4x!HLFHE.eint<2>>, tensor<4xi3>) -> !HLFHE.eint<2>
|
||||
%0 = "HLFHE.dot_eint_int"(%t, %cst) : (tensor<4x!HLFHE.eint<2>>, tensor<4xi3>) -> !HLFHE.eint<2>
|
||||
@@ -34,7 +34,7 @@ func @single_dyn_dot(%t: tensor<4x!HLFHE.eint<2>>, %dyn: tensor<4xi3>) -> !HLFHE
|
||||
|
||||
func @single_cst_add_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
{
|
||||
%cst = constant 3 : i3
|
||||
%cst = arith.constant 3 : i3
|
||||
|
||||
// CHECK: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
%0 = "HLFHE.add_eint_int"(%e, %cst) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
@@ -66,7 +66,7 @@ func @single_add_eint(%e0: !HLFHE.eint<2>, %e1: !HLFHE.eint<2>) -> !HLFHE.eint<2
|
||||
|
||||
func @single_cst_sub_int_eint(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
{
|
||||
%cst = constant 3 : i3
|
||||
%cst = arith.constant 3 : i3
|
||||
|
||||
// CHECK: %[[ret:.*]] = "HLFHE.sub_int_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (i3, !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
%0 = "HLFHE.sub_int_eint"(%cst, %e) : (i3, !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
@@ -88,7 +88,7 @@ func @single_dyn_sub_int_eint(%e: !HLFHE.eint<2>, %i: i3) -> !HLFHE.eint<2>
|
||||
|
||||
func @single_cst_mul_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
{
|
||||
%cst = constant 3 : i3
|
||||
%cst = arith.constant 3 : i3
|
||||
|
||||
// %0 = "HLFHE.mul_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 3 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
%0 = "HLFHE.mul_eint_int"(%e, %cst) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
@@ -118,10 +118,10 @@ func @single_apply_lookup_table(%arg0: !HLFHE.eint<2>, %arg1: tensor<4xi64>) ->
|
||||
|
||||
func @chain_add_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
{
|
||||
%cst0 = constant 3 : i3
|
||||
%cst1 = constant 7 : i3
|
||||
%cst2 = constant 2 : i3
|
||||
%cst3 = constant 1 : i3
|
||||
%cst0 = arith.constant 3 : i3
|
||||
%cst1 = arith.constant 7 : i3
|
||||
%cst2 = arith.constant 2 : i3
|
||||
%cst3 = arith.constant 1 : i3
|
||||
|
||||
// CHECK: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
%0 = "HLFHE.add_eint_int"(%e, %cst0) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
@@ -139,10 +139,10 @@ func @chain_add_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
|
||||
func @dag_add_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
{
|
||||
%Acst0 = constant 3 : i3
|
||||
%Acst1 = constant 7 : i3
|
||||
%Acst2 = constant 2 : i3
|
||||
%Acst3 = constant 1 : i3
|
||||
%Acst0 = arith.constant 3 : i3
|
||||
%Acst1 = arith.constant 7 : i3
|
||||
%Acst2 = arith.constant 2 : i3
|
||||
%Acst3 = arith.constant 1 : i3
|
||||
|
||||
// CHECK: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
%A0 = "HLFHE.add_eint_int"(%e, %Acst0) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
@@ -153,12 +153,12 @@ func @dag_add_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
// CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
%A3 = "HLFHE.add_eint_int"(%A2, %Acst3) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
|
||||
%Bcst0 = constant 1 : i3
|
||||
%Bcst1 = constant 5 : i3
|
||||
%Bcst2 = constant 2 : i3
|
||||
%Bcst3 = constant 7 : i3
|
||||
%Bcst4 = constant 4 : i3
|
||||
%Bcst5 = constant 7 : i3
|
||||
%Bcst0 = arith.constant 1 : i3
|
||||
%Bcst1 = arith.constant 5 : i3
|
||||
%Bcst2 = arith.constant 2 : i3
|
||||
%Bcst3 = arith.constant 7 : i3
|
||||
%Bcst4 = arith.constant 4 : i3
|
||||
%Bcst5 = arith.constant 7 : i3
|
||||
|
||||
// CHECK: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
%B0 = "HLFHE.add_eint_int"(%e, %Bcst0) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
func @single_cst_add_eint_int(%t: tensor<8x!HLFHE.eint<2>>) -> tensor<8x!HLFHE.eint<2>>
|
||||
{
|
||||
%cst = std.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
|
||||
%cst = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
|
||||
|
||||
// CHECK: %[[ret:.*]] = "HLFHELinalg.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>>
|
||||
%0 = "HLFHELinalg.add_eint_int"(%t, %cst) : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>>
|
||||
@@ -34,7 +34,7 @@ func @single_add_eint(%e0: tensor<8x!HLFHE.eint<2>>, %e1: tensor<8x!HLFHE.eint<2
|
||||
|
||||
func @single_cst_sub_int_eint(%e: tensor<8x!HLFHE.eint<2>>) -> tensor<8x!HLFHE.eint<2>>
|
||||
{
|
||||
%cst = std.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
|
||||
%cst = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
|
||||
|
||||
// CHECK: %[[ret:.*]] = "HLFHELinalg.sub_int_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (tensor<8xi3>, tensor<8x!HLFHE.eint<2>>) -> tensor<8x!HLFHE.eint<2>>
|
||||
%0 = "HLFHELinalg.sub_int_eint"(%cst, %e) : (tensor<8xi3>, tensor<8x!HLFHE.eint<2>>) -> tensor<8x!HLFHE.eint<2>>
|
||||
@@ -56,7 +56,7 @@ func @single_dyn_sub_int_eint(%e: tensor<8x!HLFHE.eint<2>>, %i: tensor<8xi3>) ->
|
||||
|
||||
func @single_cst_mul_eint_int(%e: tensor<8x!HLFHE.eint<2>>) -> tensor<8x!HLFHE.eint<2>>
|
||||
{
|
||||
%cst = std.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
|
||||
%cst = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
|
||||
|
||||
// %0 = "HLFHELinalg.mul_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 3 : ui{{[0-9]+}}} : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>>
|
||||
%0 = "HLFHELinalg.mul_eint_int"(%e, %cst) : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>>
|
||||
@@ -78,10 +78,10 @@ func @single_dyn_mul_eint_int(%e: tensor<8x!HLFHE.eint<2>>, %i: tensor<8xi3>) ->
|
||||
|
||||
func @chain_add_eint_int(%e: tensor<8x!HLFHE.eint<2>>) -> tensor<8x!HLFHE.eint<2>>
|
||||
{
|
||||
%cst0 = std.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
|
||||
%cst1 = std.constant dense<[0, 7, 2, 5, 6, 2, 1, 7]> : tensor<8xi3>
|
||||
%cst2 = std.constant dense<[0, 1, 2, 0, 1, 2, 0, 1]> : tensor<8xi3>
|
||||
%cst3 = std.constant dense<[0, 1, 1, 0, 0, 1, 0, 1]> : tensor<8xi3>
|
||||
%cst0 = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
|
||||
%cst1 = arith.constant dense<[0, 7, 2, 5, 6, 2, 1, 7]> : tensor<8xi3>
|
||||
%cst2 = arith.constant dense<[0, 1, 2, 0, 1, 2, 0, 1]> : tensor<8xi3>
|
||||
%cst3 = arith.constant dense<[0, 1, 1, 0, 0, 1, 0, 1]> : tensor<8xi3>
|
||||
// CHECK: %[[ret:.*]] = "HLFHELinalg.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>>
|
||||
%0 = "HLFHELinalg.add_eint_int"(%e, %cst0) : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>>
|
||||
// CHECK-NEXT: %[[ret:.*]] = "HLFHELinalg.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>>
|
||||
@@ -96,7 +96,7 @@ func @chain_add_eint_int(%e: tensor<8x!HLFHE.eint<2>>) -> tensor<8x!HLFHE.eint<2
|
||||
// -----
|
||||
|
||||
func @apply_lookup_table(%t: tensor<3x3x!HLFHE.eint<2>>) -> tensor<3x3x!HLFHE.eint<3>> {
|
||||
%lut = std.constant dense<[1,3,5,7]> : tensor<4xi64>
|
||||
%lut = arith.constant dense<[1,3,5,7]> : tensor<4xi64>
|
||||
// CHECK: %[[RES:.*]] = "HLFHELinalg.apply_lookup_table"(%[[T:.*]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<3x3x!HLFHE.eint<2>>, tensor<4xi64>) -> tensor<3x3x!HLFHE.eint<3>>
|
||||
%res = "HLFHELinalg.apply_lookup_table"(%t, %lut) : (tensor<3x3x!HLFHE.eint<2>>, tensor<4xi64>) -> tensor<3x3x!HLFHE.eint<3>>
|
||||
return %res : tensor<3x3x!HLFHE.eint<3>>
|
||||
@@ -105,7 +105,7 @@ func @apply_lookup_table(%t: tensor<3x3x!HLFHE.eint<2>>) -> tensor<3x3x!HLFHE.ei
|
||||
// -----
|
||||
|
||||
func @apply_lookup_table_after_op(%t: tensor<8x!HLFHE.eint<2>>, %i: tensor<8xi3>) -> tensor<8x!HLFHE.eint<3>> {
|
||||
%lut = std.constant dense<[1,3,5,7]> : tensor<4xi64>
|
||||
%lut = arith.constant dense<[1,3,5,7]> : tensor<4xi64>
|
||||
// CHECK: %[[V0:.*]] = "HLFHELinalg.mul_eint_int"([[T:.*]], %[[I:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>>
|
||||
%0 = "HLFHELinalg.mul_eint_int"(%t, %i) : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>>
|
||||
// CHECK-NEXT: %[[RES:.*]] = "HLFHELinalg.apply_lookup_table"(%[[V0:.*]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<8x!HLFHE.eint<2>>, tensor<4xi64>) -> tensor<8x!HLFHE.eint<3>>
|
||||
|
||||
@@ -13,7 +13,7 @@ func @tensor_from_elements_1(%a: !HLFHE.eint<2>, %b: !HLFHE.eint<2>, %c: !HLFHE.
|
||||
|
||||
func @tensor_from_elements_2(%a: !HLFHE.eint<2>, %b: !HLFHE.eint<2>, %c: !HLFHE.eint<2>, %d: !HLFHE.eint<2>) -> tensor<4x!HLFHE.eint<2>>
|
||||
{
|
||||
%cst = constant 3 : i3
|
||||
%cst = arith.constant 3 : i3
|
||||
|
||||
// CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[a:.*]], %[[cst:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
%0 = "HLFHE.add_eint_int"(%a, %cst) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
@@ -29,7 +29,7 @@ func @tensor_from_elements_2(%a: !HLFHE.eint<2>, %b: !HLFHE.eint<2>, %c: !HLFHE.
|
||||
|
||||
func @tensor_extract_1(%t: tensor<4x!HLFHE.eint<2>>) -> !HLFHE.eint<2>
|
||||
{
|
||||
%cst = constant 1 : index
|
||||
%cst = arith.constant 1 : index
|
||||
|
||||
// The MANP value is 1 as the tensor operand is a function argument
|
||||
// CHECK: %[[ret:.*]] = tensor.extract %[[t:.*]][%[[c1:.*]]] {MANP = 1 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<2>>
|
||||
@@ -42,8 +42,8 @@ func @tensor_extract_1(%t: tensor<4x!HLFHE.eint<2>>) -> !HLFHE.eint<2>
|
||||
|
||||
func @tensor_extract_2(%a: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
{
|
||||
%c1 = constant 1 : index
|
||||
%c3 = constant 3 : i3
|
||||
%c1 = arith.constant 1 : index
|
||||
%c3 = arith.constant 3 : i3
|
||||
|
||||
// CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[a:.*]], %[[c1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
%0 = "HLFHE.add_eint_int"(%a, %c3) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
@@ -69,7 +69,7 @@ func @tensor_extract_slice_1(%t: tensor<2x10x!HLFHE.eint<2>>) -> tensor<1x5x!HLF
|
||||
|
||||
func @tensor_extract_slice_2(%a: !HLFHE.eint<2>) -> tensor<2x!HLFHE.eint<2>>
|
||||
{
|
||||
%c3 = constant 3 : i3
|
||||
%c3 = arith.constant 3 : i3
|
||||
|
||||
// CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[a:.*]], %[[c1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
%0 = "HLFHE.add_eint_int"(%a, %c3) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
@@ -95,8 +95,8 @@ func @tensor_insert_slice_1(%t0: tensor<2x10x!HLFHE.eint<2>>, %t1: tensor<2x2x!H
|
||||
|
||||
func @tensor_insert_slice_2(%a: !HLFHE.eint<5>) -> tensor<4x!HLFHE.eint<5>>
|
||||
{
|
||||
%c3 = constant 3 : i6
|
||||
%c6 = constant 6 : i6
|
||||
%c3 = arith.constant 3 : i6
|
||||
%c6 = arith.constant 6 : i6
|
||||
|
||||
// CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[a:.*]], %[[c3:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<5>, i6) -> !HLFHE.eint<5>
|
||||
%v0 = "HLFHE.add_eint_int"(%a, %c3) : (!HLFHE.eint<5>, i6) -> !HLFHE.eint<5>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// CHECK-LABEL: error: 'HLFHE.add_eint_int' op should have the width of plain input equals to width of encrypted input + 1
|
||||
func @add_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> {
|
||||
%0 = constant 1 : i4
|
||||
%0 = arith.constant 1 : i4
|
||||
%1 = "HLFHE.add_eint_int"(%arg0, %0): (!HLFHE.eint<2>, i4) -> (!HLFHE.eint<2>)
|
||||
return %1: !HLFHE.eint<2>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// CHECK-LABEL: error: 'HLFHE.add_eint_int' op should have the width of encrypted inputs and result equals
|
||||
func @add_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<3> {
|
||||
%0 = constant 1 : i2
|
||||
%0 = arith.constant 1 : i2
|
||||
%1 = "HLFHE.add_eint_int"(%arg0, %0): (!HLFHE.eint<2>, i2) -> (!HLFHE.eint<3>)
|
||||
return %1: !HLFHE.eint<3>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// CHECK-LABEL: error: 'HLFHE.mul_eint_int' op should have the width of plain input equals to width of encrypted input + 1
|
||||
func @mul_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> {
|
||||
%0 = constant 1 : i4
|
||||
%0 = arith.constant 1 : i4
|
||||
%1 = "HLFHE.mul_eint_int"(%arg0, %0): (!HLFHE.eint<2>, i4) -> (!HLFHE.eint<2>)
|
||||
return %1: !HLFHE.eint<2>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// CHECK-LABEL: error: 'HLFHE.mul_eint_int' op should have the width of encrypted inputs and result equals
|
||||
func @mul_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<3> {
|
||||
%0 = constant 1 : i2
|
||||
%0 = arith.constant 1 : i2
|
||||
%1 = "HLFHE.mul_eint_int"(%arg0, %0): (!HLFHE.eint<2>, i2) -> (!HLFHE.eint<3>)
|
||||
return %1: !HLFHE.eint<3>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// CHECK-LABEL: error: 'HLFHE.sub_int_eint' op should have the width of plain input equals to width of encrypted input + 1
|
||||
func @sub_int_eint(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> {
|
||||
%0 = constant 1 : i4
|
||||
%0 = arith.constant 1 : i4
|
||||
%1 = "HLFHE.sub_int_eint"(%0, %arg0): (i4, !HLFHE.eint<2>) -> (!HLFHE.eint<2>)
|
||||
return %1: !HLFHE.eint<2>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// CHECK-LABEL: error: 'HLFHE.sub_int_eint' op should have the width of encrypted inputs and result equals
|
||||
func @sub_int_eint(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<3> {
|
||||
%0 = constant 1 : i2
|
||||
%0 = arith.constant 1 : i2
|
||||
%1 = "HLFHE.sub_int_eint"(%0, %arg0): (i2, !HLFHE.eint<2>) -> (!HLFHE.eint<3>)
|
||||
return %1: !HLFHE.eint<3>
|
||||
}
|
||||
|
||||
@@ -11,33 +11,33 @@ func @zero() -> !HLFHE.eint<2> {
|
||||
|
||||
// CHECK-LABEL: func @add_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
func @add_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i3
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i3
|
||||
// CHECK-NEXT: %[[V2:.*]] = "HLFHE.add_eint_int"(%arg0, %[[V1]]) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
// CHECK-NEXT: return %[[V2]] : !HLFHE.eint<2>
|
||||
|
||||
%0 = constant 1 : i3
|
||||
%0 = arith.constant 1 : i3
|
||||
%1 = "HLFHE.add_eint_int"(%arg0, %0): (!HLFHE.eint<2>, i3) -> (!HLFHE.eint<2>)
|
||||
return %1: !HLFHE.eint<2>
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @sub_int_eint(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
func @sub_int_eint(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i3
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i3
|
||||
// CHECK-NEXT: %[[V2:.*]] = "HLFHE.sub_int_eint"(%[[V1]], %arg0) : (i3, !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
// CHECK-NEXT: return %[[V2]] : !HLFHE.eint<2>
|
||||
|
||||
%0 = constant 1 : i3
|
||||
%0 = arith.constant 1 : i3
|
||||
%1 = "HLFHE.sub_int_eint"(%0, %arg0): (i3, !HLFHE.eint<2>) -> (!HLFHE.eint<2>)
|
||||
return %1: !HLFHE.eint<2>
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @mul_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
func @mul_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i3
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i3
|
||||
// CHECK-NEXT: %[[V2:.*]] = "HLFHE.mul_eint_int"(%arg0, %[[V1]]) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2>
|
||||
// CHECK-NEXT: return %[[V2]] : !HLFHE.eint<2>
|
||||
|
||||
%0 = constant 1 : i3
|
||||
%0 = arith.constant 1 : i3
|
||||
%1 = "HLFHE.mul_eint_int"(%arg0, %0): (!HLFHE.eint<2>, i3) -> (!HLFHE.eint<2>)
|
||||
return %1: !HLFHE.eint<2>
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
//CHECK-NEXT: %5 = "MidLFHE.add_glwe"(%4, %arg4) : (!MidLFHE.glwe<{_,_,_}{2}>, !MidLFHE.glwe<{_,_,_}{2}>) -> !MidLFHE.glwe<{_,_,_}{2}>
|
||||
//CHECK-NEXT: linalg.yield %5 : !MidLFHE.glwe<{_,_,_}{2}>
|
||||
//CHECK-NEXT: } -> tensor<1x!MidLFHE.glwe<{_,_,_}{2}>>
|
||||
//CHECK-NEXT: %c0 = constant 0 : index
|
||||
//CHECK-NEXT: %c0 = arith.constant 0 : index
|
||||
//CHECK-NEXT: %3 = tensor.extract %2[%c0] : tensor<1x!MidLFHE.glwe<{_,_,_}{2}>>
|
||||
//CHECK-NEXT: return %3 : !MidLFHE.glwe<{_,_,_}{2}>
|
||||
//CHECK-NEXT: }
|
||||
|
||||
@@ -181,10 +181,10 @@ func @const_cleartext() -> (!LowLFHE.cleartext<8>) {
|
||||
|
||||
// CHECK-LABEL: func @int_to_cleartext() -> !LowLFHE.cleartext<6>
|
||||
func @int_to_cleartext() -> !LowLFHE.cleartext<6> {
|
||||
// CHECK-NEXT: %[[V0:.*]] = constant 5 : i6
|
||||
// CHECK-NEXT: %[[V0:.*]] = arith.constant 5 : i6
|
||||
// CHECK-NEXT: %[[V1:.*]] = "LowLFHE.int_to_cleartext"(%[[V0]]) : (i6) -> !LowLFHE.cleartext<6>
|
||||
// CHECK-NEXT: return %[[V1]] : !LowLFHE.cleartext<6>
|
||||
%0 = constant 5 : i6
|
||||
%0 = arith.constant 5 : i6
|
||||
%1 = "LowLFHE.int_to_cleartext"(%0) : (i6) -> !LowLFHE.cleartext<6>
|
||||
return %1 : !LowLFHE.cleartext<6>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// GLWE p parameter
|
||||
func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{6}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.add_glwe_int' op should have the same GLWE 'p' parameter}}
|
||||
%1 = "MidLFHE.add_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> (!MidLFHE.glwe<{1024,12,64}{6}>)
|
||||
return %1: !MidLFHE.glwe<{1024,12,64}{6}>
|
||||
@@ -12,7 +12,7 @@ func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024
|
||||
|
||||
// GLWE dimension parameter
|
||||
func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{512,12,64}{7}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.add_glwe_int' op should have the same GLWE 'dimension' parameter}}
|
||||
%1 = "MidLFHE.add_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> (!MidLFHE.glwe<{512,12,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{512,12,64}{7}>
|
||||
@@ -22,7 +22,7 @@ func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{512,
|
||||
|
||||
// GLWE polynomialSize parameter
|
||||
func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,11,64}{7}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.add_glwe_int' op should have the same GLWE 'polynomialSize' parameter}}
|
||||
%1 = "MidLFHE.add_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> (!MidLFHE.glwe<{1024,11,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,11,64}{7}>
|
||||
@@ -32,7 +32,7 @@ func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024
|
||||
|
||||
// integer width doesn't match GLWE parameter
|
||||
func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> {
|
||||
%0 = constant 1 : i9
|
||||
%0 = arith.constant 1 : i9
|
||||
// expected-error @+1 {{'MidLFHE.add_glwe_int' op should have the width of `b` equals or less than 'p'+1}}
|
||||
%1 = "MidLFHE.add_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i9) -> (!MidLFHE.glwe<{1024,12,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
// CHECK-LABEL: func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i8
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
|
||||
// CHECK-NEXT: %[[V2:.*]] = "MidLFHE.add_glwe_int"(%arg0, %[[V1]]) : (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
// CHECK-NEXT: return %[[V2]] : !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
%1 = "MidLFHE.add_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> (!MidLFHE.glwe<{1024,12,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// GLWE p parameter
|
||||
func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{6}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.mul_glwe_int' op should have the same GLWE 'p' parameter}}
|
||||
%1 = "MidLFHE.mul_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> (!MidLFHE.glwe<{1024,12,64}{6}>)
|
||||
return %1: !MidLFHE.glwe<{1024,12,64}{6}>
|
||||
@@ -12,7 +12,7 @@ func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024
|
||||
|
||||
// GLWE dimension parameter
|
||||
func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{512,12,64}{7}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.mul_glwe_int' op should have the same GLWE 'dimension' parameter}}
|
||||
%1 = "MidLFHE.mul_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> (!MidLFHE.glwe<{512,12,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{512,12,64}{7}>
|
||||
@@ -22,7 +22,7 @@ func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{512,
|
||||
|
||||
// GLWE polynomialSize parameter
|
||||
func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,11,64}{7}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.mul_glwe_int' op should have the same GLWE 'polynomialSize' parameter}}
|
||||
%1 = "MidLFHE.mul_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> (!MidLFHE.glwe<{1024,11,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,11,64}{7}>
|
||||
@@ -32,7 +32,7 @@ func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024
|
||||
|
||||
// integer width doesn't match GLWE parameter
|
||||
func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> {
|
||||
%0 = constant 1 : i9
|
||||
%0 = arith.constant 1 : i9
|
||||
// expected-error @+1 {{'MidLFHE.mul_glwe_int' op should have the width of `b` equals or less than 'p'+1}}
|
||||
%1 = "MidLFHE.mul_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i9) -> (!MidLFHE.glwe<{1024,12,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
// CHECK-LABEL: func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i8
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
|
||||
// CHECK-NEXT: %[[V2:.*]] = "MidLFHE.mul_glwe_int"(%arg0, %[[V1]]) : (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
// CHECK-NEXT: return %[[V2]] : !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
%1 = "MidLFHE.mul_glwe_int"(%arg0, %0): (!MidLFHE.glwe<{1024,12,64}{7}>, i8) -> (!MidLFHE.glwe<{1024,12,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// GLWE p parameter
|
||||
func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{6}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.sub_int_glwe' op should have the same GLWE 'p' parameter}}
|
||||
%1 = "MidLFHE.sub_int_glwe"(%0, %arg0): (i8, !MidLFHE.glwe<{1024,12,64}{7}>) -> (!MidLFHE.glwe<{1024,12,64}{6}>)
|
||||
return %1: !MidLFHE.glwe<{1024,12,64}{6}>
|
||||
@@ -12,7 +12,7 @@ func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024
|
||||
|
||||
// GLWE dimension parameter
|
||||
func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{512,12,64}{7}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.sub_int_glwe' op should have the same GLWE 'dimension' parameter}}
|
||||
%1 = "MidLFHE.sub_int_glwe"(%0, %arg0): (i8, !MidLFHE.glwe<{1024,12,64}{7}>) -> (!MidLFHE.glwe<{512,12,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{512,12,64}{7}>
|
||||
@@ -22,7 +22,7 @@ func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{512,
|
||||
|
||||
// GLWE polynomialSize parameter
|
||||
func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,11,64}{7}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.sub_int_glwe' op should have the same GLWE 'polynomialSize' parameter}}
|
||||
%1 = "MidLFHE.sub_int_glwe"(%0, %arg0): (i8, !MidLFHE.glwe<{1024,12,64}{7}>) -> (!MidLFHE.glwe<{1024,11,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,11,64}{7}>
|
||||
@@ -32,7 +32,7 @@ func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024
|
||||
|
||||
// integer width doesn't match GLWE parameter
|
||||
func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,11,64}{7}> {
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
// expected-error @+1 {{'MidLFHE.sub_int_glwe' op should have the same GLWE 'polynomialSize' parameter}}
|
||||
%1 = "MidLFHE.sub_int_glwe"(%0, %arg0): (i8, !MidLFHE.glwe<{1024,12,64}{7}>) -> (!MidLFHE.glwe<{1024,11,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,11,64}{7}>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
// CHECK-LABEL: func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i8
|
||||
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
|
||||
// CHECK-NEXT: %[[V2:.*]] = "MidLFHE.sub_int_glwe"(%[[V1]], %arg0) : (i8, !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
// CHECK-NEXT: return %[[V2]] : !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
|
||||
%0 = constant 1 : i8
|
||||
%0 = arith.constant 1 : i8
|
||||
%1 = "MidLFHE.sub_int_glwe"(%0, %arg0): (i8, !MidLFHE.glwe<{1024,12,64}{7}>) -> (!MidLFHE.glwe<{1024,12,64}{7}>)
|
||||
return %1: !MidLFHE.glwe<{1024,12,64}{7}>
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ def test_compile_and_run_invalid_arg_number(mlir_input, args):
|
||||
pytest.param(
|
||||
"""
|
||||
func @main(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> {
|
||||
%tlu = std.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]> : tensor<128xi64>
|
||||
%tlu = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]> : tensor<128xi64>
|
||||
%1 = "HLFHE.apply_lookup_table"(%arg0, %tlu): (!HLFHE.eint<7>, tensor<128xi64>) -> (!HLFHE.eint<7>)
|
||||
return %1: !HLFHE.eint<7>
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ VALID_INPUTS = [
|
||||
pytest.param(
|
||||
"""
|
||||
func @add_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> {
|
||||
%0 = constant 1 : i3
|
||||
%0 = arith.constant 1 : i3
|
||||
%1 = "HLFHE.add_eint_int"(%arg0, %0): (!HLFHE.eint<2>, i3) -> (!HLFHE.eint<2>)
|
||||
return %1: !HLFHE.eint<2>
|
||||
}
|
||||
@@ -37,7 +37,7 @@ VALID_INPUTS = [
|
||||
pytest.param(
|
||||
"""
|
||||
func @main(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> {
|
||||
%tlu = std.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]> : tensor<128xi64>
|
||||
%tlu = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]> : tensor<128xi64>
|
||||
%1 = "HLFHE.apply_lookup_table"(%arg0, %tlu): (!HLFHE.eint<7>, tensor<128xi64>) -> (!HLFHE.eint<7>)
|
||||
return %1: !HLFHE.eint<7>
|
||||
}
|
||||
|
||||
@@ -881,7 +881,7 @@ TEST(End2EndJit_HLFHELinalg, apply_lookup_table) {
|
||||
// [3,0,1] lut [1,3,5,7] = [7,1,3]
|
||||
// [2,3,0] [5,7,1]
|
||||
func @main(%t: tensor<3x3x!HLFHE.eint<2>>) -> tensor<3x3x!HLFHE.eint<3>> {
|
||||
%lut = std.constant dense<[1,3,5,7]> : tensor<4xi64>
|
||||
%lut = arith.constant dense<[1,3,5,7]> : tensor<4xi64>
|
||||
%res = "HLFHELinalg.apply_lookup_table"(%t, %lut) : (tensor<3x3x!HLFHE.eint<2>>, tensor<4xi64>) -> tensor<3x3x!HLFHE.eint<3>>
|
||||
return %res : tensor<3x3x!HLFHE.eint<3>>
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func @main(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>) -> !HLFHE.eint<7> {
|
||||
TEST(CompileAndRunHLFHE, add_u64) {
|
||||
mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX(
|
||||
func @main(%arg0: i64, %arg1: i64) -> i64 {
|
||||
%1 = addi %arg0, %arg1 : i64
|
||||
%1 = arith.addi %arg0, %arg1 : i64
|
||||
return %1: i64
|
||||
}
|
||||
)XXX",
|
||||
@@ -215,7 +215,7 @@ func @main(%t: tensor<10x!HLFHE.eint<5>>, %i: index, %j: index) ->
|
||||
TEST(CompileAndRunTensorEncrypted, dim_5) {
|
||||
mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX(
|
||||
func @main(%t: tensor<10x!HLFHE.eint<5>>) -> index{
|
||||
%c0 = constant 0 : index
|
||||
%c0 = arith.constant 0 : index
|
||||
%c = tensor.dim %t, %c0 : tensor<10x!HLFHE.eint<5>>
|
||||
return %c : index
|
||||
}
|
||||
@@ -244,8 +244,8 @@ func @main(%0: !HLFHE.eint<5>) -> tensor<1x!HLFHE.eint<5>> {
|
||||
TEST(CompileAndRunTensorEncrypted, in_out_tensor_with_op_5) {
|
||||
mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX(
|
||||
func @main(%in: tensor<2x!HLFHE.eint<5>>) -> tensor<3x!HLFHE.eint<5>> {
|
||||
%c_0 = constant 0 : index
|
||||
%c_1 = constant 1 : index
|
||||
%c_0 = arith.constant 0 : index
|
||||
%c_1 = arith.constant 1 : index
|
||||
%a = tensor.extract %in[%c_0] : tensor<2x!HLFHE.eint<5>>
|
||||
%b = tensor.extract %in[%c_1] : tensor<2x!HLFHE.eint<5>>
|
||||
%aplusa = "HLFHE.add_eint"(%a, %a): (!HLFHE.eint<5>, !HLFHE.eint<5>) ->
|
||||
@@ -285,7 +285,7 @@ func @main(%arg0: tensor<2x!HLFHE.eint<7>>, %arg1: tensor<2xi8>, %acc:
|
||||
!HLFHE.eint<7> %5 = "HLFHE.add_eint"(%4, %arg4) : (!HLFHE.eint<7>,
|
||||
!HLFHE.eint<7>) -> !HLFHE.eint<7> linalg.yield %5 : !HLFHE.eint<7>
|
||||
} -> tensor<1x!HLFHE.eint<7>>
|
||||
%c0 = constant 0 : index
|
||||
%c0 = arith.constant 0 : index
|
||||
%ret = tensor.extract %2[%c0] : tensor<1x!HLFHE.eint<7>>
|
||||
return %ret : !HLFHE.eint<7>
|
||||
}
|
||||
@@ -329,7 +329,7 @@ TEST_P(CompileAndRunWithPrecision, identity_func) {
|
||||
|
||||
mlirProgram << "func @main(%arg0: !HLFHE.eint<" << precision
|
||||
<< ">) -> !HLFHE.eint<" << precision << "> { \n"
|
||||
<< " %tlu = std.constant dense<[0";
|
||||
<< " %tlu = arith.constant dense<[0";
|
||||
|
||||
for (uint64_t i = 1; i < sizeOfTLU; i++)
|
||||
mlirProgram << ", " << i;
|
||||
@@ -375,8 +375,8 @@ INSTANTIATE_TEST_SUITE_P(TestHLFHEApplyLookupTable, CompileAndRunWithPrecision,
|
||||
TEST(TestHLFHEApplyLookupTable, multiple_precision) {
|
||||
mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX(
|
||||
func @main(%arg0: !HLFHE.eint<6>, %arg1: !HLFHE.eint<3>) -> !HLFHE.eint<6> {
|
||||
%tlu_7 = std.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]> : tensor<64xi64>
|
||||
%tlu_3 = std.constant dense<[0, 1, 2, 3, 4, 5, 6, 7]> : tensor<8xi64>
|
||||
%tlu_7 = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]> : tensor<64xi64>
|
||||
%tlu_3 = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7]> : tensor<8xi64>
|
||||
%a = "HLFHE.apply_lookup_table"(%arg0, %tlu_7): (!HLFHE.eint<6>, tensor<64xi64>) -> (!HLFHE.eint<6>)
|
||||
%b = "HLFHE.apply_lookup_table"(%arg1, %tlu_3): (!HLFHE.eint<3>, tensor<8xi64>) -> (!HLFHE.eint<6>)
|
||||
%a_plus_b = "HLFHE.add_eint"(%a, %b): (!HLFHE.eint<6>, !HLFHE.eint<6>) -> (!HLFHE.eint<6>)
|
||||
@@ -390,7 +390,7 @@ func @main(%arg0: !HLFHE.eint<6>, %arg1: !HLFHE.eint<3>) -> !HLFHE.eint<6> {
|
||||
TEST(CompileAndRunTLU, random_func) {
|
||||
mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX(
|
||||
func @main(%arg0: !HLFHE.eint<6>) -> !HLFHE.eint<6> {
|
||||
%tlu = std.constant dense<[16, 91, 16, 83, 80, 74, 21, 96, 1, 63, 49, 122, 76, 89, 74, 55, 109, 110, 103, 54, 105, 14, 66, 47, 52, 89, 7, 10, 73, 44, 119, 92, 25, 104, 123, 100, 108, 86, 29, 121, 118, 52, 107, 48, 34, 37, 13, 122, 107, 48, 74, 59, 96, 36, 50, 55, 120, 72, 27, 45, 12, 5, 96, 12]> : tensor<64xi64>
|
||||
%tlu = arith.constant dense<[16, 91, 16, 83, 80, 74, 21, 96, 1, 63, 49, 122, 76, 89, 74, 55, 109, 110, 103, 54, 105, 14, 66, 47, 52, 89, 7, 10, 73, 44, 119, 92, 25, 104, 123, 100, 108, 86, 29, 121, 118, 52, 107, 48, 34, 37, 13, 122, 107, 48, 74, 59, 96, 36, 50, 55, 120, 72, 27, 45, 12, 5, 96, 12]> : tensor<64xi64>
|
||||
%1 = "HLFHE.apply_lookup_table"(%arg0, %tlu): (!HLFHE.eint<6>, tensor<64xi64>) -> (!HLFHE.eint<6>)
|
||||
return %1: !HLFHE.eint<6>
|
||||
}
|
||||
|
||||
Submodule llvm-project updated: 55e76c70a4...8b7cc93e9d
Reference in New Issue
Block a user