Rebase onto llvm-project 3f81841474fe with patch for arbitrary types in linalg named ops

Rebase to llvm-project at 3f81841474fe with a pending upstream patch
for arbitrary element types in linalg named operations.

Co-authored-by: Ayoub Benaissa <ayoub.benaissa@zama.ai>
This commit is contained in:
Andi Drebes
2022-07-04 11:51:29 +02:00
parent fb9066c3e8
commit 85ebc0cb7a
142 changed files with 1108 additions and 1372 deletions

View File

@@ -6,10 +6,12 @@
#ifndef CONCRETELANG_TRANSFORMS_PASSES_H
#define CONCRETELANG_TRANSFORMS_PASSES_H
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "concretelang/Conversion/ConcreteToBConcrete/Pass.h"
#include "concretelang/Conversion/FHETensorOpsToLinalg/Pass.h"

View File

@@ -8,6 +8,6 @@ mlir_tablegen(ConcreteOpsDialect.cpp.inc -gen-dialect-defs -dialect=Concrete)
add_public_tablegen_target(MLIRConcreteOpsIncGen)
add_dependencies(mlir-headers MLIRConcreteOpsIncGen)
add_concretelang_doc(ConcreteDialect ConcreteDialect concretelang/ -gen-dialect-doc)
add_concretelang_doc(ConcreteOps ConcreteDialect concretelang/ -gen-dialect-doc -dialect=Concrete)
add_concretelang_doc(ConcreteOps ConcreteOps concretelang/ -gen-op-doc)
add_concretelang_doc(ConcreteTypes ConcreteTypes concretelang/ -gen-typedef-doc)

View File

@@ -10,6 +10,7 @@ def Concrete_Dialect : Dialect {
A dialect for representation of low level operation on fully homomorphic ciphertext.
}];
let cppNamespace = "::mlir::concretelang::Concrete";
let useDefaultTypePrinterParser = 1;
}
#endif

View File

@@ -8,6 +8,6 @@ mlir_tablegen(FHEOpsDialect.cpp.inc -gen-dialect-defs -dialect=FHE)
add_public_tablegen_target(MLIRFHEOpsIncGen)
add_dependencies(mlir-headers MLIRFHEOpsIncGen)
add_concretelang_doc(FHEDialect FHEDialect concretelang/ -gen-dialect-doc)
add_concretelang_doc(FHEOps FHEDialect concretelang/ -gen-dialect-doc -dialect=FHE)
add_concretelang_doc(FHEOps FHEOps concretelang/ -gen-op-doc)
add_concretelang_doc(FHETypes FHETypes concretelang/ -gen-typedef-doc)

View File

@@ -18,6 +18,7 @@ def FHE_Dialect : Dialect {
A dialect for representation of high level operation on fully homomorphic ciphertext.
}];
let cppNamespace = "::mlir::concretelang::FHE";
let useDefaultTypePrinterParser = 1;
}
#endif

View File

@@ -8,6 +8,6 @@ mlir_tablegen(FHELinalgOpsDialect.cpp.inc -gen-dialect-defs -dialect=FHELinalg)
add_public_tablegen_target(MLIRFHELinalgOpsIncGen)
add_dependencies(mlir-headers MLIRFHELinalgOpsIncGen)
add_concretelang_doc(FHELinalgDialect FHELinalgDialect concretelang/ -gen-dialect-doc)
add_concretelang_doc(FHELinalgOps FHELinalgDialect concretelang/ -gen-dialect-doc -dialect=FHELinalg)
add_concretelang_doc(FHELinalgOps FHELinalgOps concretelang/ -gen-op-doc)
add_concretelang_doc(FHELinalgTypes FHELinalgTypes concretelang/ -gen-typedef-doc)

View File

@@ -8,6 +8,6 @@ mlir_tablegen(TFHEOpsDialect.cpp.inc -gen-dialect-defs -dialect=TFHE)
add_public_tablegen_target(MLIRTFHEOpsIncGen)
add_dependencies(mlir-headers MLIRTFHEOpsIncGen)
add_concretelang_doc(TFHEDialect TFHEDialect concretelang/ -gen-dialect-doc)
add_concretelang_doc(TFHEOps TFHEDialect concretelang/ -gen-dialect-doc -dialect=TFHE)
add_concretelang_doc(TFHEOps TFHEOps concretelang/ -gen-op-doc)
add_concretelang_doc(TFHETypes TFHETypes concretelang/ -gen-typedef-doc)

View File

@@ -17,6 +17,7 @@ def TFHE_Dialect : Dialect {
let description = [{
A dialect for representation of high level operation on fully homomorphic ciphertext.
}];
let useDefaultTypePrinterParser = 1;
let cppNamespace = "::mlir::concretelang::TFHE";
}

View File

@@ -7,6 +7,7 @@
#define CONCRETELANG_SUPPORT_LINALG_EXTRAS_H_
#include <llvm/ADT/TypeSwitch.h>
#include <mlir/Dialect/Affine/IR/AffineOps.h>
#include <mlir/Dialect/Linalg/IR/Linalg.h>
#include <mlir/Dialect/Linalg/Transforms/Transforms.h>
#include <mlir/Dialect/Linalg/Utils/Utils.h>

View File

@@ -1,9 +1,3 @@
set(LLVM_TARGET_DEFINITIONS Passes.td)
mlir_tablegen(Passes.h.inc -gen-pass-decls -name Transforms)
add_public_tablegen_target(ConcretelangTransformsBufferizePassIncGen)
set(LLVM_TARGET_DEFINITIONS OneShotBufferizeDPSWrapper.td)
mlir_tablegen(OneShotBufferizeDPSWrapper.h.inc -gen-pass-decls -name Transforms)
add_public_tablegen_target(ConcretelangTransformsOneShotBufferizeDPSWrapperPassIncGen)
add_public_tablegen_target(ConcretelangTransformsPassIncGen)
add_dependencies(mlir-headers ConcretelangTransformsPassIncGen)

View File

@@ -1,23 +0,0 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// for license information.
#ifndef CONCRETELANG_ONE_SHOT_BUFFERIZE_DPS_WRAPPER_PASS_H
#define CONCRETELANG_ONE_SHOT_BUFFERIZE_DPS_WRAPPER_PASS_H
#include <mlir/Dialect/Bufferization/IR/Bufferization.h>
#include <mlir/Dialect/MemRef/IR/MemRef.h>
#include <mlir/Pass/Pass.h>
#define GEN_PASS_CLASSES
#include <concretelang/Transforms/OneShotBufferizeDPSWrapper.h.inc>
namespace mlir {
namespace concretelang {
std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
createOneShotBufferizeDPSWrapperPass();
} // namespace concretelang
} // namespace mlir
#endif

View File

@@ -1,55 +0,0 @@
#ifndef CONCRETELANG_ONE_SHOT_BUFFERIZE_DPS_WRAPPER_PASS
#define CONCRETELANG_ONE_SHOT_BUFFERIZE_DPS_WRAPPER_PASS
include "mlir/Pass/PassBase.td"
def OneShotBufferizeDPSWrapper
: Pass<"one-shot-bufferize-dps-wrapper", "::mlir::ModuleOp"> {
let summary =
"Converts functions to destination-passing and generates a wrapper "
"function allocating and returning memrefs for return values";
let description = [{
The one-shot bufferizer converts all functions returning tensor values
to functions using destination-passing style with one output memref for
each output value. In order to support external callers not using
destination-passing style and expecting memrefs to be returned, this
pass generates a wrapper function that allocates the corresponding
memref for each output tensor of the original function, invokes the
function using destination-passing style and returns the allocated
memrefs to the caller.
Example:
```
func @main(...) -> tensor<3x2049xi64> {
...
}
```
becomes:
```
func private @main(...) -> memref<3x2049xi64> {
%0 = memref.alloc() : memref<3x2049xi64>
call @__dps_main(..., %0) : (..., memref<3x2049xi64>) -> ()
return %0 : memref<3x2049xi64>
}
func @__dps_main(..., tensor<3x2049xi64>) {
...
}
```
}];
let constructor =
"mlir::concretelang::createOneShotBufferizeDPSWrapperPass()";
let options = [];
let dependentDialects = [
"mlir::bufferization::BufferizationDialect", "mlir::memref::MemRefDialect"
];
}
#endif

View File

@@ -7,8 +7,8 @@
#define CONCRETELANG_TRANSFORMS_PASS_H
#include <mlir/Dialect/Func/IR/FuncOps.h>
#include <mlir/Dialect/SCF/SCF.h>
#include <mlir/IR/BuiltinOps.h>
#include <mlir/Dialect/MemRef/IR/MemRef.h>
#include <mlir/Dialect/SCF/IR/SCF.h>
#include <mlir/Pass/Pass.h>
#define GEN_PASS_CLASSES

View File

@@ -13,6 +13,6 @@ add_mlir_dialect_library(ConcreteToBConcrete
MLIRIR
MLIRTransforms
MLIRLinalgTransforms
MLIRMath)
MLIRMathDialect)
target_link_libraries(ConcreteToBConcrete PUBLIC BConcreteDialect MLIRIR)

View File

@@ -6,10 +6,11 @@
#include <algorithm>
#include <iostream>
#include <iterator>
#include <mlir/Dialect/Affine/IR/AffineOps.h>
#include <mlir/Dialect/Bufferization/IR/Bufferization.h>
#include <mlir/Dialect/Func/IR/FuncOps.h>
#include <mlir/Dialect/Linalg/IR/Linalg.h>
#include <mlir/Dialect/SCF/SCF.h>
#include <mlir/Dialect/SCF/IR/SCF.h>
#include <mlir/Dialect/Tensor/IR/Tensor.h>
#include <mlir/IR/AffineExpr.h>
#include <mlir/IR/AffineMap.h>
@@ -289,8 +290,9 @@ struct GlweFromTablePattern : public mlir::OpRewritePattern<
converter.convertType(resultTy).cast<mlir::RankedTensorType>();
// %0 = linalg.init_tensor [polynomialSize*(glweDimension+1)]
// : tensor<polynomialSize*(glweDimension+1), i64>
mlir::Value init = rewriter.replaceOpWithNewOp<mlir::linalg::InitTensorOp>(
op, newResultTy.getShape(), newResultTy.getElementType());
mlir::Value init =
rewriter.replaceOpWithNewOp<mlir::bufferization::AllocTensorOp>(
op, newResultTy, mlir::ValueRange{});
// "BConcrete.fill_glwe_from_table" : (%0, polynomialSize, glweDimension,
// %tlu)
@@ -672,9 +674,8 @@ struct FromElementsOpPattern
auto newTensorResultTy =
converter.convertType(resultTy).cast<mlir::RankedTensorType>();
mlir::Value tensor = rewriter.create<mlir::linalg::InitTensorOp>(
fromElementsOp.getLoc(), newTensorResultTy.getShape(),
newTensorResultTy.getElementType());
mlir::Value tensor = rewriter.create<mlir::bufferization::AllocTensorOp>(
fromElementsOp.getLoc(), newTensorResultTy, mlir::ValueRange{});
llvm::SmallVector<mlir::OpFoldResult> sizes(1,
rewriter.getI64IntegerAttr(1));
@@ -788,39 +789,33 @@ void insertTensorShapeOpPattern(mlir::MLIRContext &context,
});
}
/// Rewrites `linalg.init_tensor` ops for which the converted type in
/// Rewrites `bufferization.alloc_tensor` ops for which the converted type in
/// BConcrete is different from the original type.
///
/// Example:
///
/// ```
/// linalg.init_tensor [4] : tensor<4x!Concrete.lwe_ciphertext<4096,6>>
/// bufferization.alloc_tensor() : tensor<4x!Concrete.lwe_ciphertext<4096,6>>
/// ```
///
/// which has become after type conversion:
/// becomes:
///
/// ```
/// linalg.init_tensor [4] : tensor<4x4097xi64>
/// bufferization.alloc_tensor() : tensor<4x4097xi64>
/// ```
///
/// is finally fixed:
///
/// ```
/// linalg.init_tensor [4, 4097] : tensor<4x4097xi64>
/// ```
struct InitTensorOpPattern
: public mlir::OpRewritePattern<mlir::linalg::InitTensorOp> {
InitTensorOpPattern(::mlir::MLIRContext *context,
mlir::PatternBenefit benefit = 1)
: ::mlir::OpRewritePattern<mlir::linalg::InitTensorOp>(context, benefit) {
}
struct AllocTensorOpPattern
: public mlir::OpRewritePattern<mlir::bufferization::AllocTensorOp> {
AllocTensorOpPattern(::mlir::MLIRContext *context,
mlir::PatternBenefit benefit = 1)
: ::mlir::OpRewritePattern<mlir::bufferization::AllocTensorOp>(context,
benefit) {}
::mlir::LogicalResult
matchAndRewrite(mlir::linalg::InitTensorOp initTensorOp,
matchAndRewrite(mlir::bufferization::AllocTensorOp allocTensorOp,
::mlir::PatternRewriter &rewriter) const override {
ConcreteToBConcreteTypeConverter converter;
mlir::RankedTensorType resultTy =
initTensorOp.getType().dyn_cast<mlir::RankedTensorType>();
allocTensorOp.getType().dyn_cast<mlir::RankedTensorType>();
if (!resultTy || !resultTy.hasStaticShape())
return mlir::failure();
@@ -829,8 +824,8 @@ struct InitTensorOpPattern
converter.convertType(resultTy).dyn_cast<mlir::RankedTensorType>();
if (resultTy.getShape().size() != newResultTy.getShape().size()) {
rewriter.replaceOpWithNewOp<mlir::linalg::InitTensorOp>(
initTensorOp, newResultTy.getShape(), newResultTy.getElementType());
rewriter.replaceOpWithNewOp<mlir::bufferization::AllocTensorOp>(
allocTensorOp, newResultTy, mlir::ValueRange{});
}
return ::mlir::success();
@@ -935,11 +930,11 @@ void ConcreteToBConcretePass::runOnOperation() {
converter.isLegal(op->getOperandTypes());
});
patterns.insert<InitTensorOpPattern>(&getContext());
patterns.insert<AllocTensorOpPattern>(&getContext());
target.addDynamicallyLegalOp<mlir::tensor::InsertSliceOp,
mlir::tensor::FromElementsOp,
mlir::linalg::InitTensorOp>(
mlir::bufferization::AllocTensorOp>(
[&](mlir::Operation *op) {
return converter.isLegal(op->getResult(0).getType());
});

View File

@@ -3,6 +3,7 @@
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// for license information.
#include <mlir/Dialect/Bufferization/IR/Bufferization.h>
#include <unordered_set>
#include "mlir/Dialect/Func/IR/FuncOps.h"
@@ -30,6 +31,7 @@
namespace arith = mlir::arith;
namespace linalg = mlir::linalg;
namespace tensor = mlir::tensor;
namespace bufferization = mlir::bufferization;
namespace FHE = mlir::concretelang::FHE;
namespace FHELinalg = mlir::concretelang::FHELinalg;
@@ -239,8 +241,8 @@ struct FHELinalgOpToLinalgGeneric : public mlir::OpRewritePattern<FHELinalgOp> {
mlir::RankedTensorType rhsTy =
((mlir::Type)linalgOp.rhs().getType()).cast<mlir::RankedTensorType>();
// linalg.init_tensor for initial value
mlir::Value init = rewriter.create<mlir::linalg::InitTensorOp>(
linalgOp.getLoc(), resultTy.getShape(), resultTy.getElementType());
mlir::Value init = rewriter.create<bufferization::AllocTensorOp>(
linalgOp.getLoc(), resultTy, mlir::ValueRange{});
// Create the affine #maps_0
llvm::SmallVector<mlir::AffineMap, 3> maps{
@@ -431,8 +433,8 @@ struct FHELinalgApplyMappedLookupTableToLinalgGeneric
nestedBuilder.create<linalg::YieldOp>(loc, lookup.getResult());
};
auto output =
rewriter.create<linalg::InitTensorOp>(loc, resultShape, elementTy);
auto output = rewriter.create<bufferization::AllocTensorOp>(
loc, resultTy, mlir::ValueRange{});
// Create the `linalg.g eneric` op
Types resTys{resultTy};
@@ -517,9 +519,8 @@ struct FHELinalgApplyMultiLookupTableToLinalgGeneric
((mlir::Type)fheLinalgLutOp.luts().getType())
.cast<mlir::RankedTensorType>();
// linalg.init_tensor for initial value
mlir::Value init = rewriter.create<mlir::linalg::InitTensorOp>(
fheLinalgLutOp.getLoc(), resultTy.getShape(),
resultTy.getElementType());
mlir::Value init = rewriter.create<bufferization::AllocTensorOp>(
fheLinalgLutOp.getLoc(), resultTy, mlir::ValueRange{});
auto lutsShape = lutsTy.getShape();
auto lut_size = lutsShape[lutsShape.size() - 1];
@@ -635,8 +636,8 @@ struct FHELinalgApplyLookupTableToLinalgGeneric
((mlir::Type)lutOp.t().getType()).cast<mlir::RankedTensorType>();
// linalg.init_tensor for initial value
mlir::Value init = rewriter.create<mlir::linalg::InitTensorOp>(
lutOp.getLoc(), resultTy.getShape(), resultTy.getElementType());
mlir::Value init = rewriter.create<bufferization::AllocTensorOp>(
lutOp.getLoc(), resultTy, mlir::ValueRange{});
// Create the affine #maps_0
llvm::SmallVector<mlir::AffineMap, 2> maps{
@@ -733,8 +734,8 @@ struct FHELinalgNegEintToLinalgGeneric
.cast<mlir::RankedTensorType>();
// linalg.init_tensor for initial value
mlir::Value init = rewriter.create<mlir::linalg::InitTensorOp>(
negEintOp.getLoc(), resultTy.getShape(), resultTy.getElementType());
mlir::Value init = rewriter.create<bufferization::AllocTensorOp>(
negEintOp.getLoc(), resultTy, mlir::ValueRange{});
// Create the affine #maps_0
llvm::SmallVector<mlir::AffineMap, 2> maps{
@@ -1633,6 +1634,8 @@ void FHETensorOpsToLinalg::runOnOperation() {
// for conv that works on tensors of custom types
target.addLegalOp<mlir::concretelang::FHELinalg::FhelinalgConv2DNchwFchwOp>();
target.addLegalOp<bufferization::AllocTensorOp>();
mlir::RewritePatternSet patterns(&getContext());
patterns.insert<DotToLinalgGeneric>(&getContext());
patterns.insert<

View File

@@ -11,6 +11,6 @@ add_mlir_dialect_library(FHEToTFHE
LINK_LIBS PUBLIC
MLIRIR
MLIRTransforms
MLIRMath)
MLIRMathDialect)
target_link_libraries(FHEToTFHE PUBLIC MLIRIR)

View File

@@ -15,9 +15,9 @@ add_mlir_dialect_library(MLIRLowerableDialectsToLLVM
ConcretelangConversion
MLIRIR
MLIRTransforms
MLIRLLVMIR
MLIRLLVMIRTransforms
MLIRLLVMToLLVMIRTranslation
MLIROpenMPToLLVMIRTranslation
MLIRMath)
MLIRMathDialect)
target_link_libraries(MLIRLowerableDialectsToLLVM PUBLIC MLIRIR)

View File

@@ -22,7 +22,7 @@
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/Sequence.h"

View File

@@ -12,6 +12,6 @@ add_mlir_dialect_library(TFHEToConcrete
LINK_LIBS PUBLIC
MLIRIR
MLIRTransforms
MLIRMath)
MLIRMathDialect)
target_link_libraries(TFHEToConcrete PUBLIC MLIRIR)

View File

@@ -3,10 +3,11 @@
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// for license information.
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/Operation.h"
@@ -17,6 +18,7 @@
#include "concretelang/Dialect/BConcrete/Transforms/BufferizableOpInterfaceImpl.h"
#include <mlir/IR/AffineExpr.h>
#include <mlir/IR/AffineMap.h>
#include <mlir/IR/BuiltinTypes.h>
using namespace mlir;
using namespace mlir::bufferization;
@@ -164,14 +166,19 @@ struct BufferizableWithCallOpInterface
}
LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
BufferizationState &state) const {
const BufferizationOptions &options) const {
auto loc = op->getLoc();
auto castOp = cast<Op>(op);
// For now we always alloc for the result, we didn't have the in place
// operators yet.
auto outMemref = state.createAlloc(rewriter, loc, castOp.result());
auto resTensorType =
castOp.result().getType().template cast<mlir::TensorType>();
auto outMemrefType = MemRefType::get(resTensorType.getShape(),
resTensorType.getElementType());
auto outMemref = options.createAlloc(rewriter, loc, outMemrefType, {});
if (mlir::failed(outMemref)) {
return mlir::failure();
}
@@ -185,9 +192,8 @@ struct BufferizableWithCallOpInterface
if (!operand.get().getType().isa<mlir::RankedTensorType>()) {
operands.push_back(operand.get());
} else {
auto memrefOperand = *state.getBuffer(
rewriter, operand,
BufferizationState::ForceInPlacability::FORCE_INPLACE);
auto memrefOperand =
bufferization::getBuffer(rewriter, operand.get(), options);
operands.push_back(getCasted1DMemRef(rewriter, loc, memrefOperand));
}
}
@@ -253,21 +259,19 @@ struct BufferizableGlweFromTableOpInterface
/// (tensor<?xi64>, i32, i32, tensor<?xi64>) -> ()
/// ```
LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
BufferizationState &state) const {
const BufferizationOptions &options) const {
auto loc = op->getLoc();
auto castOp = cast<BConcrete::FillGlweFromTable>(op);
auto glweOp = getCasted1DMemRef(
rewriter, loc,
*state.getBuffer(
rewriter, castOp->getOpOperand(0),
BufferizationState::ForceInPlacability::FORCE_INPLACE));
bufferization::getBuffer(rewriter, castOp->getOpOperand(0).get(),
options));
auto lutOp = getCasted1DMemRef(
rewriter, loc,
*state.getBuffer(
rewriter, castOp->getOpOperand(1),
BufferizationState::ForceInPlacability::FORCE_INPLACE));
bufferization::getBuffer(rewriter, castOp->getOpOperand(1).get(),
options));
auto polySizeOp = rewriter.create<mlir::arith::ConstantOp>(
op->getLoc(), rewriter.getI32IntegerAttr(castOp.polynomialSize()));

View File

@@ -10,11 +10,12 @@ add_mlir_dialect_library(ConcretelangBConcreteTransforms
mlir-headers
LINK_LIBS PUBLIC
MLIRArithmetic
MLIRBufferization
ConcretelangConversion
MLIRArithmeticDialect
MLIRBufferizationDialect
MLIRBufferizationTransforms
MLIRIR
MLIRMemRef
MLIRMemRefDialect
MLIRPass
MLIRTransforms
)

View File

@@ -5,7 +5,10 @@
#include <unordered_set>
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Parser/Parser.h"

View File

@@ -6,7 +6,7 @@
#include <mlir/Dialect/Arithmetic/IR/Arithmetic.h>
#include <mlir/Dialect/Func/IR/FuncOps.h>
#include <mlir/Dialect/MemRef/IR/MemRef.h>
#include <mlir/Dialect/SCF/SCF.h>
#include <mlir/Dialect/SCF/IR/SCF.h>
#include <mlir/Dialect/Tensor/IR/Tensor.h>
#include <mlir/IR/PatternMatch.h>
#include <mlir/Transforms/GreedyPatternRewriteDriver.h>

View File

@@ -17,6 +17,7 @@
#include <concretelang/Support/math.h>
#include <mlir/IR/BuiltinOps.h>
#include <mlir/Dialect/Arithmetic/IR/Arithmetic.h>
#include <mlir/Dialect/Func/IR/FuncOps.h>
#include <mlir/Dialect/MemRef/IR/MemRef.h>
#include <mlir/IR/Attributes.h>

View File

@@ -24,6 +24,7 @@
#include <mlir/Conversion/LLVMCommon/ConversionTarget.h>
#include <mlir/Conversion/LLVMCommon/Pattern.h>
#include <mlir/Conversion/LLVMCommon/VectorPattern.h>
#include <mlir/Dialect/Arithmetic/IR/Arithmetic.h>
#include <mlir/Dialect/Bufferization/Transforms/Passes.h>
#include <mlir/Dialect/ControlFlow/IR/ControlFlowOps.h>
#include <mlir/Dialect/Func/IR/FuncOps.h>

View File

@@ -25,6 +25,7 @@
#include <mlir/Conversion/LLVMCommon/ConversionTarget.h>
#include <mlir/Conversion/LLVMCommon/Pattern.h>
#include <mlir/Conversion/LLVMCommon/VectorPattern.h>
#include <mlir/Dialect/Arithmetic/IR/Arithmetic.h>
#include <mlir/Dialect/Func/IR/FuncOps.h>
#include <mlir/Dialect/Func/Transforms/FuncConversions.h>
#include <mlir/Dialect/LLVMIR/FunctionCallUtils.h>

View File

@@ -45,7 +45,7 @@ struct DataflowTaskOpBufferizationInterface
}
LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
BufferizationState &state) const {
const BufferizationOptions &options) const {
DataflowTaskOp taskOp = cast<DataflowTaskOp>(op);
auto isTensorType = [](Type t) { return t.isa<TensorType>(); };
@@ -64,7 +64,8 @@ struct DataflowTaskOpBufferizationInterface
Value oldOperandValue = opOperand.get();
if (oldOperandValue.getType().isa<TensorType>()) {
FailureOr<Value> bufferOrErr = state.getBuffer(rewriter, opOperand);
FailureOr<Value> bufferOrErr =
bufferization::getBuffer(rewriter, opOperand.get(), options);
if (failed(bufferOrErr))
return failure();
@@ -87,7 +88,7 @@ struct DataflowTaskOpBufferizationInterface
for (OpOperand &yieldOperand : yield.getOperation()->getOpOperands())
if (yieldOperand.get().getType().isa<TensorType>()) {
FailureOr<Value> bufferOrErr =
state.getBuffer(rewriter, yieldOperand);
bufferization::getBuffer(rewriter, yieldOperand.get(), options);
if (failed(bufferOrErr))
return WalkResult::interrupt();
@@ -112,7 +113,7 @@ struct DataflowTaskOpBufferizationInterface
for (OpResult res : op->getResults()) {
if (TensorType t = res.getType().dyn_cast<TensorType>()) {
BaseMemRefType memrefType = getMemRefType(t, state.getOptions());
BaseMemRefType memrefType = getMemRefType(t, options);
newResultTypes.push_back(memrefType);
} else {
newResultTypes.push_back(res.getType());

View File

@@ -8,11 +8,11 @@ add_mlir_dialect_library(RTDialectTransforms
mlir-headers
LINK_LIBS PUBLIC
MLIRArithmetic
MLIRBufferization
MLIRArithmeticDialect
MLIRBufferizationDialect
MLIRBufferizationTransforms
MLIRIR
MLIRMemRef
MLIRMemRefDialect
MLIRPass
MLIRTransforms
)

View File

@@ -5,19 +5,23 @@
#include <fstream>
#include <iostream>
#include <mlir/Dialect/Arithmetic/Transforms/BufferizableOpInterfaceImpl.h>
#include <mlir/Dialect/Bufferization/IR/Bufferization.h>
#include <mlir/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.h>
#include <mlir/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.h>
#include <stdio.h>
#include <string>
#include <llvm/Support/Error.h>
#include <llvm/Support/Path.h>
#include <llvm/Support/SMLoc.h>
#include <mlir/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.h>
#include <mlir/Dialect/Func/IR/FuncOps.h>
#include <mlir/Dialect/LLVMIR/LLVMDialect.h>
#include <mlir/Dialect/Linalg/IR/Linalg.h>
#include <mlir/Dialect/MemRef/IR/MemRef.h>
#include <mlir/Dialect/OpenMP/OpenMPDialect.h>
#include <mlir/Dialect/SCF/SCF.h>
#include <mlir/Dialect/SCF/IR/SCF.h>
#include <mlir/ExecutionEngine/OptUtils.h>
#include <mlir/Parser/Parser.h>
@@ -69,6 +73,11 @@ mlir::MLIRContext *CompilationContext::getMLIRContext() {
mlir::scf::SCFDialect, mlir::omp::OpenMPDialect,
mlir::bufferization::BufferizationDialect>();
BConcrete::registerBufferizableOpInterfaceExternalModels(registry);
arith::registerBufferizableOpInterfaceExternalModels(registry);
bufferization::func_ext::registerBufferizableOpInterfaceExternalModels(
registry);
scf::registerBufferizableOpInterfaceExternalModels(registry);
tensor::registerBufferizableOpInterfaceExternalModels(registry);
RT::registerBufferizableOpInterfaceExternalModels(registry);
this->mlirContext = new mlir::MLIRContext();
this->mlirContext->appendDialectRegistry(registry);

View File

@@ -8,6 +8,7 @@
#include <llvm/Support/Error.h>
#include <mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h>
#include <mlir/Conversion/Passes.h>
#include <mlir/Dialect/Bufferization/Transforms/Passes.h>
#include <mlir/Dialect/Func/Transforms/Passes.h>
#include <mlir/Transforms/Passes.h>
@@ -15,7 +16,7 @@
#include <mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h>
#include <mlir/Dialect/Bufferization/Transforms/Passes.h>
#include <mlir/Dialect/Linalg/Passes.h>
#include <mlir/Dialect/SCF/Passes.h>
#include <mlir/Dialect/SCF/Transforms/Passes.h>
#include <mlir/Dialect/Tensor/Transforms/Passes.h>
#include <mlir/ExecutionEngine/OptUtils.h>
#include <mlir/Pass/PassManager.h>
@@ -35,7 +36,6 @@
#include <concretelang/Support/Pipeline.h>
#include <concretelang/Support/logging.h>
#include <concretelang/Support/math.h>
#include <concretelang/Transforms/OneShotBufferizeDPSWrapper.h>
#include <concretelang/Transforms/Passes.h>
namespace mlir {
@@ -250,18 +250,16 @@ lowerStdToLLVMDialect(mlir::MLIRContext &context, mlir::ModuleOp &module,
pipelinePrinting("StdToLLVM", pm, context);
// Bufferize
addPotentiallyNestedPass(
pm, mlir::concretelang::createOneShotBufferizeDPSWrapperPass(),
enablePass);
mlir::bufferization::OneShotBufferizationOptions bufferizationOptions;
bufferizationOptions.allowReturnAllocs = true;
bufferizationOptions.printConflicts = true;
bufferizationOptions.fullyDynamicLayoutMaps = false;
bufferizationOptions.unknownTypeConversion = mlir::bufferization::
OneShotBufferizationOptions::LayoutMapOption::IdentityLayoutMap;
bufferizationOptions.bufferizeFunctionBoundaries = true;
bufferizationOptions.createDeallocs = true;
std::unique_ptr<mlir::Pass> comprBuffPass =
mlir::createLinalgComprehensiveModuleBufferizePass(bufferizationOptions);
mlir::bufferization::createOneShotBufferizePass(bufferizationOptions);
addPotentiallyNestedPass(pm, std::move(comprBuffPass), enablePass);
if (parallelizeLoops) {

View File

@@ -1,5 +1,4 @@
add_mlir_library(ConcretelangTransforms
OneShotBufferizeDPSWrapper.cpp
ForLoopToParallel.cpp
ADDITIONAL_HEADER_DIRS
@@ -8,11 +7,10 @@ add_mlir_library(ConcretelangTransforms
DEPENDS
MLIRTransforms
ConcretelangTransformsBufferizePassIncGen
ConcretelangTransformsOneShotBufferizeDPSWrapperPassIncGen
mlir-headers
LINK_LIBS PUBLIC
MLIRIR
MLIRMemRef
MLIRMemRefDialect
MLIRTransforms
)

View File

@@ -6,7 +6,7 @@
#include "concretelang/Transforms/Passes.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Operation.h"
#include "mlir/Transforms/DialectConversion.h"

View File

@@ -1,202 +0,0 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// for license information.
#include "llvm/ADT/SmallVector.h"
#include <concretelang/Transforms/OneShotBufferizeDPSWrapper.h>
#include <llvm/ADT/STLExtras.h>
#include <mlir/Dialect/Func/IR/FuncOps.h>
#include <mlir/IR/Builders.h>
#include <mlir/IR/BuiltinTypes.h>
namespace {
class OneShotBufferizeDPSWrapperPass
: public OneShotBufferizeDPSWrapperBase<OneShotBufferizeDPSWrapperPass> {
public:
using OneShotBufferizeDPSWrapperBase<
OneShotBufferizeDPSWrapperPass>::OneShotBufferizeDPSWrapperBase;
void runOnOperation() override {
mlir::MLIRContext *context = &this->getContext();
mlir::ModuleOp module = this->getOperation();
mlir::OpBuilder builder(context);
module.walk([&](mlir::func::FuncOp funcOp) {
// Skip forward-declarations
if (funcOp.empty())
return;
// Skip functions that do not return vectors
if (llvm::all_of(funcOp.getFunctionType().getResults(),
[](mlir::Type resultTy) {
return !resultTy.isa<mlir::TensorType>();
}))
return;
// Preserve name and type of the original function
std::string origFuncName = funcOp.getName().str();
mlir::FunctionType origFuncTy = funcOp.getFunctionType();
// New input types of the original function: all original inputs
// plus result memrefs for destination-passing style
std::vector<mlir::Type> newInputTypes =
funcOp.getFunctionType().getInputs().vec();
// New result types of the original function: all original
// results, except tensor results
std::vector<mlir::Type> newResultTypes;
// New function arguments for result memrefs
std::vector<mlir::Value> newDPSArgs;
// The result types of the wrapper function: all original
// results, but tensor results become memrefs
std::vector<mlir::Type> wrapperResultTypes;
for (mlir::Type resultTy : funcOp.getFunctionType().getResults()) {
if (mlir::TensorType tensorResultTy =
resultTy.dyn_cast<mlir::TensorType>()) {
mlir::Type memrefResultTy = mlir::MemRefType::get(
tensorResultTy.getShape(), tensorResultTy.getElementType());
newInputTypes.push_back(memrefResultTy);
wrapperResultTypes.push_back(memrefResultTy);
mlir::Value newDPSArg =
funcOp.getBody().addArgument(memrefResultTy, funcOp.getLoc());
newDPSArgs.push_back(newDPSArg);
} else {
newResultTypes.push_back(resultTy);
wrapperResultTypes.push_back(resultTy);
}
}
// Update name and type of the original function
std::string newFuncName = "__dps_" + origFuncName;
funcOp.setName(newFuncName);
mlir::FunctionType newFuncTy =
mlir::FunctionType::get(context, newInputTypes, newResultTypes);
funcOp.setType(newFuncTy);
// Update the terminators of all blocks by extracting all tensor
// operands, converting them to memrefs, copying their contents
// to the output memrefs and removing them from the terminator.
//
// All non-tensor return values are preserved and returned in
// the same order.
for (mlir::Block &block : funcOp.getBlocks()) {
mlir::Operation *terminator = block.getTerminator();
builder.setInsertionPoint(terminator);
size_t newDPSArgIdx = 0;
size_t operandIdx = 0;
for (mlir::OpOperand &resOperand : terminator->getOpOperands()) {
mlir::Value resVal = resOperand.get();
if (mlir::TensorType resTensorTy =
resVal.getType().dyn_cast<mlir::TensorType>()) {
mlir::Value castedTensor =
builder.create<mlir::bufferization::ToMemrefOp>(
funcOp.getLoc(), newDPSArgs[newDPSArgIdx].getType(),
resVal);
builder.create<mlir::memref::CopyOp>(funcOp.getLoc(), castedTensor,
newDPSArgs[newDPSArgIdx]);
newDPSArgIdx++;
terminator->eraseOperand(operandIdx);
} else {
operandIdx++;
}
}
}
funcOp.setName(newFuncName);
// Generate wrapper function. The wrapper function allocates
// memory for each result tensor of the original function and
// invokes the modified function in destination-passing style
// with the original arguments plus the output memrefs.
//
// The wrapper function returns the results of the original
// function in the same order, but tensor values are replaced by
// the output memrefs.
mlir::FunctionType wrapperFuncTy = mlir::FunctionType::get(
context, origFuncTy.getInputs(), wrapperResultTypes);
builder.setInsertionPoint(funcOp);
mlir::func::FuncOp wrapperFuncOp = builder.create<mlir::func::FuncOp>(
funcOp.getLoc(), origFuncName, wrapperFuncTy,
builder.getStringAttr("private"));
mlir::Block *wrapperEntryBlock = wrapperFuncOp.addEntryBlock();
// Generate call of the original function in destination-passing
// style
builder.setInsertionPointToStart(wrapperEntryBlock);
mlir::func::CallOp callOp =
builder.create<mlir::func::CallOp>(funcOp.getLoc(), funcOp);
builder.create<mlir::func::ReturnOp>(funcOp.getLoc());
mlir::Operation *wrapperTerminator =
wrapperFuncOp.getBody().getBlocks().front().getTerminator();
// Create allocations of the result memrefs in the wrapper
// function and create arguments for the call operation invoking
// the original function in destination-passing style
callOp.getOperation()->setOperands(wrapperFuncOp.getArguments());
builder.setInsertionPoint(callOp);
size_t callArgIndex = callOp.getOperation()->getNumOperands();
llvm::SmallVector<mlir::Value, 1> dpsResultValues;
// Allocate the output memrefs and add to the end of operands to
// the call po inviking the modified function in
// destination-passing style
for (mlir::Value newDPSArg : newDPSArgs) {
mlir::MemRefType memrefTy =
newDPSArg.getType().dyn_cast<mlir::MemRefType>();
mlir::memref::AllocOp allocOp =
builder.create<mlir::memref::AllocOp>(funcOp.getLoc(), memrefTy);
dpsResultValues.push_back(allocOp.getResult());
callOp.getOperation()->insertOperands(callArgIndex,
allocOp.getResult());
callArgIndex++;
}
// Build up the list of operands of the wrapper function,
// composed of the return values of the modified function and
// the memrefs containing the poutput values after invocation of
// the modified function in destination-passing style
size_t dpsResultIndex = 0;
size_t resultIndex = 0;
size_t origResultIndex = 0;
for (mlir::Type origResultTy : origFuncTy.getResults()) {
if (origResultTy.isa<mlir::TensorType>()) {
wrapperTerminator->insertOperands(resultIndex,
dpsResultValues[dpsResultIndex]);
dpsResultIndex++;
} else {
wrapperTerminator->insertOperands(resultIndex,
callOp.getResult(origResultIndex));
origResultIndex++;
}
resultIndex++;
}
});
}
};
} // namespace
std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
mlir::concretelang::createOneShotBufferizeDPSWrapperPass() {
return std::make_unique<OneShotBufferizeDPSWrapperPass>();
}

View File

@@ -20,7 +20,7 @@ target_link_libraries(concretecompiler
ConcretelangSupport
MLIRIR
MLIRLLVMIR
MLIRLLVMIRTransforms
MLIRLLVMToLLVMIRTranslation
RTDialect

View File

@@ -1,10 +1,10 @@
// RUN: concretecompiler --passes concrete-to-bconcrete --action=dump-bconcrete %s 2>&1| FileCheck %s
//CHECK: func @add_glwe(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: func.func @add_glwe(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: %[[V0:.*]] = "BConcrete.add_lwe_buffer"(%[[A0]], %[[A1]]) : (tensor<2049xi64>, tensor<2049xi64>) -> tensor<2049xi64>
//CHECK: return %[[V0]] : tensor<2049xi64>
//CHECK: }
func @add_glwe(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
func.func @add_glwe(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
%0 = "Concrete.add_lwe_ciphertexts"(%arg0, %arg1) : (!Concrete.lwe_ciphertext<2048,7>, !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
return %0 : !Concrete.lwe_ciphertext<2048,7>
}

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --passes concrete-to-bconcrete --action=dump-bconcrete %s 2>&1| FileCheck %s
//CHECK: func @add_glwe_const_int(%arg0: tensor<1025xi64>) -> tensor<1025xi64> {
//CHECK: func.func @add_glwe_const_int(%arg0: tensor<1025xi64>) -> tensor<1025xi64> {
//CHECK: %c1_i8 = arith.constant 1 : i8
//CHECK: %0 = arith.extui %c1_i8 : i8 to i64
//CHECK: %c56_i64 = arith.constant 56 : i64
@@ -9,21 +9,21 @@
//CHECK: %2 = "BConcrete.add_plaintext_lwe_buffer"(%arg0, %1) : (tensor<1025xi64>, i64) -> tensor<1025xi64>
//CHECK: return %2 : tensor<1025xi64>
//CHECK: }
func @add_glwe_const_int(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7> {
func.func @add_glwe_const_int(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7> {
%0 = arith.constant 1 : i8
%1 = "Concrete.encode_int"(%0) : (i8) -> !Concrete.plaintext<8>
%2 = "Concrete.add_plaintext_lwe_ciphertext"(%arg0, %1) : (!Concrete.lwe_ciphertext<1024,7>, !Concrete.plaintext<8>) -> !Concrete.lwe_ciphertext<1024,7>
return %2 : !Concrete.lwe_ciphertext<1024,7>
}
//CHECK: func @add_glwe_int(%arg0: tensor<1025xi64>, %arg1: i5) -> tensor<1025xi64> {
//CHECK: func.func @add_glwe_int(%arg0: tensor<1025xi64>, %arg1: i5) -> tensor<1025xi64> {
//CHECK: %0 = arith.extui %arg1 : i5 to i64
//CHECK: %c59_i64 = arith.constant 59 : i64
//CHECK: %1 = arith.shli %0, %c59_i64 : i64
//CHECK: %2 = "BConcrete.add_plaintext_lwe_buffer"(%arg0, %1) : (tensor<1025xi64>, i64) -> tensor<1025xi64>
//CHECK: return %2 : tensor<1025xi64>
//CHECK: }
func @add_glwe_int(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4> {
func.func @add_glwe_int(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4> {
%0 = "Concrete.encode_int"(%arg1) : (i5) -> !Concrete.plaintext<5>
%1 = "Concrete.add_plaintext_lwe_ciphertext"(%arg0, %0) : (!Concrete.lwe_ciphertext<1024,4>, !Concrete.plaintext<5>) -> !Concrete.lwe_ciphertext<1024,4>
return %1 : !Concrete.lwe_ciphertext<1024,4>

View File

@@ -1,13 +1,13 @@
// RUN: concretecompiler --passes concrete-to-bconcrete --action=dump-bconcrete %s 2>&1| FileCheck %s
//CHECK: func @apply_lookup_table(%[[A0:.*]]: tensor<1025xi64>, %[[A1:.*]]: tensor<16xi64>) -> tensor<1025xi64> {
//CHECK: %[[V0:.*]] = linalg.init_tensor [2048] : tensor<2048xi64>
//CHECK: func.func @apply_lookup_table(%[[A0:.*]]: tensor<1025xi64>, %[[A1:.*]]: tensor<16xi64>) -> tensor<1025xi64> {
//CHECK: %[[V0:.*]] = bufferization.alloc_tensor() : tensor<2048xi64>
//CHECK: "BConcrete.fill_glwe_from_table"(%[[V0]], %[[A1]]) {glweDimension = 1 : i32, outPrecision = 4 : i32, polynomialSize = 1024 : i32} : (tensor<2048xi64>, tensor<16xi64>) -> ()
//CHECK: %[[V1:.*]] = "BConcrete.keyswitch_lwe_buffer"(%[[A0]]) {baseLog = 2 : i32, inputLweDimension = 1 : i32, level = 3 : i32, outputLweDimension = 600 : i32} : (tensor<1025xi64>) -> tensor<601xi64>
//CHECK: %[[V2:.*]] = "BConcrete.bootstrap_lwe_buffer"(%[[V1]], %[[V0]]) {baseLog = 4 : i32, glweDimension = 1 : i32, level = 5 : i32, polynomialSize = 1024 : i32} : (tensor<601xi64>, tensor<2048xi64>) -> tensor<1025xi64>
//CHECK: return %[[V2]] : tensor<1025xi64>
//CHECK: }
func @apply_lookup_table(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: tensor<16xi64>) -> !Concrete.lwe_ciphertext<1024,4> {
func.func @apply_lookup_table(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: tensor<16xi64>) -> !Concrete.lwe_ciphertext<1024,4> {
%0 = "Concrete.glwe_from_table"(%arg1) {glweDimension = 1 : i32, p = 4 : i32, polynomialSize = 1024 : i32} : (tensor<16xi64>) -> !Concrete.glwe_ciphertext<1,1024,4>
%1 = "Concrete.keyswitch_lwe"(%arg0) {baseLog = 2 : i32, inputLweDimension = 1 : i32, level = 3 : i32, outputLweDimension = 600 : i32} : (!Concrete.lwe_ciphertext<1024,4>) -> !Concrete.lwe_ciphertext<600,4>
%2 = "Concrete.bootstrap_lwe"(%1, %0) {baseLog = 4 : i32, glweDimension = 1 : i32, level = 5 : i32, polynomialSize = 1024 : i32} : (!Concrete.lwe_ciphertext<600,4>, !Concrete.glwe_ciphertext<1,1024,4>) -> !Concrete.lwe_ciphertext<1024,4>

View File

@@ -1,14 +1,14 @@
// RUN: concretecompiler --passes concrete-to-bconcrete --action=dump-bconcrete %s 2>&1| FileCheck %s
//CHECK: func @apply_lookup_table_cst(%[[A0:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: func.func @apply_lookup_table_cst(%[[A0:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: %cst = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : tensor<16xi64>
//CHECK: %[[V0:.*]] = linalg.init_tensor [4096] : tensor<4096xi64>
//CHECK: %[[V0:.*]] = bufferization.alloc_tensor() : tensor<4096xi64>
//CHECK: "BConcrete.fill_glwe_from_table"(%[[V0]], %cst) {glweDimension = 1 : i32, outPrecision = 4 : i32, polynomialSize = 2048 : i32} : (tensor<4096xi64>, tensor<16xi64>) -> ()
//CHECK: %[[V1:.*]] = "BConcrete.keyswitch_lwe_buffer"(%[[A0]]) {baseLog = 2 : i32, inputLweDimension = 1 : i32, level = 3 : i32, outputLweDimension = 600 : i32} : (tensor<2049xi64>) -> tensor<601xi64>
//CHECK: %[[V2:.*]] = "BConcrete.bootstrap_lwe_buffer"(%[[V1]], %[[V0]]) {baseLog = 4 : i32, glweDimension = 1 : i32, level = 5 : i32, polynomialSize = 2048 : i32} : (tensor<601xi64>, tensor<4096xi64>) -> tensor<2049xi64>
//CHECK: return %[[V2]] : tensor<2049xi64>
//CHECK: }
func @apply_lookup_table_cst(%arg0: !Concrete.lwe_ciphertext<2048,4>) -> !Concrete.lwe_ciphertext<2048,4> {
func.func @apply_lookup_table_cst(%arg0: !Concrete.lwe_ciphertext<2048,4>) -> !Concrete.lwe_ciphertext<2048,4> {
%tlu = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : tensor<16xi64>
%0 = "Concrete.glwe_from_table"(%tlu) {glweDimension = 1 : i32, p = 4 : i32, polynomialSize = 2048 : i32} : (tensor<16xi64>) -> !Concrete.glwe_ciphertext<1, 2048,4>
%1 = "Concrete.keyswitch_lwe"(%arg0) {baseLog = 2 : i32, inputLweDimension = 1 : i32, level = 3 : i32, outputLweDimension = 600 : i32} : (!Concrete.lwe_ciphertext<2048,4>) -> !Concrete.lwe_ciphertext<600,4>

View File

@@ -1,8 +1,8 @@
// RUN: concretecompiler --passes concrete-to-bconcrete --action=dump-bconcrete %s 2>&1| FileCheck %s
// CHECK: func @identity(%arg0: tensor<1025xi64>) -> tensor<1025xi64> {
// CHECK: func.func @identity(%arg0: tensor<1025xi64>) -> tensor<1025xi64> {
// CHECK-NEXT: return %arg0 : tensor<1025xi64>
// CHECK-NEXT: }
func @identity(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7> {
func.func @identity(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7> {
return %arg0 : !Concrete.lwe_ciphertext<1024,7>
}

View File

@@ -1,25 +1,25 @@
// RUN: concretecompiler --passes concrete-to-bconcrete --action=dump-bconcrete %s 2>&1| FileCheck %s
//CHECK: func @mul_lwe_const_int(%arg0: tensor<1025xi64>) -> tensor<1025xi64> {
//CHECK: func.func @mul_lwe_const_int(%arg0: tensor<1025xi64>) -> tensor<1025xi64> {
//CHECK: %c1_i8 = arith.constant 1 : i8
//CHECK: %0 = arith.extui %c1_i8 : i8 to i64
//CHECK: %1 = "BConcrete.mul_cleartext_lwe_buffer"(%arg0, %0) : (tensor<1025xi64>, i64) -> tensor<1025xi64>
//CHECK: return %1 : tensor<1025xi64>
//CHECK: }
func @mul_lwe_const_int(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7> {
func.func @mul_lwe_const_int(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7> {
%0 = arith.constant 1 : i8
%1 = "Concrete.int_to_cleartext"(%0) : (i8) -> !Concrete.cleartext<8>
%2 = "Concrete.mul_cleartext_lwe_ciphertext"(%arg0, %1) : (!Concrete.lwe_ciphertext<1024,7>, !Concrete.cleartext<8>) -> !Concrete.lwe_ciphertext<1024,7>
return %2 : !Concrete.lwe_ciphertext<1024,7>
}
//CHECK: func @mul_lwe_int(%arg0: tensor<1025xi64>, %arg1: i5) -> tensor<1025xi64> {
//CHECK: func.func @mul_lwe_int(%arg0: tensor<1025xi64>, %arg1: i5) -> tensor<1025xi64> {
//CHECK: %0 = arith.extui %arg1 : i5 to i64
//CHECK: %1 = "BConcrete.mul_cleartext_lwe_buffer"(%arg0, %0) : (tensor<1025xi64>, i64) -> tensor<1025xi64>
//CHECK: return %1 : tensor<1025xi64>
//CHECK: }
func @mul_lwe_int(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4> {
func.func @mul_lwe_int(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4> {
%0 = "Concrete.int_to_cleartext"(%arg1) : (i5) -> !Concrete.cleartext<5>
%1 = "Concrete.mul_cleartext_lwe_ciphertext"(%arg0, %0) : (!Concrete.lwe_ciphertext<1024,4>, !Concrete.cleartext<5>) -> !Concrete.lwe_ciphertext<1024,4>
return %1 : !Concrete.lwe_ciphertext<1024,4>

View File

@@ -1,10 +1,10 @@
// RUN: concretecompiler --passes concrete-to-bconcrete --action=dump-bconcrete %s 2>&1| FileCheck %s
//CHECK: func @neg_lwe(%[[A0:.*]]: tensor<1025xi64>) -> tensor<1025xi64> {
//CHECK: func.func @neg_lwe(%[[A0:.*]]: tensor<1025xi64>) -> tensor<1025xi64> {
//CHECK: %[[V0:.*]] = "BConcrete.negate_lwe_buffer"(%[[A0]]) : (tensor<1025xi64>) -> tensor<1025xi64>
//CHECK: return %[[V0]] : tensor<1025xi64>
//CHECK: }
func @neg_lwe(%arg0: !Concrete.lwe_ciphertext<1024,4>) -> !Concrete.lwe_ciphertext<1024,4> {
func.func @neg_lwe(%arg0: !Concrete.lwe_ciphertext<1024,4>) -> !Concrete.lwe_ciphertext<1024,4> {
%0 = "Concrete.negate_lwe_ciphertext"(%arg0) : (!Concrete.lwe_ciphertext<1024,4>) -> !Concrete.lwe_ciphertext<1024,4>
return %0 : !Concrete.lwe_ciphertext<1024,4>
}

View File

@@ -1,25 +1,25 @@
// RUN: concretecompiler --split-input-file --passes concrete-to-bconcrete --action=dump-bconcrete %s 2>&1| FileCheck %s
// CHECK: func
// DISABLED-CHECK: func @tensor_collapse_shape(%arg0: tensor<2x3x4x5x6x1025xi64>) -> tensor<720x1025xi64> {
// DISABLED-CHECK: func.func @tensor_collapse_shape(%arg0: tensor<2x3x4x5x6x1025xi64>) -> tensor<720x1025xi64> {
// DISABLED-CHECK-NEXT: %0 = bufferization.to_memref %arg0 : memref<2x3x4x5x6x1025xi64>
// DISABLED-CHECK-NEXT: %1 = memref.collapse_shape %0 [[_:\[\[0, 1, 2, 3, 4\], \[5\]\]]] : memref<2x3x4x5x6x1025xi64> into memref<720x1025xi64>
// DISABLED-CHECK-NEXT: %2 = bufferization.to_tensor %1 : memref<720x1025xi64>
// DISABLED-CHECK-NEXT: return %2 : tensor<720x1025xi64>
func @tensor_collapse_shape(%arg0: tensor<2x3x4x5x6x!Concrete.lwe_ciphertext<1024,4>>) -> tensor<720x!Concrete.lwe_ciphertext<1024,4>> {
func.func @tensor_collapse_shape(%arg0: tensor<2x3x4x5x6x!Concrete.lwe_ciphertext<1024,4>>) -> tensor<720x!Concrete.lwe_ciphertext<1024,4>> {
%0 = tensor.collapse_shape %arg0 [[0, 1, 2, 3, 4]] {MANP = 1 : ui1}: tensor<2x3x4x5x6x!Concrete.lwe_ciphertext<1024,4>> into tensor<720x!Concrete.lwe_ciphertext<1024,4>>
return %0 : tensor<720x!Concrete.lwe_ciphertext<1024,4>>
}
// -----
// DISABLED-CHECK: func @tensor_collatenspse_shape(%arg0: tensor<2x3x5x1025xi64>) -> tensor<5x6x1025xi64> {
// DISABLED-CHECK: func.func @tensor_collatenspse_shape(%arg0: tensor<2x3x5x1025xi64>) -> tensor<5x6x1025xi64> {
// DISABLED-CHECK-NEXT: %0 = bufferization.to_memref %arg0 : memref<2x3x5x1025xi64>
// DISABLED-CHECK-NEXT: %1 = memref.collapse_shape %0 [[_:\[\[0, 1, 2\], \[3\]\]]] : memref<2x3x5x1025xi64> into memref<30x1025xi64>
// DISABLED-CHECK-NEXT: %2 = memref.expand_shape %1 [[_:\[\[0, 1\], \[2\]\]]] : memref<30x1025xi64> into memref<5x6x1025xi64>
// DISABLED-CHECK-NEXT: %3 = bufferization.to_tensor %2 : memref<5x6x1025xi64>
// DISABLED-CHECK-NEXT: return %3 : tensor<5x6x1025xi64>
func @tensor_collatenspse_shape(%arg0: tensor<2x3x5x!Concrete.lwe_ciphertext<1024,4>>) -> tensor<5x6x!Concrete.lwe_ciphertext<1024,4>> {
func.func @tensor_collatenspse_shape(%arg0: tensor<2x3x5x!Concrete.lwe_ciphertext<1024,4>>) -> tensor<5x6x!Concrete.lwe_ciphertext<1024,4>> {
%0 = tensor.collapse_shape %arg0 [[0, 1, 2]] {MANP = 1 : ui1}: tensor<2x3x5x!Concrete.lwe_ciphertext<1024,4>> into tensor<30x!Concrete.lwe_ciphertext<1024,4>>
%1 = tensor.expand_shape %0 [[0, 1]] {MANP = 1 : ui1}: tensor<30x!Concrete.lwe_ciphertext<1024,4>> into tensor<5x6x!Concrete.lwe_ciphertext<1024,4>>
return %1 : tensor<5x6x!Concrete.lwe_ciphertext<1024,4>>
@@ -27,12 +27,12 @@ func @tensor_collatenspse_shape(%arg0: tensor<2x3x5x!Concrete.lwe_ciphertext<102
// -----
// DISABLED-CHECK: func @tensor_collatenspse_shape(%arg0: tensor<2x3x2x3x4x1025xi64>) -> tensor<6x2x12x1025xi64> {
// DISABLED-CHECK: func.func @tensor_collatenspse_shape(%arg0: tensor<2x3x2x3x4x1025xi64>) -> tensor<6x2x12x1025xi64> {
// DISABLED-CHECK-NEXT: %0 = bufferization.to_memref %arg0 : memref<2x3x2x3x4x1025xi64>
// DISABLED-CHECK-NEXT: %1 = memref.collapse_shape %0 [[_:\[\[0, 1\], \[2\], \[3, 4\], \[5\]\]]] : memref<2x3x2x3x4x1025xi64> into memref<6x2x12x1025xi64>
// DISABLED-CHECK-NEXT: %2 = bufferization.to_tensor %1 : memref<6x2x12x1025xi64>
// DISABLED-CHECK-NEXT: return %2 : tensor<6x2x12x1025xi64>
func @tensor_collatenspse_shape(%arg0: tensor<2x3x2x3x4x!Concrete.lwe_ciphertext<1024,4>>) -> tensor<6x2x12x!Concrete.lwe_ciphertext<1024,4>> {
func.func @tensor_collatenspse_shape(%arg0: tensor<2x3x2x3x4x!Concrete.lwe_ciphertext<1024,4>>) -> tensor<6x2x12x!Concrete.lwe_ciphertext<1024,4>> {
%0 = tensor.collapse_shape %arg0 [[0, 1], [2], [3, 4]] {MANP = 1 : ui1}: tensor<2x3x2x3x4x!Concrete.lwe_ciphertext<1024,4>> into tensor<6x2x12x!Concrete.lwe_ciphertext<1024,4>>
return %0 : tensor<6x2x12x!Concrete.lwe_ciphertext<1024,4>>
}

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --passes concrete-to-bconcrete --action=dump-bconcrete %s 2>&1| FileCheck %s
// CHECK: func @tensor_identity(%arg0: tensor<2x3x4x1025xi64>) -> tensor<2x3x4x1025xi64> {
// CHECK: func.func @tensor_identity(%arg0: tensor<2x3x4x1025xi64>) -> tensor<2x3x4x1025xi64> {
// CHECK-NEXT: return %arg0 : tensor<2x3x4x1025xi64>
// CHECK-NEXT: }
func @tensor_identity(%arg0: tensor<2x3x4x!Concrete.lwe_ciphertext<1024,7>>) -> tensor<2x3x4x!Concrete.lwe_ciphertext<1024,7>> {
func.func @tensor_identity(%arg0: tensor<2x3x4x!Concrete.lwe_ciphertext<1024,7>>) -> tensor<2x3x4x!Concrete.lwe_ciphertext<1024,7>> {
return %arg0 : tensor<2x3x4x!Concrete.lwe_ciphertext<1024,7>>
}

View File

@@ -2,8 +2,8 @@
// CHECK: #map = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK-NEXT: module {
// CHECK-NEXT: func @apply_lookup_table(%arg0: tensor<2x3x4x!FHE.eint<2>>, %arg1: tensor<4xi64>) -> tensor<2x3x4x!FHE.eint<2>> {
// CHECK-NEXT: %0 = linalg.init_tensor [2, 3, 4] : tensor<2x3x4x!FHE.eint<2>>
// CHECK-NEXT: func.func @apply_lookup_table(%arg0: tensor<2x3x4x!FHE.eint<2>>, %arg1: tensor<4xi64>) -> tensor<2x3x4x!FHE.eint<2>> {
// CHECK-NEXT: %0 = bufferization.alloc_tensor() : tensor<2x3x4x!FHE.eint<2>>
// CHECK-NEXT: %1 = linalg.generic {indexing_maps = [#map, #map], iterator_types = ["parallel", "parallel", "parallel"]} ins(%arg0 : tensor<2x3x4x!FHE.eint<2>>) outs(%0 : tensor<2x3x4x!FHE.eint<2>>) {
// CHECK-NEXT: ^bb0(%arg2: !FHE.eint<2>, %arg3: !FHE.eint<2>):
// CHECK-NEXT: %2 = "FHE.apply_lookup_table"(%arg2, %arg1) : (!FHE.eint<2>, tensor<4xi64>) -> !FHE.eint<2>
@@ -13,7 +13,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: }
func @apply_lookup_table(%arg0: tensor<2x3x4x!FHE.eint<2>>, %arg1: tensor<4xi64>) -> tensor<2x3x4x!FHE.eint<2>> {
func.func @apply_lookup_table(%arg0: tensor<2x3x4x!FHE.eint<2>>, %arg1: tensor<4xi64>) -> tensor<2x3x4x!FHE.eint<2>> {
%1 = "FHELinalg.apply_lookup_table"(%arg0, %arg1): (tensor<2x3x4x!FHE.eint<2>>, tensor<4xi64>) -> (tensor<2x3x4x!FHE.eint<2>>)
return %1: tensor<2x3x4x!FHE.eint<2>>
}

View File

@@ -5,8 +5,8 @@
//CHECK: #map2 = affine_map<(d0, d1) -> (d0, d1, 1)>
//CHECK: #map3 = affine_map<(d0, d1) -> (d0, d1, 2)>
//CHECK: #map4 = affine_map<(d0, d1) -> (d0, d1, 3)>
//CHECK: func @multi_lut(%[[A0:.*]]: tensor<4x4x!FHE.eint<2>>, %[[A1:.*]]: tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>> {
//CHECK: %[[V0:.*]] = linalg.init_tensor [4, 4] : tensor<4x4x!FHE.eint<2>>
//CHECK: func.func @multi_lut(%[[A0:.*]]: tensor<4x4x!FHE.eint<2>>, %[[A1:.*]]: tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>> {
//CHECK: %[[V0:.*]] = bufferization.alloc_tensor() : tensor<4x4x!FHE.eint<2>>
//CHECK: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%[[A0]], %[[A1]], %arg1, %arg1, %arg1 : tensor<4x4x!FHE.eint<2>>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>) outs(%[[V0]] : tensor<4x4x!FHE.eint<2>>) {
//CHECK: ^bb0(%[[A2:.*]]: !FHE.eint<2>, %[[A3:.*]]: i64, %[[A4:.*]]: i64, %[[A5:.*]]: i64, %[[A6:.*]]: i64, %[[A7:.*]]: !FHE.eint<2>):
//CHECK: %[[V2:.*]] = tensor.from_elements %[[A3]], %[[A4]], %[[A5]], %[[A6]] : tensor<4xi64>
@@ -15,7 +15,7 @@
//CHECK: } -> tensor<4x4x!FHE.eint<2>>
//CHECK: return %[[V1]] : tensor<4x4x!FHE.eint<2>>
//CHECK: }
func @multi_lut(%arg0: tensor<4x4x!FHE.eint<2>>, %arg1: tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>> {
func.func @multi_lut(%arg0: tensor<4x4x!FHE.eint<2>>, %arg1: tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>> {
%0 = "FHELinalg.apply_multi_lookup_table"(%arg0, %arg1): (tensor<4x4x!FHE.eint<2>>, tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>>
return %0: tensor<4x4x!FHE.eint<2>>
}

View File

@@ -5,8 +5,8 @@
//CHECK: #map2 = affine_map<(d0, d1) -> (d1, 1)>
//CHECK: #map3 = affine_map<(d0, d1) -> (d1, 2)>
//CHECK: #map4 = affine_map<(d0, d1) -> (d1, 3)>
//CHECK: func @multi_lut(%[[A0:.*]]: tensor<4x3x!FHE.eint<2>>, %[[A1:.*]]: tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>> {
//CHECK: %[[V0:.*]] = linalg.init_tensor [4, 3] : tensor<4x3x!FHE.eint<2>>
//CHECK: func.func @multi_lut(%[[A0:.*]]: tensor<4x3x!FHE.eint<2>>, %[[A1:.*]]: tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>> {
//CHECK: %[[V0:.*]] = bufferization.alloc_tensor() : tensor<4x3x!FHE.eint<2>>
//CHECK: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%[[A0]], %[[A1]], %arg1, %arg1, %arg1 : tensor<4x3x!FHE.eint<2>>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>) outs(%[[V0]] : tensor<4x3x!FHE.eint<2>>) {
//CHECK: ^bb0(%[[A2:.*]]: !FHE.eint<2>, %[[A3:.*]]: i64, %[[A4:.*]]: i64, %[[A5:.*]]: i64, %[[A6:.*]]: i64, %[[A7:.*]]: !FHE.eint<2>):
//CHECK: %[[V2:.*]] = tensor.from_elements %[[A3]], %[[A4]], %[[A5]], %[[A6]] : tensor<4xi64>
@@ -15,7 +15,7 @@
//CHECK: } -> tensor<4x3x!FHE.eint<2>>
//CHECK: return %[[V1]] : tensor<4x3x!FHE.eint<2>>
//CHECK: }
func @multi_lut(%arg0: tensor<4x3x!FHE.eint<2>>, %arg1: tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>> {
func.func @multi_lut(%arg0: tensor<4x3x!FHE.eint<2>>, %arg1: tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>> {
%1 = "FHELinalg.apply_multi_lookup_table"(%arg0, %arg1): (tensor<4x3x!FHE.eint<2>>, tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>>
return %1: tensor<4x3x!FHE.eint<2>>
}

View File

@@ -2,52 +2,52 @@
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<7x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = tensor.insert_slice %[[a0]] into %[[v0]][0] [3] [1] : tensor<3x!FHE.eint<7>> into tensor<7x!FHE.eint<7>>
// CHECK-NEXT: %[[v2:.*]] = tensor.insert_slice %[[a1]] into %[[v1]][3] [4] [1] : tensor<4x!FHE.eint<7>> into tensor<7x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : tensor<7x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<3x!FHE.eint<7>>, %y: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
func.func @main(%x: tensor<3x!FHE.eint<7>>, %y: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) : (tensor<3x!FHE.eint<7>>, tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>>
return %0 : tensor<7x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<7x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = tensor.insert_slice %[[a0]] into %[[v0]][0] [3] [1] : tensor<3x!FHE.eint<7>> into tensor<7x!FHE.eint<7>>
// CHECK-NEXT: %[[v2:.*]] = tensor.insert_slice %[[a1]] into %[[v1]][3] [4] [1] : tensor<4x!FHE.eint<7>> into tensor<7x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : tensor<7x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<3x!FHE.eint<7>>, %y: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
func.func @main(%x: tensor<3x!FHE.eint<7>>, %y: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 0 } : (tensor<3x!FHE.eint<7>>, tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>>
return %0 : tensor<7x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = tensor.insert_slice %[[a0]] into %[[v0]][0, 0] [3, 4] [1, 1] : tensor<3x4x!FHE.eint<7>> into tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v2:.*]] = tensor.insert_slice %[[a1]] into %[[v1]][3, 0] [4, 4] [1, 1] : tensor<4x4x!FHE.eint<7>> into tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) : (tensor<3x4x!FHE.eint<7>>, tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>>
return %0 : tensor<7x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = tensor.insert_slice %[[a0]] into %[[v0]][0, 0] [3, 4] [1, 1] : tensor<3x4x!FHE.eint<7>> into tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v2:.*]] = tensor.insert_slice %[[a1]] into %[[v1]][3, 0] [4, 4] [1, 1] : tensor<4x4x!FHE.eint<7>> into tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 0 } : (tensor<3x4x!FHE.eint<7>>, tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>>
return %0 : tensor<7x4x!FHE.eint<7>>
}
@@ -55,65 +55,65 @@ func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<4x3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<4x3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<4x7x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = tensor.insert_slice %[[a0]] into %[[v0]][0, 0] [4, 3] [1, 1] : tensor<4x3x!FHE.eint<7>> into tensor<4x7x!FHE.eint<7>>
// CHECK-NEXT: %[[v2:.*]] = tensor.insert_slice %[[a1]] into %[[v1]][0, 3] [4, 4] [1, 1] : tensor<4x4x!FHE.eint<7>> into tensor<4x7x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : tensor<4x7x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<4x3x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>> {
func.func @main(%x: tensor<4x3x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 1 } : (tensor<4x3x!FHE.eint<7>>, tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>>
return %0 : tensor<4x7x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = tensor.insert_slice %[[a0]] into %[[v0]][0, 0, 0] [2, 3, 4] [1, 1, 1] : tensor<2x3x4x!FHE.eint<7>> into tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v2:.*]] = tensor.insert_slice %[[a1]] into %[[v1]][2, 0, 0] [2, 3, 4] [1, 1, 1] : tensor<2x3x4x!FHE.eint<7>> into tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
func.func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>>
return %0 : tensor<4x3x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = tensor.insert_slice %[[a0]] into %[[v0]][0, 0, 0] [2, 3, 4] [1, 1, 1] : tensor<2x3x4x!FHE.eint<7>> into tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v2:.*]] = tensor.insert_slice %[[a1]] into %[[v1]][2, 0, 0] [2, 3, 4] [1, 1, 1] : tensor<2x3x4x!FHE.eint<7>> into tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
func.func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 0 } : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>>
return %0 : tensor<4x3x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<2x6x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = tensor.insert_slice %[[a0]] into %[[v0]][0, 0, 0] [2, 3, 4] [1, 1, 1] : tensor<2x3x4x!FHE.eint<7>> into tensor<2x6x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v2:.*]] = tensor.insert_slice %[[a1]] into %[[v1]][0, 3, 0] [2, 3, 4] [1, 1, 1] : tensor<2x3x4x!FHE.eint<7>> into tensor<2x6x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : tensor<2x6x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>> {
func.func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 1 } : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>>
return %0 : tensor<2x6x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<2x3x8x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = tensor.insert_slice %[[a0]] into %[[v0]][0, 0, 0] [2, 3, 4] [1, 1, 1] : tensor<2x3x4x!FHE.eint<7>> into tensor<2x3x8x!FHE.eint<7>>
// CHECK-NEXT: %[[v2:.*]] = tensor.insert_slice %[[a1]] into %[[v1]][0, 0, 4] [2, 3, 4] [1, 1, 1] : tensor<2x3x4x!FHE.eint<7>> into tensor<2x3x8x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : tensor<2x3x8x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>> {
func.func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 2 } : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>>
return %0 : tensor<2x3x8x!FHE.eint<7>>
}

View File

@@ -2,22 +2,22 @@
// -----
// CHECK: func @main(%[[a0:.*]]: !FHE.eint<7>) -> tensor<1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: !FHE.eint<7>) -> tensor<1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = tensor.from_elements %[[a0]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: !FHE.eint<7>) -> tensor<1x!FHE.eint<7>> {
func.func @main(%arg0: !FHE.eint<7>) -> tensor<1x!FHE.eint<7>> {
%1 = "FHELinalg.from_element"(%arg0) : (!FHE.eint<7>) -> tensor<1x!FHE.eint<7>>
return %1 : tensor<1x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: i8) -> tensor<1xi8> {
// CHECK: func.func @main(%[[a0:.*]]: i8) -> tensor<1xi8> {
// CHECK-NEXT: %[[v0:.*]] = tensor.from_elements %[[a0]] : tensor<1xi8>
// CHECK-NEXT: return %[[v0]] : tensor<1xi8>
// CHECK-NEXT: }
func @main(%arg0: i8) -> tensor<1xi8> {
func.func @main(%arg0: i8) -> tensor<1xi8> {
%1 = "FHELinalg.from_element"(%arg0) : (i8) -> tensor<1xi8>
return %1 : tensor<1xi8>
}

View File

@@ -6,7 +6,7 @@
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2) -> (d2, d1)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2) -> (d0, d1)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<4x2xi6>) -> tensor<3x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<4x2xi6>) -> tensor<3x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<3x4x!FHE.eint<5>>, tensor<4x2xi6>) outs(%[[v0]] : tensor<3x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -16,7 +16,7 @@
// CHECK-NEXT: } -> tensor<3x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<3x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<3x4x!FHE.eint<5>>, %y: tensor<4x2xi6>) -> tensor<3x2x!FHE.eint<5>> {
func.func @main(%x: tensor<3x4x!FHE.eint<5>>, %y: tensor<4x2xi6>) -> tensor<3x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<3x4x!FHE.eint<5>>, tensor<4x2xi6>) -> tensor<3x2x!FHE.eint<5>>
return %0 : tensor<3x2x!FHE.eint<5>>
}
@@ -27,7 +27,7 @@ func @main(%x: tensor<3x4x!FHE.eint<5>>, %y: tensor<4x2xi6>) -> tensor<3x2x!FHE.
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1) -> (d1)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x!FHE.eint<5>>, %[[a1:.*]]: tensor<3x2xi6>) -> tensor<2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x!FHE.eint<5>>, %[[a1:.*]]: tensor<3x2xi6>) -> tensor<2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["reduction", "parallel"]} ins(%[[a0]], %[[a1]] : tensor<3x!FHE.eint<5>>, tensor<3x2xi6>) outs(%[[v0]] : tensor<2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -37,7 +37,7 @@ func @main(%x: tensor<3x4x!FHE.eint<5>>, %y: tensor<4x2xi6>) -> tensor<3x2x!FHE.
// CHECK-NEXT: } -> tensor<2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<3x2xi6>) -> tensor<2x!FHE.eint<5>> {
func.func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<3x2xi6>) -> tensor<2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<3x!FHE.eint<5>>, tensor<3x2xi6>) -> tensor<2x!FHE.eint<5>>
return %0 : tensor<2x!FHE.eint<5>>
}
@@ -48,7 +48,7 @@ func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<3x2xi6>) -> tensor<2x!FHE.eint
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2) -> (d0, d2)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x3x2xi6>) -> tensor<5x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x3x2xi6>) -> tensor<5x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<5x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "reduction", "parallel"]} ins(%[[a0]], %[[a1]] : tensor<3x!FHE.eint<5>>, tensor<5x3x2xi6>) outs(%[[v0]] : tensor<5x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -58,7 +58,7 @@ func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<3x2xi6>) -> tensor<2x!FHE.eint
// CHECK-NEXT: } -> tensor<5x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<5x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<5x3x2xi6>) -> tensor<5x2x!FHE.eint<5>> {
func.func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<5x3x2xi6>) -> tensor<5x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<3x!FHE.eint<5>>, tensor<5x3x2xi6>) -> tensor<5x2x!FHE.eint<5>>
return %0 : tensor<5x2x!FHE.eint<5>>
}
@@ -69,7 +69,7 @@ func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<5x3x2xi6>) -> tensor<5x2x!FHE.
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d1, d3)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x!FHE.eint<5>>, %[[a1:.*]]: tensor<4x5x3x2xi6>) -> tensor<4x5x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x!FHE.eint<5>>, %[[a1:.*]]: tensor<4x5x3x2xi6>) -> tensor<4x5x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<4x5x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "reduction", "parallel"]} ins(%[[a0]], %[[a1]] : tensor<3x!FHE.eint<5>>, tensor<4x5x3x2xi6>) outs(%[[v0]] : tensor<4x5x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -79,7 +79,7 @@ func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<5x3x2xi6>) -> tensor<5x2x!FHE.
// CHECK-NEXT: } -> tensor<4x5x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<4x5x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<4x5x3x2xi6>) -> tensor<4x5x2x!FHE.eint<5>> {
func.func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<4x5x3x2xi6>) -> tensor<4x5x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<3x!FHE.eint<5>>, tensor<4x5x3x2xi6>) -> tensor<4x5x2x!FHE.eint<5>>
return %0 : tensor<4x5x2x!FHE.eint<5>>
}
@@ -90,7 +90,7 @@ func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<4x5x3x2xi6>) -> tensor<4x5x2x!
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1) -> (d1)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1) -> (d0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x2x!FHE.eint<5>>, %[[a1:.*]]: tensor<2xi6>) -> tensor<3x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x2x!FHE.eint<5>>, %[[a1:.*]]: tensor<2xi6>) -> tensor<3x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<3x2x!FHE.eint<5>>, tensor<2xi6>) outs(%[[v0]] : tensor<3x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -100,7 +100,7 @@ func @main(%x: tensor<3x!FHE.eint<5>>, %y: tensor<4x5x3x2xi6>) -> tensor<4x5x2x!
// CHECK-NEXT: } -> tensor<3x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<3x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<3x!FHE.eint<5>> {
func.func @main(%x: tensor<3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<3x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<3x2x!FHE.eint<5>>, tensor<2xi6>) -> tensor<3x!FHE.eint<5>>
return %0 : tensor<3x!FHE.eint<5>>
}
@@ -111,7 +111,7 @@ func @main(%x: tensor<3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<3x!FHE.eint
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2) -> (d2)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2) -> (d0, d1)>
// CHECK: func @main(%[[a0:.*]]: tensor<5x3x2x!FHE.eint<5>>, %[[a1:.*]]: tensor<2xi6>) -> tensor<5x3x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<5x3x2x!FHE.eint<5>>, %[[a1:.*]]: tensor<2xi6>) -> tensor<5x3x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<5x3x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<5x3x2x!FHE.eint<5>>, tensor<2xi6>) outs(%[[v0]] : tensor<5x3x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -121,7 +121,7 @@ func @main(%x: tensor<3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<3x!FHE.eint
// CHECK-NEXT: } -> tensor<5x3x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<5x3x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<5x3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<5x3x!FHE.eint<5>> {
func.func @main(%x: tensor<5x3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<5x3x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<5x3x2x!FHE.eint<5>>, tensor<2xi6>) -> tensor<5x3x!FHE.eint<5>>
return %0 : tensor<5x3x!FHE.eint<5>>
}
@@ -132,7 +132,7 @@ func @main(%x: tensor<5x3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<5x3x!FHE.
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3) -> (d3)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2)>
// CHECK: func @main(%[[a0:.*]]: tensor<4x5x3x2x!FHE.eint<5>>, %[[a1:.*]]: tensor<2xi6>) -> tensor<4x5x3x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<4x5x3x2x!FHE.eint<5>>, %[[a1:.*]]: tensor<2xi6>) -> tensor<4x5x3x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<4x5x3x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<4x5x3x2x!FHE.eint<5>>, tensor<2xi6>) outs(%[[v0]] : tensor<4x5x3x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -142,7 +142,7 @@ func @main(%x: tensor<5x3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<5x3x!FHE.
// CHECK-NEXT: } -> tensor<4x5x3x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<4x5x3x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<4x5x3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<4x5x3x!FHE.eint<5>> {
func.func @main(%x: tensor<4x5x3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<4x5x3x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<4x5x3x2x!FHE.eint<5>>, tensor<2xi6>) -> tensor<4x5x3x!FHE.eint<5>>
return %0 : tensor<4x5x3x!FHE.eint<5>>
}
@@ -153,7 +153,7 @@ func @main(%x: tensor<4x5x3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<4x5x3x!
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d3, d2)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2)>
// CHECK: func @main(%[[a0:.*]]: tensor<5x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<5x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<5x3x4x!FHE.eint<5>>, tensor<5x4x2xi6>) outs(%[[v0]] : tensor<5x3x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -163,7 +163,7 @@ func @main(%x: tensor<4x5x3x2x!FHE.eint<5>>, %y: tensor<2xi6>) -> tensor<4x5x3x!
// CHECK-NEXT: } -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
func.func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<5x3x4x!FHE.eint<5>>, tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>>
return %0 : tensor<5x3x2x!FHE.eint<5>>
}
@@ -174,7 +174,7 @@ func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3) -> (0, d3, d2)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2)>
// CHECK: func @main(%[[a0:.*]]: tensor<5x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<1x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<5x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<1x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<5x3x4x!FHE.eint<5>>, tensor<1x4x2xi6>) outs(%[[v0]] : tensor<5x3x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -184,7 +184,7 @@ func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2
// CHECK-NEXT: } -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<1x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
func.func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<1x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<5x3x4x!FHE.eint<5>>, tensor<1x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>>
return %0 : tensor<5x3x2x!FHE.eint<5>>
}
@@ -195,7 +195,7 @@ func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<1x4x2xi6>) -> tensor<5x3x2
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d3, d2)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2)>
// CHECK: func @main(%[[a0:.*]]: tensor<1x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<1x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<1x3x4x!FHE.eint<5>>, tensor<5x4x2xi6>) outs(%[[v0]] : tensor<5x3x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -205,7 +205,7 @@ func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<1x4x2xi6>) -> tensor<5x3x2
// CHECK-NEXT: } -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<1x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
func.func @main(%x: tensor<1x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<1x3x4x!FHE.eint<5>>, tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>>
return %0 : tensor<5x3x2x!FHE.eint<5>>
}
@@ -216,7 +216,7 @@ func @main(%x: tensor<1x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3) -> (d3, d2)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2)>
// CHECK: func @main(%[[a0:.*]]: tensor<5x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<5x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<5x3x4x!FHE.eint<5>>, tensor<4x2xi6>) outs(%[[v0]] : tensor<5x3x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -226,7 +226,7 @@ func @main(%x: tensor<1x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2
// CHECK-NEXT: } -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
func.func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<5x3x4x!FHE.eint<5>>, tensor<4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>>
return %0 : tensor<5x3x2x!FHE.eint<5>>
}
@@ -237,7 +237,7 @@ func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<4x2xi6>) -> tensor<5x3x2x!
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d3, d2)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<3x4x!FHE.eint<5>>, tensor<5x4x2xi6>) outs(%[[v0]] : tensor<5x3x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -247,7 +247,7 @@ func @main(%x: tensor<5x3x4x!FHE.eint<5>>, %y: tensor<4x2xi6>) -> tensor<5x3x2x!
// CHECK-NEXT: } -> tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<5x3x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
func.func @main(%x: tensor<3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<3x4x!FHE.eint<5>>, tensor<5x4x2xi6>) -> tensor<5x3x2x!FHE.eint<5>>
return %0 : tensor<5x3x2x!FHE.eint<5>>
}
@@ -258,7 +258,7 @@ func @main(%x: tensor<3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2x!
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d4, d3)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d2, d3)>
// CHECK: func @main(%[[a0:.*]]: tensor<2x5x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<2x5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x5x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<2x5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<2x5x3x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<2x5x3x4x!FHE.eint<5>>, tensor<2x5x4x2xi6>) outs(%[[v0]] : tensor<2x5x3x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -268,7 +268,7 @@ func @main(%x: tensor<3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<5x3x2x!
// CHECK-NEXT: } -> tensor<2x5x3x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<2x5x3x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<2x5x3x4x!FHE.eint<5>>, %y: tensor<2x5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>> {
func.func @main(%x: tensor<2x5x3x4x!FHE.eint<5>>, %y: tensor<2x5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<2x5x3x4x!FHE.eint<5>>, tensor<2x5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>>
return %0 : tensor<2x5x3x2x!FHE.eint<5>>
}
@@ -279,7 +279,7 @@ func @main(%x: tensor<2x5x3x4x!FHE.eint<5>>, %y: tensor<2x5x4x2xi6>) -> tensor<2
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3, d4) -> (d1, d4, d3)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d2, d3)>
// CHECK: func @main(%[[a0:.*]]: tensor<2x1x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x1x3x4x!FHE.eint<5>>, %[[a1:.*]]: tensor<5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<2x5x3x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<2x1x3x4x!FHE.eint<5>>, tensor<5x4x2xi6>) outs(%[[v0]] : tensor<2x5x3x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -289,7 +289,7 @@ func @main(%x: tensor<2x5x3x4x!FHE.eint<5>>, %y: tensor<2x5x4x2xi6>) -> tensor<2
// CHECK-NEXT: } -> tensor<2x5x3x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<2x5x3x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<2x1x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>> {
func.func @main(%x: tensor<2x1x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<2x1x3x4x!FHE.eint<5>>, tensor<5x4x2xi6>) -> tensor<2x5x3x2x!FHE.eint<5>>
return %0 : tensor<2x5x3x2x!FHE.eint<5>>
}
@@ -300,7 +300,7 @@ func @main(%x: tensor<2x1x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<2x5
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2, d3, d4) -> (0, d4, d3)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d2, d3)>
// CHECK: func @main(%[[a0:.*]]: tensor<2x5x4x3x!FHE.eint<5>>, %[[a1:.*]]: tensor<1x3x2xi6>) -> tensor<2x5x4x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x5x4x3x!FHE.eint<5>>, %[[a1:.*]]: tensor<1x3x2xi6>) -> tensor<2x5x4x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<2x5x4x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<2x5x4x3x!FHE.eint<5>>, tensor<1x3x2xi6>) outs(%[[v0]] : tensor<2x5x4x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<5>, %[[aa1:.*]]: i6, %[[aa2:.*]]: !FHE.eint<5>):
@@ -310,7 +310,7 @@ func @main(%x: tensor<2x1x3x4x!FHE.eint<5>>, %y: tensor<5x4x2xi6>) -> tensor<2x5
// CHECK-NEXT: } -> tensor<2x5x4x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<2x5x4x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<2x5x4x3x!FHE.eint<5>>, %y: tensor<1x3x2xi6>) -> tensor<2x5x4x2x!FHE.eint<5>> {
func.func @main(%x: tensor<2x5x4x3x!FHE.eint<5>>, %y: tensor<1x3x2xi6>) -> tensor<2x5x4x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_eint_int"(%x, %y): (tensor<2x5x4x3x!FHE.eint<5>>, tensor<1x3x2xi6>) -> tensor<2x5x4x2x!FHE.eint<5>>
return %0 : tensor<2x5x4x2x!FHE.eint<5>>
}
@@ -321,7 +321,7 @@ func @main(%x: tensor<2x5x4x3x!FHE.eint<5>>, %y: tensor<1x3x2xi6>) -> tensor<2x5
// CHECK-NEXT: #[[m1:.*]] = affine_map<(d0, d1, d2) -> (d2, d1)>
// CHECK-NEXT: #[[m2:.*]] = affine_map<(d0, d1, d2) -> (d0, d1)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4xi6>, %[[a1:.*]]: tensor<4x2x!FHE.eint<5>>) -> tensor<3x2x!FHE.eint<5>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4xi6>, %[[a1:.*]]: tensor<4x2x!FHE.eint<5>>) -> tensor<3x2x!FHE.eint<5>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x2x!FHE.eint<5>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[m0]], #[[m1]], #[[m2]]], iterator_types = ["parallel", "parallel", "reduction"]} ins(%[[a0]], %[[a1]] : tensor<3x4xi6>, tensor<4x2x!FHE.eint<5>>) outs(%[[v0]] : tensor<3x2x!FHE.eint<5>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: i6, %[[aa1:.*]]: !FHE.eint<5>, %[[aa2:.*]]: !FHE.eint<5>):
@@ -331,7 +331,7 @@ func @main(%x: tensor<2x5x4x3x!FHE.eint<5>>, %y: tensor<1x3x2xi6>) -> tensor<2x5
// CHECK-NEXT: } -> tensor<3x2x!FHE.eint<5>>
// CHECK-NEXT: return %[[v1]] : tensor<3x2x!FHE.eint<5>>
// CHECK-NEXT: }
func @main(%x: tensor<3x4xi6>, %y: tensor<4x2x!FHE.eint<5>>) -> tensor<3x2x!FHE.eint<5>> {
func.func @main(%x: tensor<3x4xi6>, %y: tensor<4x2x!FHE.eint<5>>) -> tensor<3x2x!FHE.eint<5>> {
%0 = "FHELinalg.matmul_int_eint"(%x, %y): (tensor<3x4xi6>, tensor<4x2x!FHE.eint<5>>) -> tensor<3x2x!FHE.eint<5>>
return %0 : tensor<3x2x!FHE.eint<5>>
}

View File

@@ -2,8 +2,8 @@
// CHECK: #map = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK-NEXT: module {
// CHECK-NEXT: func @neg_eint(%arg0: tensor<2x3x4x!FHE.eint<2>>) -> tensor<2x3x4x!FHE.eint<2>> {
// CHECK-NEXT: %0 = linalg.init_tensor [2, 3, 4] : tensor<2x3x4x!FHE.eint<2>>
// CHECK-NEXT: func.func @neg_eint(%arg0: tensor<2x3x4x!FHE.eint<2>>) -> tensor<2x3x4x!FHE.eint<2>> {
// CHECK-NEXT: %0 = bufferization.alloc_tensor() : tensor<2x3x4x!FHE.eint<2>>
// CHECK-NEXT: %1 = linalg.generic {indexing_maps = [#map, #map], iterator_types = ["parallel", "parallel", "parallel"]} ins(%arg0 : tensor<2x3x4x!FHE.eint<2>>) outs(%0 : tensor<2x3x4x!FHE.eint<2>>) {
// CHECK-NEXT: ^bb0(%arg1: !FHE.eint<2>, %arg2: !FHE.eint<2>):
// CHECK-NEXT: %2 = "FHE.neg_eint"(%arg1) : (!FHE.eint<2>) -> !FHE.eint<2>
@@ -13,7 +13,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: }
func @neg_eint(%arg0: tensor<2x3x4x!FHE.eint<2>>) -> tensor<2x3x4x!FHE.eint<2>> {
func.func @neg_eint(%arg0: tensor<2x3x4x!FHE.eint<2>>) -> tensor<2x3x4x!FHE.eint<2>> {
%1 = "FHELinalg.neg_eint"(%arg0): (tensor<2x3x4x!FHE.eint<2>>) -> (tensor<2x3x4x!FHE.eint<2>>)
return %1: tensor<2x3x4x!FHE.eint<2>>
}

View File

@@ -2,66 +2,66 @@
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<0x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<0x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero"() : () -> !FHE.eint<7>
// CHECK-NEXT: return %[[v0]] : !FHE.eint<7>
// CHECK-NEXT: }
func @main(%arg0: tensor<0x!FHE.eint<7>>) -> !FHE.eint<7> {
func.func @main(%arg0: tensor<0x!FHE.eint<7>>) -> !FHE.eint<7> {
%0 = "FHELinalg.sum"(%arg0) : (tensor<0x!FHE.eint<7>>) -> !FHE.eint<7>
return %0 : !FHE.eint<7>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero"() : () -> !FHE.eint<7>
// CHECK-NEXT: return %[[v0]] : !FHE.eint<7>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> !FHE.eint<7> {
func.func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> !FHE.eint<7> {
%0 = "FHELinalg.sum"(%arg0) : (tensor<3x0x4x!FHE.eint<7>>) -> !FHE.eint<7>
return %0 : !FHE.eint<7>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<3x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x4x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x4x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [1] } : (tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x4x!FHE.eint<7>>
return %0 : tensor<3x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x1x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x1x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x1x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<3x1x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x1x4x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x1x4x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [1], keep_dims = true } : (tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x1x4x!FHE.eint<7>>
return %0 : tensor<3x1x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x0x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<3x0x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [2] } : (tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x!FHE.eint<7>>
return %0 : tensor<3x0x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x0x1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<3x0x1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x1x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x1x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [2], keep_dims = true } : (tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x1x!FHE.eint<7>>
return %0 : tensor<3x0x1x!FHE.eint<7>>
}
@@ -71,7 +71,7 @@ func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x1x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0) -> (d0)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0) -> (0)>
// CHECK: func @main(%[[a0:.*]]: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction"]} ins(%[[a0]] : tensor<4x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -82,7 +82,7 @@ func @main(%arg0: tensor<3x0x4x!FHE.eint<7>>) -> tensor<3x0x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v2:.*]] = tensor.extract %[[v1]][%[[c0]]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : !FHE.eint<7>
// CHECK-NEXT: }
func @main(%arg0: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
func.func @main(%arg0: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
%0 = "FHELinalg.sum"(%arg0) : (tensor<4x!FHE.eint<7>>) -> !FHE.eint<7>
return %0 : !FHE.eint<7>
}
@@ -92,7 +92,7 @@ func @main(%arg0: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0) -> (d0)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0) -> (0)>
// CHECK: func @main(%[[a0:.*]]: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction"]} ins(%[[a0]] : tensor<4x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -103,7 +103,7 @@ func @main(%arg0: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[v2:.*]] = tensor.extract %[[v1]][%[[c0]]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : !FHE.eint<7>
// CHECK-NEXT: }
func @main(%arg0: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
func.func @main(%arg0: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0] } : (tensor<4x!FHE.eint<7>>) -> !FHE.eint<7>
return %0 : !FHE.eint<7>
}
@@ -113,7 +113,7 @@ func @main(%arg0: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0) -> (d0)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0) -> (0)>
// CHECK: func @main(%[[a0:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction"]} ins(%[[a0]] : tensor<4x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -122,7 +122,7 @@ func @main(%arg0: tensor<4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: } -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
func.func @main(%arg0: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { keep_dims = true } : (tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>>
return %0 : tensor<1x!FHE.eint<7>>
}
@@ -132,7 +132,7 @@ func @main(%arg0: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0) -> (d0)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0) -> (0)>
// CHECK: func @main(%[[a0:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction"]} ins(%[[a0]] : tensor<4x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -141,7 +141,7 @@ func @main(%arg0: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
// CHECK-NEXT: } -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
func.func @main(%arg0: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0], keep_dims = true } : (tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>>
return %0 : tensor<1x!FHE.eint<7>>
}
@@ -151,7 +151,7 @@ func @main(%arg0: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "reduction"]} ins(%[[a0]] : tensor<3x4x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -162,7 +162,7 @@ func @main(%arg0: tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v2:.*]] = tensor.extract %[[v1]][%[[c0]]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : !FHE.eint<7>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
func.func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
%0 = "FHELinalg.sum"(%arg0) : (tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7>
return %0 : !FHE.eint<7>
}
@@ -172,7 +172,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (0, 0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "reduction"]} ins(%[[a0]] : tensor<3x4x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -181,7 +181,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: } -> tensor<1x1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<1x1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { keep_dims = true } : (tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>>
return %0 : tensor<1x1x!FHE.eint<7>>
}
@@ -191,7 +191,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (d1)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<4x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "parallel"]} ins(%[[a0]] : tensor<3x4x!FHE.eint<7>>) outs(%[[v0]] : tensor<4x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -200,7 +200,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
// CHECK-NEXT: } -> tensor<4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0] } : (tensor<3x4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>>
return %0 : tensor<4x!FHE.eint<7>>
}
@@ -210,7 +210,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (0, d1)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<1x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<1x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x4x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "parallel"]} ins(%[[a0]] : tensor<3x4x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x4x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -219,7 +219,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// CHECK-NEXT: } -> tensor<1x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<1x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x4x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x4x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0], keep_dims = true } : (tensor<3x4x!FHE.eint<7>>) -> tensor<1x4x!FHE.eint<7>>
return %0 : tensor<1x4x!FHE.eint<7>>
}
@@ -229,7 +229,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x4x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (d0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<3x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<3x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["parallel", "reduction"]} ins(%[[a0]] : tensor<3x4x!FHE.eint<7>>) outs(%[[v0]] : tensor<3x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -238,7 +238,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x4x!FHE.eint<7>> {
// CHECK-NEXT: } -> tensor<3x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<3x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<3x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<3x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [1] } : (tensor<3x4x!FHE.eint<7>>) -> tensor<3x!FHE.eint<7>>
return %0 : tensor<3x!FHE.eint<7>>
}
@@ -248,7 +248,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<3x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (d0, 0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<3x1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<3x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["parallel", "reduction"]} ins(%[[a0]] : tensor<3x4x!FHE.eint<7>>) outs(%[[v0]] : tensor<3x1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -257,7 +257,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<3x!FHE.eint<7>> {
// CHECK-NEXT: } -> tensor<3x1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<3x1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<3x1x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<3x1x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [1], keep_dims = true } : (tensor<3x4x!FHE.eint<7>>) -> tensor<3x1x!FHE.eint<7>>
return %0 : tensor<3x1x!FHE.eint<7>>
}
@@ -267,7 +267,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<3x1x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "reduction"]} ins(%[[a0]] : tensor<3x4x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -278,7 +278,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<3x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v2:.*]] = tensor.extract %[[v1]][%[[c0]]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : !FHE.eint<7>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
func.func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0, 1] } : (tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7>
return %0 : !FHE.eint<7>
}
@@ -288,7 +288,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (0, 0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "reduction"]} ins(%[[a0]] : tensor<3x4x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -297,7 +297,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: } -> tensor<1x1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<1x1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0, 1], keep_dims = true } : (tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>>
return %0 : tensor<1x1x!FHE.eint<7>>
}
@@ -307,7 +307,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1, d2) -> (0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "reduction", "reduction"]} ins(%[[a0]] : tensor<3x4x2x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -318,7 +318,7 @@ func @main(%arg0: tensor<3x4x!FHE.eint<7>>) -> tensor<1x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v2:.*]] = tensor.extract %[[v1]][%[[c0]]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : !FHE.eint<7>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
func.func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
%0 = "FHELinalg.sum"(%arg0) : (tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7>
return %0 : !FHE.eint<7>
}
@@ -328,7 +328,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1, d2) -> (0, 0, 0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x1x1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "reduction", "reduction"]} ins(%[[a0]] : tensor<3x4x2x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x1x1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -337,7 +337,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: } -> tensor<1x1x1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<1x1x1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { keep_dims = true } : (tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>>
return %0 : tensor<1x1x1x!FHE.eint<7>>
}
@@ -347,7 +347,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1, d2) -> (d0, d2)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x2x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x2x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x2x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["parallel", "reduction", "parallel"]} ins(%[[a0]] : tensor<3x4x2x!FHE.eint<7>>) outs(%[[v0]] : tensor<3x2x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -356,7 +356,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
// CHECK-NEXT: } -> tensor<3x2x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<3x2x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x2x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x2x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [1] } : (tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x2x!FHE.eint<7>>
return %0 : tensor<3x2x!FHE.eint<7>>
}
@@ -366,7 +366,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x2x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1, d2) -> (d0, 0, d2)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x1x2x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x1x2x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<3x1x2x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["parallel", "reduction", "parallel"]} ins(%[[a0]] : tensor<3x4x2x!FHE.eint<7>>) outs(%[[v0]] : tensor<3x1x2x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -375,7 +375,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x2x!FHE.eint<7>> {
// CHECK-NEXT: } -> tensor<3x1x2x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<3x1x2x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x1x2x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x1x2x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [1], keep_dims = true } : (tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x1x2x!FHE.eint<7>>
return %0 : tensor<3x1x2x!FHE.eint<7>>
}
@@ -385,7 +385,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x1x2x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1, d2) -> (d1)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<4x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "parallel", "reduction"]} ins(%[[a0]] : tensor<3x4x2x!FHE.eint<7>>) outs(%[[v0]] : tensor<4x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -394,7 +394,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<3x1x2x!FHE.eint<7>> {
// CHECK-NEXT: } -> tensor<4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0, 2] } : (tensor<3x4x2x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>>
return %0 : tensor<4x!FHE.eint<7>>
}
@@ -404,7 +404,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1, d2) -> (0, d1, 0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x4x1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x4x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x4x1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "parallel", "reduction"]} ins(%[[a0]] : tensor<3x4x2x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x4x1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -413,7 +413,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// CHECK-NEXT: } -> tensor<1x4x1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<1x4x1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x4x1x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x4x1x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0, 2], keep_dims = true } : (tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x4x1x!FHE.eint<7>>
return %0 : tensor<1x4x1x!FHE.eint<7>>
}
@@ -423,7 +423,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x4x1x!FHE.eint<7>> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1, d2) -> (0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "reduction", "reduction"]} ins(%[[a0]] : tensor<3x4x2x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -434,7 +434,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x4x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v2:.*]] = tensor.extract %[[v1]][%[[c0]]] : tensor<1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v2]] : !FHE.eint<7>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
func.func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0, 1, 2] } : (tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7>
return %0 : !FHE.eint<7>
}
@@ -444,7 +444,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1, d2) -> (0, 0, 0)>
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<1x1x1x!FHE.eint<7>>
// CHECK-NEXT: %[[v1:.*]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP1]]], iterator_types = ["reduction", "reduction", "reduction"]} ins(%[[a0]] : tensor<3x4x2x!FHE.eint<7>>) outs(%[[v0]] : tensor<1x1x1x!FHE.eint<7>>) {
// CHECK-NEXT: ^bb0(%[[aa0:.*]]: !FHE.eint<7>, %[[aa1:.*]]: !FHE.eint<7>):
@@ -453,7 +453,7 @@ func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> !FHE.eint<7> {
// CHECK-NEXT: } -> tensor<1x1x1x!FHE.eint<7>>
// CHECK-NEXT: return %[[v1]] : tensor<1x1x1x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
func.func @main(%arg0: tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>> {
%0 = "FHELinalg.sum"(%arg0) { axes = [0, 1, 2], keep_dims = true } : (tensor<3x4x2x!FHE.eint<7>>) -> tensor<1x1x1x!FHE.eint<7>>
return %0 : tensor<1x1x1x!FHE.eint<7>>
}

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler %s --passes fhe-to-tfhe --action=dump-tfhe 2>&1| FileCheck %s
// CHECK-LABEL: func @add_eint(%arg0: !TFHE.glwe<{_,_,_}{7}>, %arg1: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func @add_eint(%arg0: !FHE.eint<7>, %arg1: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-LABEL: func.func @add_eint(%arg0: !TFHE.glwe<{_,_,_}{7}>, %arg1: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func.func @add_eint(%arg0: !FHE.eint<7>, %arg1: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[V1:.*]] = "TFHE.add_glwe"(%arg0, %arg1) : (!TFHE.glwe<{_,_,_}{7}>, !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
// CHECK-NEXT: return %[[V1]] : !TFHE.glwe<{_,_,_}{7}>

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler %s --passes fhe-to-tfhe --action=dump-tfhe 2>&1| FileCheck %s
// CHECK-LABEL: func @add_eint_int(%arg0: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func @add_eint_int(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-LABEL: func.func @add_eint_int(%arg0: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func.func @add_eint_int(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
// CHECK-NEXT: %[[V2:.*]] = "TFHE.add_glwe_int"(%arg0, %[[V1]]) : (!TFHE.glwe<{_,_,_}{7}>, i8) -> !TFHE.glwe<{_,_,_}{7}>
// CHECK-NEXT: return %[[V2]] : !TFHE.glwe<{_,_,_}{7}>

View File

@@ -1,11 +1,11 @@
// RUN: concretecompiler %s --passes fhe-to-tfhe --action=dump-tfhe 2>&1| FileCheck %s
// CHECK: func @apply_lookup_table(%[[A0:.*]]: !TFHE.glwe<{_,_,_}{2}>, %[[LUT:.*]]: tensor<4xi64>) -> !TFHE.glwe<{_,_,_}{3}> {
// CHECK: func.func @apply_lookup_table(%[[A0:.*]]: !TFHE.glwe<{_,_,_}{2}>, %[[LUT:.*]]: tensor<4xi64>) -> !TFHE.glwe<{_,_,_}{3}> {
// CHECK-NEXT: %[[V0:.*]] = "TFHE.glwe_from_table"(%[[LUT]]) : (tensor<4xi64>) -> !TFHE.glwe<{_,_,_}{2}>
// CHECK-NEXT: %[[V1:.*]] = "TFHE.keyswitch_glwe"(%[[A0]]) {baseLog = -1 : i32, level = -1 : i32} : (!TFHE.glwe<{_,_,_}{2}>) -> !TFHE.glwe<{_,_,_}{2}>
// CHECK-NEXT: %[[V2:.*]] = "TFHE.bootstrap_glwe"(%[[V1]], %[[V0]]) {baseLog = -1 : i32, level = -1 : i32} : (!TFHE.glwe<{_,_,_}{2}>, !TFHE.glwe<{_,_,_}{2}>) -> !TFHE.glwe<{_,_,_}{3}>
// CHECK-NEXT: return %[[V2]] : !TFHE.glwe<{_,_,_}{3}>
func @apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<4xi64>) -> !FHE.eint<3> {
func.func @apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<4xi64>) -> !FHE.eint<3> {
%1 = "FHE.apply_lookup_table"(%arg0, %arg1): (!FHE.eint<2>, tensor<4xi64>) -> (!FHE.eint<3>)
return %1: !FHE.eint<3>
}

View File

@@ -1,13 +1,13 @@
// RUN: concretecompiler %s --passes fhe-to-tfhe --action=dump-tfhe 2>&1| FileCheck %s
//CHECK: func @apply_lookup_table_cst(%[[A0:.*]]: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}> {
//CHECK: func.func @apply_lookup_table_cst(%[[A0:.*]]: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}> {
//CHECK-NEXT: %cst = arith.constant dense<"0x00000000000000000100000000000000020000000000000003000000000000000400000000000000050000000000000006000000000000000700000000000000080000000000000009000000000000000A000000000000000B000000000000000C000000000000000D000000000000000E000000000000000F0000000000000010000000000000001100000000000000120000000000000013000000000000001400000000000000150000000000000016000000000000001700000000000000180000000000000019000000000000001A000000000000001B000000000000001C000000000000001D000000000000001E000000000000001F0000000000000020000000000000002100000000000000220000000000000023000000000000002400000000000000250000000000000026000000000000002700000000000000280000000000000029000000000000002A000000000000002B000000000000002C000000000000002D000000000000002E000000000000002F0000000000000030000000000000003100000000000000320000000000000033000000000000003400000000000000350000000000000036000000000000003700000000000000380000000000000039000000000000003A000000000000003B000000000000003C000000000000003D000000000000003E000000000000003F0000000000000040000000000000004100000000000000420000000000000043000000000000004400000000000000450000000000000046000000000000004700000000000000480000000000000049000000000000004A000000000000004B000000000000004C000000000000004D000000000000004E000000000000004F0000000000000050000000000000005100000000000000520000000000000053000000000000005400000000000000550000000000000056000000000000005700000000000000580000000000000059000000000000005A000000000000005B000000000000005C000000000000005D000000000000005E000000000000005F0000000000000060000000000000006100000000000000620000000000000063000000000000006400000000000000650000000000000066000000000000006700000000000000680000000000000069000000000000006A000000000000006B000000000000006C000000000000006D000000000000006E000000000000006F0000000000000070000000000000007100000000000000720000000000000073000000000000007400000000000000750000000000000076000000000000007700000000000000780000000000000079000000000000007A000000000000007B000000000000007C000000000000007D000000000000007E000000000000007F00000000000000"> : tensor<128xi64>
//CHECK-NEXT: %[[V0:.*]] = "TFHE.glwe_from_table"(%cst) : (tensor<128xi64>) -> !TFHE.glwe<{_,_,_}{7}>
//CHECK-NEXT: %[[V1:.*]] = "TFHE.keyswitch_glwe"(%[[A0]]) {baseLog = -1 : i32, level = -1 : i32} : (!TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
//CHECK-NEXT: %[[V2:.*]] = "TFHE.bootstrap_glwe"(%[[V1]], %[[V0]]) {baseLog = -1 : i32, level = -1 : i32} : (!TFHE.glwe<{_,_,_}{7}>, !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
//CHECK-NEXT: return %[[V2]] : !TFHE.glwe<{_,_,_}{7}>
//CHECK-NEXT: }
func @apply_lookup_table_cst(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
func.func @apply_lookup_table_cst(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
%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 = "FHE.apply_lookup_table"(%arg0, %tlu): (!FHE.eint<7>, tensor<128xi64>) -> (!FHE.eint<7>)
return %1: !FHE.eint<7>

View File

@@ -6,7 +6,7 @@
//CHECK-NEXT: #map3 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d1, d4, d5, d6)>
//CHECK-NEXT: #map4 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d0, d1, d2, d3)>
//CHECK-NEXT: module {
//CHECK-NEXT: func @conv2d(%arg0: tensor<100x3x28x28x!TFHE.glwe<{_,_,_}{2}>>, %arg1: tensor<4x3x14x14xi3>, %arg2: tensor<4xi3>) -> tensor<100x4x15x15x!TFHE.glwe<{_,_,_}{2}>> {
//CHECK-NEXT: func.func @conv2d(%arg0: tensor<100x3x28x28x!TFHE.glwe<{_,_,_}{2}>>, %arg1: tensor<4x3x14x14xi3>, %arg2: tensor<4xi3>) -> tensor<100x4x15x15x!TFHE.glwe<{_,_,_}{2}>> {
//CHECK-NEXT: %0 = "TFHE.zero_tensor"() : () -> tensor<100x4x15x15x!TFHE.glwe<{_,_,_}{2}>>
//CHECK-NEXT: %1 = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = ["parallel", "parallel", "parallel", "parallel"]} ins(%arg2 : tensor<4xi3>) outs(%0 : tensor<100x4x15x15x!TFHE.glwe<{_,_,_}{2}>>) {
//CHECK-NEXT: ^bb0(%arg3: i3, %arg4: !TFHE.glwe<{_,_,_}{2}>):
@@ -23,7 +23,7 @@
//CHECK-NEXT: }
//CHECK-NEXT: }
func @conv2d(%input: tensor<100x3x28x28x!FHE.eint<2>>, %weight: tensor<4x3x14x14xi3>, %bias: tensor<4xi3>) -> tensor<100x4x15x15x!FHE.eint<2>> {
func.func @conv2d(%input: tensor<100x3x28x28x!FHE.eint<2>>, %weight: tensor<4x3x14x14xi3>, %bias: tensor<4xi3>) -> tensor<100x4x15x15x!FHE.eint<2>> {
%1 = "FHELinalg.conv2d"(%input, %weight, %bias){strides = dense<[1,1]> : tensor<2xi64>, dilations = dense<[1,1]> : tensor<2xi64>, padding = dense<[0, 0, 0, 0]> : tensor<4xi64>}: (tensor<100x3x28x28x!FHE.eint<2>>, tensor<4x3x14x14xi3>, tensor<4xi3>) -> tensor<100x4x15x15x!FHE.eint<2>>
return %1 : tensor<100x4x15x15x!FHE.eint<2>>
}

View File

@@ -3,7 +3,7 @@
// CHECK: #map0 = affine_map<(d0) -> (d0)>
// CHECK-NEXT: #map1 = affine_map<(d0) -> (0)>
// CHECK-NEXT: module {
// CHECK-NEXT: func @linalg_generic(%arg0: tensor<2x!TFHE.glwe<{_,_,_}{2}>>, %arg1: tensor<2xi3>, %arg2: tensor<1x!TFHE.glwe<{_,_,_}{2}>>) {
// CHECK-NEXT: func.func @linalg_generic(%arg0: tensor<2x!TFHE.glwe<{_,_,_}{2}>>, %arg1: tensor<2xi3>, %arg2: tensor<1x!TFHE.glwe<{_,_,_}{2}>>) {
// CHECK-NEXT: %0 = linalg.generic {indexing_maps = [#map0, #map0, #map1], iterator_types = ["reduction"]} ins(%arg0, %arg1 : tensor<2x!TFHE.glwe<{_,_,_}{2}>>, tensor<2xi3>) outs(%arg2 : tensor<1x!TFHE.glwe<{_,_,_}{2}>>) {
// CHECK-NEXT: ^bb0(%arg3: !TFHE.glwe<{_,_,_}{2}>, %arg4: i3, %arg5: !TFHE.glwe<{_,_,_}{2}>):
// CHECK-NEXT: %1 = "TFHE.mul_glwe_int"(%arg3, %arg4) : (!TFHE.glwe<{_,_,_}{2}>, i3) -> !TFHE.glwe<{_,_,_}{2}>
@@ -17,7 +17,7 @@
#map0 = affine_map<(d0) -> (d0)>
#map1 = affine_map<(d0) -> (0)>
module {
func @linalg_generic(%arg0: tensor<2x!FHE.eint<2>>, %arg1: tensor<2xi3>, %acc: tensor<1x!FHE.eint<2>>) {
func.func @linalg_generic(%arg0: tensor<2x!FHE.eint<2>>, %arg1: tensor<2xi3>, %acc: tensor<1x!FHE.eint<2>>) {
%2 = linalg.generic {indexing_maps = [#map0, #map0, #map1], iterator_types = ["reduction"]} ins(%arg0, %arg1 : tensor<2x!FHE.eint<2>>, tensor<2xi3>) outs(%acc : tensor<1x!FHE.eint<2>>) {
^bb0(%arg2: !FHE.eint<2>, %arg3: i3, %arg4: !FHE.eint<2>): // no predecessors
%4 = "FHE.mul_eint_int"(%arg2, %arg3) : (!FHE.eint<2>, i3) -> !FHE.eint<2>

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler %s --passes fhe-to-tfhe --action=dump-tfhe 2>&1| FileCheck %s
// CHECK-LABEL: func @mul_eint_int(%arg0: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func @mul_eint_int(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-LABEL: func.func @mul_eint_int(%arg0: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func.func @mul_eint_int(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 2 : i8
// CHECK-NEXT: %[[V2:.*]] = "TFHE.mul_glwe_int"(%arg0, %[[V1]]) : (!TFHE.glwe<{_,_,_}{7}>, i8) -> !TFHE.glwe<{_,_,_}{7}>
// CHECK-NEXT: return %[[V2]] : !TFHE.glwe<{_,_,_}{7}>

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler %s --passes fhe-to-tfhe --action=dump-tfhe 2>&1| FileCheck %s
// CHECK-LABEL: func @neg_eint(%arg0: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func @neg_eint(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-LABEL: func.func @neg_eint(%arg0: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func.func @neg_eint(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[V1:.*]] = "TFHE.neg_glwe"(%arg0) : (!TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
// CHECK-NEXT: return %[[V1]] : !TFHE.glwe<{_,_,_}{7}>

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler %s --passes fhe-to-tfhe --action=dump-tfhe 2>&1| FileCheck %s
// CHECK-LABEL: func @sub_int_eint(%arg0: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func @sub_int_eint(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-LABEL: func.func @sub_int_eint(%arg0: !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
func.func @sub_int_eint(%arg0: !FHE.eint<7>) -> !FHE.eint<7> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
// CHECK-NEXT: %[[V2:.*]] = "TFHE.sub_int_glwe"(%[[V1]], %arg0) : (i8, !TFHE.glwe<{_,_,_}{7}>) -> !TFHE.glwe<{_,_,_}{7}>
// CHECK-NEXT: return %[[V2]] : !TFHE.glwe<{_,_,_}{7}>

View File

@@ -1,13 +1,13 @@
// RUN: concretecompiler --passes tfhe-global-parametrization --action=dump-std --v0-parameter=2,10,750,1,23,3,4 -v0-constraint=4,0 %s 2>&1| FileCheck %s
//CHECK: func @main(%[[A0:.*]]: !TFHE.glwe<{2048,1,64}{4}>) -> !TFHE.glwe<{2048,1,64}{4}> {
//CHECK: func.func @main(%[[A0:.*]]: !TFHE.glwe<{2048,1,64}{4}>) -> !TFHE.glwe<{2048,1,64}{4}> {
//CHECK: %cst = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : tensor<16xi64>
//CHECK: %[[V0:.*]] = "TFHE.glwe_from_table"(%cst) : (tensor<16xi64>) -> !TFHE.glwe<{2,1024,64}{4}>
//CHECK: %[[V1:.*]] = "TFHE.keyswitch_glwe"(%[[A0]]) {baseLog = 4 : i32, level = 3 : i32} : (!TFHE.glwe<{2048,1,64}{4}>) -> !TFHE.glwe<{750,1,64}{4}>
//CHECK: %[[V2:.*]] = "TFHE.bootstrap_glwe"(%[[V1]], %[[V0]]) {baseLog = 23 : i32, level = 1 : i32} : (!TFHE.glwe<{750,1,64}{4}>, !TFHE.glwe<{2,1024,64}{4}>) -> !TFHE.glwe<{2048,1,64}{4}>
//CHECK: return %[[V2]] : !TFHE.glwe<{2048,1,64}{4}>
//CHECK: }
func @main(%arg0: !TFHE.glwe<{_,_,_}{4}>) -> !TFHE.glwe<{_,_,_}{4}> {
func.func @main(%arg0: !TFHE.glwe<{_,_,_}{4}>) -> !TFHE.glwe<{_,_,_}{4}> {
%cst = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : tensor<16xi64>
%0 = "TFHE.glwe_from_table"(%cst) : (tensor<16xi64>) -> !TFHE.glwe<{_,_,_}{4}>
%1 = "TFHE.keyswitch_glwe"(%arg0) {baseLog = -1 : i32, level = -1 : i32} : (!TFHE.glwe<{_,_,_}{4}>) -> !TFHE.glwe<{_,_,_}{4}>

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --passes tfhe-to-concrete --action=dump-concrete %s 2>&1| FileCheck %s
// CHECK-LABEL: func @add_glwe(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func @add_glwe(%arg0: !TFHE.glwe<{2048,1,64}{7}>, %arg1: !TFHE.glwe<{2048,1,64}{7}>) -> !TFHE.glwe<{2048,1,64}{7}> {
// CHECK-LABEL: func.func @add_glwe(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @add_glwe(%arg0: !TFHE.glwe<{2048,1,64}{7}>, %arg1: !TFHE.glwe<{2048,1,64}{7}>) -> !TFHE.glwe<{2048,1,64}{7}> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.add_lwe_ciphertexts"(%arg0, %arg1) : (!Concrete.lwe_ciphertext<2048,7>, !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --passes tfhe-to-concrete --action=dump-concrete %s 2>&1| FileCheck %s
// CHECK-LABEL: func @add_glwe_const_int(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7>
func @add_glwe_const_int(%arg0: !TFHE.glwe<{1024,1,64}{7}>) -> !TFHE.glwe<{1024,1,64}{7}> {
// CHECK-LABEL: func.func @add_glwe_const_int(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7>
func.func @add_glwe_const_int(%arg0: !TFHE.glwe<{1024,1,64}{7}>) -> !TFHE.glwe<{1024,1,64}{7}> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
// CHECK-NEXT: %[[V2:.*]] = "Concrete.encode_int"(%[[V1]]) : (i8) -> !Concrete.plaintext<8>
// CHECK-NEXT: %[[V3:.*]] = "Concrete.add_plaintext_lwe_ciphertext"(%arg0, %[[V2]]) : (!Concrete.lwe_ciphertext<1024,7>, !Concrete.plaintext<8>) -> !Concrete.lwe_ciphertext<1024,7>
@@ -12,8 +12,8 @@ func @add_glwe_const_int(%arg0: !TFHE.glwe<{1024,1,64}{7}>) -> !TFHE.glwe<{1024,
}
// CHECK-LABEL: func @add_glwe_int(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4>
func @add_glwe_int(%arg0: !TFHE.glwe<{1024,1,64}{4}>, %arg1: i5) -> !TFHE.glwe<{1024,1,64}{4}> {
// CHECK-LABEL: func.func @add_glwe_int(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4>
func.func @add_glwe_int(%arg0: !TFHE.glwe<{1024,1,64}{4}>, %arg1: i5) -> !TFHE.glwe<{1024,1,64}{4}> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.encode_int"(%arg1) : (i5) -> !Concrete.plaintext<5>
// CHECK-NEXT: %[[V2:.*]] = "Concrete.add_plaintext_lwe_ciphertext"(%arg0, %[[V1]]) : (!Concrete.lwe_ciphertext<1024,4>, !Concrete.plaintext<5>) -> !Concrete.lwe_ciphertext<1024,4>
// CHECK-NEXT: return %[[V2]] : !Concrete.lwe_ciphertext<1024,4>

View File

@@ -1,12 +1,12 @@
// RUN: concretecompiler --passes tfhe-to-concrete --action=dump-concrete %s 2>&1| FileCheck %s
//CHECK: func @bootstrap_lwe(%[[A0:.*]]: !Concrete.lwe_ciphertext<600,7>) -> !Concrete.lwe_ciphertext<1024,4> {
//CHECK: func.func @bootstrap_lwe(%[[A0:.*]]: !Concrete.lwe_ciphertext<600,7>) -> !Concrete.lwe_ciphertext<1024,4> {
//CHECK: %cst = arith.constant dense<"0x00000000000000000100000000000000020000000000000003000000000000000400000000000000050000000000000006000000000000000700000000000000080000000000000009000000000000000A000000000000000B000000000000000C000000000000000D000000000000000E000000000000000F0000000000000010000000000000001100000000000000120000000000000013000000000000001400000000000000150000000000000016000000000000001700000000000000180000000000000019000000000000001A000000000000001B000000000000001C000000000000001D000000000000001E000000000000001F0000000000000020000000000000002100000000000000220000000000000023000000000000002400000000000000250000000000000026000000000000002700000000000000280000000000000029000000000000002A000000000000002B000000000000002C000000000000002D000000000000002E000000000000002F0000000000000030000000000000003100000000000000320000000000000033000000000000003400000000000000350000000000000036000000000000003700000000000000380000000000000039000000000000003A000000000000003B000000000000003C000000000000003D000000000000003E000000000000003F0000000000000040000000000000004100000000000000420000000000000043000000000000004400000000000000450000000000000046000000000000004700000000000000480000000000000049000000000000004A000000000000004B000000000000004C000000000000004D000000000000004E000000000000004F0000000000000050000000000000005100000000000000520000000000000053000000000000005400000000000000550000000000000056000000000000005700000000000000580000000000000059000000000000005A000000000000005B000000000000005C000000000000005D000000000000005E000000000000005F0000000000000060000000000000006100000000000000620000000000000063000000000000006400000000000000650000000000000066000000000000006700000000000000680000000000000069000000000000006A000000000000006B000000000000006C000000000000006D000000000000006E000000000000006F0000000000000070000000000000007100000000000000720000000000000073000000000000007400000000000000750000000000000076000000000000007700000000000000780000000000000079000000000000007A000000000000007B000000000000007C000000000000007D000000000000007E000000000000007F00000000000000"> : tensor<128xi64>
//CHECK: %[[V0:.*]] = "Concrete.glwe_from_table"(%cst) : (tensor<128xi64>) -> !Concrete.glwe_ciphertext<1,1024,7>
//CHECK: %[[V1:.*]] = "Concrete.bootstrap_lwe"(%[[A0]], %[[V0]]) {baseLog = 1 : i32, level = 3 : i32} : (!Concrete.lwe_ciphertext<600,7>, !Concrete.glwe_ciphertext<1,1024,7>) -> !Concrete.lwe_ciphertext<1024,4>
//CHECK: return %[[V1]] : !Concrete.lwe_ciphertext<1024,4>
//CHECK: }
func @bootstrap_lwe(%ciphertext: !TFHE.glwe<{600,1,64}{7}>) -> !TFHE.glwe<{1024,1,64}{4}> {
func.func @bootstrap_lwe(%ciphertext: !TFHE.glwe<{600,1,64}{7}>) -> !TFHE.glwe<{1024,1,64}{4}> {
%cst = arith.constant dense<"0x00000000000000000100000000000000020000000000000003000000000000000400000000000000050000000000000006000000000000000700000000000000080000000000000009000000000000000A000000000000000B000000000000000C000000000000000D000000000000000E000000000000000F0000000000000010000000000000001100000000000000120000000000000013000000000000001400000000000000150000000000000016000000000000001700000000000000180000000000000019000000000000001A000000000000001B000000000000001C000000000000001D000000000000001E000000000000001F0000000000000020000000000000002100000000000000220000000000000023000000000000002400000000000000250000000000000026000000000000002700000000000000280000000000000029000000000000002A000000000000002B000000000000002C000000000000002D000000000000002E000000000000002F0000000000000030000000000000003100000000000000320000000000000033000000000000003400000000000000350000000000000036000000000000003700000000000000380000000000000039000000000000003A000000000000003B000000000000003C000000000000003D000000000000003E000000000000003F0000000000000040000000000000004100000000000000420000000000000043000000000000004400000000000000450000000000000046000000000000004700000000000000480000000000000049000000000000004A000000000000004B000000000000004C000000000000004D000000000000004E000000000000004F0000000000000050000000000000005100000000000000520000000000000053000000000000005400000000000000550000000000000056000000000000005700000000000000580000000000000059000000000000005A000000000000005B000000000000005C000000000000005D000000000000005E000000000000005F0000000000000060000000000000006100000000000000620000000000000063000000000000006400000000000000650000000000000066000000000000006700000000000000680000000000000069000000000000006A000000000000006B000000000000006C000000000000006D000000000000006E000000000000006F0000000000000070000000000000007100000000000000720000000000000073000000000000007400000000000000750000000000000076000000000000007700000000000000780000000000000079000000000000007A000000000000007B000000000000007C000000000000007D000000000000007E000000000000007F00000000000000"> : tensor<128xi64>
%glwe_lut = "TFHE.glwe_from_table"(%cst) : (tensor<128xi64>) -> !TFHE.glwe<{1,1024,64}{7}>
%bootstraped = "TFHE.bootstrap_glwe"(%ciphertext, %glwe_lut) {baseLog = 1 : i32, glweDimension = 1 : i32, level = 3 : i32, polynomialSize = 1024 : i32} : (!TFHE.glwe<{600,1,64}{7}>, !TFHE.glwe<{1,1024,64}{7}>) -> !TFHE.glwe<{1024,1,64}{4}>

View File

@@ -1,11 +1,11 @@
// RUN: concretecompiler --passes tfhe-to-concrete --action=dump-concrete %s 2>&1| FileCheck %s
//CHECK: func @glwe_from_table() {
//CHECK: func.func @glwe_from_table() {
//CHECK-NEXT: %[[V0:.*]] = arith.constant dense<"0x00000000000000000100000000000000020000000000000003000000000000000400000000000000050000000000000006000000000000000700000000000000080000000000000009000000000000000A000000000000000B000000000000000C000000000000000D000000000000000E000000000000000F0000000000000010000000000000001100000000000000120000000000000013000000000000001400000000000000150000000000000016000000000000001700000000000000180000000000000019000000000000001A000000000000001B000000000000001C000000000000001D000000000000001E000000000000001F0000000000000020000000000000002100000000000000220000000000000023000000000000002400000000000000250000000000000026000000000000002700000000000000280000000000000029000000000000002A000000000000002B000000000000002C000000000000002D000000000000002E000000000000002F0000000000000030000000000000003100000000000000320000000000000033000000000000003400000000000000350000000000000036000000000000003700000000000000380000000000000039000000000000003A000000000000003B000000000000003C000000000000003D000000000000003E000000000000003F0000000000000040000000000000004100000000000000420000000000000043000000000000004400000000000000450000000000000046000000000000004700000000000000480000000000000049000000000000004A000000000000004B000000000000004C000000000000004D000000000000004E000000000000004F0000000000000050000000000000005100000000000000520000000000000053000000000000005400000000000000550000000000000056000000000000005700000000000000580000000000000059000000000000005A000000000000005B000000000000005C000000000000005D000000000000005E000000000000005F0000000000000060000000000000006100000000000000620000000000000063000000000000006400000000000000650000000000000066000000000000006700000000000000680000000000000069000000000000006A000000000000006B000000000000006C000000000000006D000000000000006E000000000000006F0000000000000070000000000000007100000000000000720000000000000073000000000000007400000000000000750000000000000076000000000000007700000000000000780000000000000079000000000000007A000000000000007B000000000000007C000000000000007D000000000000007E000000000000007F00000000000000"> : tensor<128xi64>
//CHECK-NEXT: %[[V1:.*]] = "Concrete.glwe_from_table"(%[[V0]]) : (tensor<128xi64>) -> !Concrete.glwe_ciphertext<1,1024,7>
//CHECK-NEXT: return
//CHECK-NEXT: }
func @glwe_from_table() {
func.func @glwe_from_table() {
%cst = arith.constant dense<"0x00000000000000000100000000000000020000000000000003000000000000000400000000000000050000000000000006000000000000000700000000000000080000000000000009000000000000000A000000000000000B000000000000000C000000000000000D000000000000000E000000000000000F0000000000000010000000000000001100000000000000120000000000000013000000000000001400000000000000150000000000000016000000000000001700000000000000180000000000000019000000000000001A000000000000001B000000000000001C000000000000001D000000000000001E000000000000001F0000000000000020000000000000002100000000000000220000000000000023000000000000002400000000000000250000000000000026000000000000002700000000000000280000000000000029000000000000002A000000000000002B000000000000002C000000000000002D000000000000002E000000000000002F0000000000000030000000000000003100000000000000320000000000000033000000000000003400000000000000350000000000000036000000000000003700000000000000380000000000000039000000000000003A000000000000003B000000000000003C000000000000003D000000000000003E000000000000003F0000000000000040000000000000004100000000000000420000000000000043000000000000004400000000000000450000000000000046000000000000004700000000000000480000000000000049000000000000004A000000000000004B000000000000004C000000000000004D000000000000004E000000000000004F0000000000000050000000000000005100000000000000520000000000000053000000000000005400000000000000550000000000000056000000000000005700000000000000580000000000000059000000000000005A000000000000005B000000000000005C000000000000005D000000000000005E000000000000005F0000000000000060000000000000006100000000000000620000000000000063000000000000006400000000000000650000000000000066000000000000006700000000000000680000000000000069000000000000006A000000000000006B000000000000006C000000000000006D000000000000006E000000000000006F0000000000000070000000000000007100000000000000720000000000000073000000000000007400000000000000750000000000000076000000000000007700000000000000780000000000000079000000000000007A000000000000007B000000000000007C000000000000007D000000000000007E000000000000007F00000000000000"> : tensor<128xi64>
%0 = "TFHE.glwe_from_table"(%cst) : (tensor<128xi64>) -> !TFHE.glwe<{1,1024,64}{7}>
return

View File

@@ -1,10 +1,10 @@
// RUN: concretecompiler --passes tfhe-to-concrete --action=dump-concrete %s 2>&1| FileCheck %s
// CHECK: func @keyswitch_glwe(%[[A0:.*]]: !Concrete.lwe_ciphertext<1024,2>) -> !Concrete.lwe_ciphertext<567,2> {
// CHECK: func.func @keyswitch_glwe(%[[A0:.*]]: !Concrete.lwe_ciphertext<1024,2>) -> !Concrete.lwe_ciphertext<567,2> {
// CHECK-NEXT: %[[V0:.*]] = "Concrete.keyswitch_lwe"(%[[A0]]) {baseLog = 3 : i32, level = 2 : i32} : (!Concrete.lwe_ciphertext<1024,2>) -> !Concrete.lwe_ciphertext<567,2>
// CHECK-NEXT: return %[[V0]] : !Concrete.lwe_ciphertext<567,2>
// CHECK-NEXT: }
func @keyswitch_glwe(%arg0: !TFHE.glwe<{1024,1,64}{2}>) -> !TFHE.glwe<{567,1,64}{2}> {
func.func @keyswitch_glwe(%arg0: !TFHE.glwe<{1024,1,64}{2}>) -> !TFHE.glwe<{567,1,64}{2}> {
%0 = "TFHE.keyswitch_glwe"(%arg0) {baseLog = 3 : i32, level = 2 : i32} : (!TFHE.glwe<{1024,1,64}{2}>) -> !TFHE.glwe<{567,1,64}{2}>
return %0 : !TFHE.glwe<{567,1,64}{2}>
}

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --passes tfhe-to-concrete --action=dump-concrete %s 2>&1| FileCheck %s
// CHECK-LABEL: func @mul_glwe_const_int(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7>
func @mul_glwe_const_int(%arg0: !TFHE.glwe<{1024,1,64}{7}>) -> !TFHE.glwe<{1024,1,64}{7}> {
// CHECK-LABEL: func.func @mul_glwe_const_int(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7>
func.func @mul_glwe_const_int(%arg0: !TFHE.glwe<{1024,1,64}{7}>) -> !TFHE.glwe<{1024,1,64}{7}> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
// CHECK-NEXT: %[[V2:.*]] = "Concrete.int_to_cleartext"(%[[V1]]) : (i8) -> !Concrete.cleartext<8>
// CHECK-NEXT: %[[V3:.*]] = "Concrete.mul_cleartext_lwe_ciphertext"(%arg0, %[[V2]]) : (!Concrete.lwe_ciphertext<1024,7>, !Concrete.cleartext<8>) -> !Concrete.lwe_ciphertext<1024,7>
@@ -12,8 +12,8 @@ func @mul_glwe_const_int(%arg0: !TFHE.glwe<{1024,1,64}{7}>) -> !TFHE.glwe<{1024,
}
// CHECK-LABEL: func @mul_glwe_int(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4>
func @mul_glwe_int(%arg0: !TFHE.glwe<{1024,1,64}{4}>, %arg1: i5) -> !TFHE.glwe<{1024,1,64}{4}> {
// CHECK-LABEL: func.func @mul_glwe_int(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4>
func.func @mul_glwe_int(%arg0: !TFHE.glwe<{1024,1,64}{4}>, %arg1: i5) -> !TFHE.glwe<{1024,1,64}{4}> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.int_to_cleartext"(%arg1) : (i5) -> !Concrete.cleartext<5>
// CHECK-NEXT: %[[V2:.*]] = "Concrete.mul_cleartext_lwe_ciphertext"(%arg0, %[[V1]]) : (!Concrete.lwe_ciphertext<1024,4>, !Concrete.cleartext<5>) -> !Concrete.lwe_ciphertext<1024,4>
// CHECK-NEXT: return %[[V2]] : !Concrete.lwe_ciphertext<1024,4>

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --passes tfhe-to-concrete --action=dump-concrete %s 2>&1| FileCheck %s
// CHECK-LABEL: func @neg_glwe(%arg0: !Concrete.lwe_ciphertext<1024,4>) -> !Concrete.lwe_ciphertext<1024,4>
func @neg_glwe(%arg0: !TFHE.glwe<{1024,1,64}{4}>) -> !TFHE.glwe<{1024,1,64}{4}> {
// CHECK-LABEL: func.func @neg_glwe(%arg0: !Concrete.lwe_ciphertext<1024,4>) -> !Concrete.lwe_ciphertext<1024,4>
func.func @neg_glwe(%arg0: !TFHE.glwe<{1024,1,64}{4}>) -> !TFHE.glwe<{1024,1,64}{4}> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.negate_lwe_ciphertext"(%arg0) : (!Concrete.lwe_ciphertext<1024,4>) -> !Concrete.lwe_ciphertext<1024,4>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<1024,4>
%1 = "TFHE.neg_glwe"(%arg0): (!TFHE.glwe<{1024,1,64}{4}>) -> (!TFHE.glwe<{1024,1,64}{4}>)

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --passes tfhe-to-concrete --action=dump-concrete %s 2>&1| FileCheck %s
// CHECK-LABEL: func @sub_const_int_glwe(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7>
func @sub_const_int_glwe(%arg0: !TFHE.glwe<{1024,1,64}{7}>) -> !TFHE.glwe<{1024,1,64}{7}> {
// CHECK-LABEL: func.func @sub_const_int_glwe(%arg0: !Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7>
func.func @sub_const_int_glwe(%arg0: !TFHE.glwe<{1024,1,64}{7}>) -> !TFHE.glwe<{1024,1,64}{7}> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i8
// CHECK-NEXT: %[[NEG:.*]] = "Concrete.negate_lwe_ciphertext"(%arg0) : (!Concrete.lwe_ciphertext<1024,7>) -> !Concrete.lwe_ciphertext<1024,7>
// CHECK-NEXT: %[[V2:.*]] = "Concrete.encode_int"(%[[V1]]) : (i8) -> !Concrete.plaintext<8>
@@ -12,8 +12,8 @@ func @sub_const_int_glwe(%arg0: !TFHE.glwe<{1024,1,64}{7}>) -> !TFHE.glwe<{1024,
return %1: !TFHE.glwe<{1024,1,64}{7}>
}
// CHECK-LABEL: func @sub_int_glwe(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4>
func @sub_int_glwe(%arg0: !TFHE.glwe<{1024,1,64}{4}>, %arg1: i5) -> !TFHE.glwe<{1024,1,64}{4}> {
// CHECK-LABEL: func.func @sub_int_glwe(%arg0: !Concrete.lwe_ciphertext<1024,4>, %arg1: i5) -> !Concrete.lwe_ciphertext<1024,4>
func.func @sub_int_glwe(%arg0: !TFHE.glwe<{1024,1,64}{4}>, %arg1: i5) -> !TFHE.glwe<{1024,1,64}{4}> {
// CHECK-NEXT: %[[NEG:.*]] = "Concrete.negate_lwe_ciphertext"(%arg0) : (!Concrete.lwe_ciphertext<1024,4>) -> !Concrete.lwe_ciphertext<1024,4>
// CHECK-NEXT: %[[V1:.*]] = "Concrete.encode_int"(%arg1) : (i5) -> !Concrete.plaintext<5>
// CHECK-NEXT: %[[V2:.*]] = "Concrete.add_plaintext_lwe_ciphertext"(%[[NEG]], %[[V1]]) : (!Concrete.lwe_ciphertext<1024,4>, !Concrete.plaintext<5>) -> !Concrete.lwe_ciphertext<1024,4>

View File

@@ -1,55 +1,55 @@
// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
//CHECK: func @add_lwe_ciphertexts(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: func.func @add_lwe_ciphertexts(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: %[[V0:.*]] = "BConcrete.add_lwe_buffer"(%[[A0]], %[[A1]]) : (tensor<2049xi64>, tensor<2049xi64>) -> tensor<2049xi64>
//CHECK: return %[[V0]] : tensor<2049xi64>
//CHECK: }
func @add_lwe_ciphertexts(%arg0: tensor<2049xi64>, %arg1: tensor<2049xi64>) -> tensor<2049xi64> {
func.func @add_lwe_ciphertexts(%arg0: tensor<2049xi64>, %arg1: tensor<2049xi64>) -> tensor<2049xi64> {
%0 = "BConcrete.add_lwe_buffer"(%arg0, %arg1) : (tensor<2049xi64>, tensor<2049xi64>) -> ( tensor<2049xi64>)
return %0 : tensor<2049xi64>
}
//CHECK: func @add_plaintext_lwe_ciphertext(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: i64) -> tensor<2049xi64> {
//CHECK: func.func @add_plaintext_lwe_ciphertext(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: i64) -> tensor<2049xi64> {
//CHECK: %[[V0:.*]] = "BConcrete.add_plaintext_lwe_buffer"(%[[A0]], %[[A1]]) : (tensor<2049xi64>, i64) -> tensor<2049xi64>
//CHECK: return %[[V0]] : tensor<2049xi64>
//CHECK: }
func @add_plaintext_lwe_ciphertext(%arg0: tensor<2049xi64>, %arg1: i64) -> tensor<2049xi64> {
func.func @add_plaintext_lwe_ciphertext(%arg0: tensor<2049xi64>, %arg1: i64) -> tensor<2049xi64> {
%0 = "BConcrete.add_plaintext_lwe_buffer"(%arg0, %arg1) : (tensor<2049xi64>, i64) -> ( tensor<2049xi64>)
return %0 : tensor<2049xi64>
}
//CHECK: func @mul_cleartext_lwe_ciphertext(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: i64) -> tensor<2049xi64> {
//CHECK: func.func @mul_cleartext_lwe_ciphertext(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: i64) -> tensor<2049xi64> {
//CHECK: %[[V0:.*]] = "BConcrete.mul_cleartext_lwe_buffer"(%[[A0]], %[[A1]]) : (tensor<2049xi64>, i64) -> tensor<2049xi64>
//CHECK: return %[[V0]] : tensor<2049xi64>
//CHECK: }
func @mul_cleartext_lwe_ciphertext(%arg0: tensor<2049xi64>, %arg1: i64) -> tensor<2049xi64> {
func.func @mul_cleartext_lwe_ciphertext(%arg0: tensor<2049xi64>, %arg1: i64) -> tensor<2049xi64> {
%0 = "BConcrete.mul_cleartext_lwe_buffer"(%arg0, %arg1) : (tensor<2049xi64>, i64) -> (tensor<2049xi64>)
return %0 : tensor<2049xi64>
}
//CHECK: func @negate_lwe_ciphertext(%[[A0:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: func.func @negate_lwe_ciphertext(%[[A0:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: %[[V0:.*]] = "BConcrete.negate_lwe_buffer"(%[[A0]]) : (tensor<2049xi64>) -> tensor<2049xi64>
//CHECK: return %[[V0]] : tensor<2049xi64>
//CHECK: }
func @negate_lwe_ciphertext(%arg0: tensor<2049xi64>) -> tensor<2049xi64> {
func.func @negate_lwe_ciphertext(%arg0: tensor<2049xi64>) -> tensor<2049xi64> {
%0 = "BConcrete.negate_lwe_buffer"(%arg0) : (tensor<2049xi64>) -> (tensor<2049xi64>)
return %0 : tensor<2049xi64>
}
//CHECK: func @bootstrap_lwe(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: tensor<4096xi64>) -> tensor<2049xi64> {
//CHECK: func.func @bootstrap_lwe(%[[A0:.*]]: tensor<2049xi64>, %[[A1:.*]]: tensor<4096xi64>) -> tensor<2049xi64> {
//CHECK: %[[V0:.*]] = "BConcrete.bootstrap_lwe_buffer"(%[[A0]], %[[A1]]) {baseLog = -1 : i32, glweDimension = 1 : i32, level = -1 : i32, polynomialSize = 1024 : i32} : (tensor<2049xi64>, tensor<4096xi64>) -> tensor<2049xi64>
//CHECK: return %[[V0]] : tensor<2049xi64>
//CHECK: }
func @bootstrap_lwe(%arg0: tensor<2049xi64>, %arg1: tensor<4096xi64>) -> tensor<2049xi64> {
func.func @bootstrap_lwe(%arg0: tensor<2049xi64>, %arg1: tensor<4096xi64>) -> tensor<2049xi64> {
%0 = "BConcrete.bootstrap_lwe_buffer"(%arg0, %arg1) {baseLog = -1 : i32, glweDimension = 1 : i32, level = -1 : i32, polynomialSize = 1024 : i32} : (tensor<2049xi64>, tensor<4096xi64>) -> (tensor<2049xi64>)
return %0 : tensor<2049xi64>
}
//CHECK: func @keyswitch_lwe(%[[A0:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: func.func @keyswitch_lwe(%[[A0:.*]]: tensor<2049xi64>) -> tensor<2049xi64> {
//CHECK: %[[V0:.*]] = "BConcrete.keyswitch_lwe_buffer"(%[[A0]]) {baseLog = 2 : i32, inputLweDimension = 1 : i32, level = 3 : i32, outputLweDimension = 1 : i32} : (tensor<2049xi64>) -> tensor<2049xi64>
//CHECK: return %[[V0]] : tensor<2049xi64>
//CHECK: }
func @keyswitch_lwe(%arg0: tensor<2049xi64>) -> tensor<2049xi64> {
func.func @keyswitch_lwe(%arg0: tensor<2049xi64>) -> tensor<2049xi64> {
%0 = "BConcrete.keyswitch_lwe_buffer"(%arg0) {baseLog = 2 : i32, inputLweDimension = 1 : i32, level = 3 : i32, outputLweDimension = 1 : i32} : (tensor<2049xi64>) -> (tensor<2049xi64>)
return %0 : tensor<2049xi64>
}

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --optimize-concrete=false --action=dump-concrete %s 2>&1| FileCheck %s
// CHECK-LABEL: func @mul_cleartext_lwe_ciphertext_0(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func @mul_cleartext_lwe_ciphertext_0(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @mul_cleartext_lwe_ciphertext_0(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @mul_cleartext_lwe_ciphertext_0(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V0:.*]] = arith.constant 0 : i7
// CHECK-NEXT: %[[V1:.*]] = "Concrete.int_to_cleartext"(%[[V0]]) : (i7) -> !Concrete.cleartext<7>
// CHECK-NEXT: %[[V2:.*]] = "Concrete.mul_cleartext_lwe_ciphertext"(%arg0, %[[V1]]) : (!Concrete.lwe_ciphertext<2048,7>, !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7>

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: func @add_lwe_ciphertexts(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func @add_lwe_ciphertexts(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @add_lwe_ciphertexts(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @add_lwe_ciphertexts(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.add_lwe_ciphertexts"(%arg0, %arg1) : (!Concrete.lwe_ciphertext<2048,7>, !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>
@@ -9,8 +9,8 @@ func @add_lwe_ciphertexts(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concr
return %1: !Concrete.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @add_plaintext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.plaintext<5>) -> !Concrete.lwe_ciphertext<2048,7>
func @add_plaintext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.plaintext<5>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @add_plaintext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.plaintext<5>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @add_plaintext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.plaintext<5>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.add_plaintext_lwe_ciphertext"(%arg0, %arg1) : (!Concrete.lwe_ciphertext<2048,7>, !Concrete.plaintext<5>) -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>
@@ -18,8 +18,8 @@ func @add_plaintext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg
return %1: !Concrete.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @mul_cleartext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7>
func @mul_cleartext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @mul_cleartext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @mul_cleartext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.mul_cleartext_lwe_ciphertext"(%arg0, %arg1) : (!Concrete.lwe_ciphertext<2048,7>, !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>
@@ -27,8 +27,8 @@ func @mul_cleartext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg
return %1: !Concrete.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @negate_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func @negate_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @negate_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @negate_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.negate_lwe_ciphertext"(%arg0) : (!Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>
@@ -36,24 +36,24 @@ func @negate_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concret
return %1: !Concrete.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @bootstrap_lwe(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.glwe_ciphertext<2048,1,7>) -> !Concrete.lwe_ciphertext<2048,7>
func @bootstrap_lwe(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.glwe_ciphertext<2048,1,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @bootstrap_lwe(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.glwe_ciphertext<2048,1,7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @bootstrap_lwe(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.glwe_ciphertext<2048,1,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.bootstrap_lwe"(%arg0, %arg1) {baseLog = -1 : i32, glweDimension = 1 : i32, level = -1 : i32, polynomialSize = 2048 : i32} : (!Concrete.lwe_ciphertext<2048,7>, !Concrete.glwe_ciphertext<2048,1,7>) -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>
%1 = "Concrete.bootstrap_lwe"(%arg0, %arg1) {baseLog = -1 : i32, glweDimension = 1 : i32, level = -1 : i32, polynomialSize = 2048 : i32} : (!Concrete.lwe_ciphertext<2048,7>, !Concrete.glwe_ciphertext<2048,1,7>) -> !Concrete.lwe_ciphertext<2048,7>
return %1: !Concrete.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @keyswitch_lwe(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func @keyswitch_lwe(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @keyswitch_lwe(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @keyswitch_lwe(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.keyswitch_lwe"(%arg0) {baseLog = 2 : i32, level = 3 : i32} : (!Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>
%1 = "Concrete.keyswitch_lwe"(%arg0){baseLog = 2 : i32, level = 3 : i32}: (!Concrete.lwe_ciphertext<2048,7>) -> (!Concrete.lwe_ciphertext<2048,7>)
return %1: !Concrete.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @encode_int(%arg0: i6) -> !Concrete.plaintext<6>
func @encode_int(%arg0: i6) -> (!Concrete.plaintext<6>) {
// CHECK-LABEL: func.func @encode_int(%arg0: i6) -> !Concrete.plaintext<6>
func.func @encode_int(%arg0: i6) -> (!Concrete.plaintext<6>) {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.encode_int"(%arg0) : (i6) -> !Concrete.plaintext<6>
// CHECK-NEXT: return %[[V1]] : !Concrete.plaintext<6>
@@ -61,8 +61,8 @@ func @encode_int(%arg0: i6) -> (!Concrete.plaintext<6>) {
return %0: !Concrete.plaintext<6>
}
// CHECK-LABEL: func @int_to_cleartext() -> !Concrete.cleartext<6>
func @int_to_cleartext() -> !Concrete.cleartext<6> {
// CHECK-LABEL: func.func @int_to_cleartext() -> !Concrete.cleartext<6>
func.func @int_to_cleartext() -> !Concrete.cleartext<6> {
// CHECK-NEXT: %[[V0:.*]] = arith.constant 5 : i6
// CHECK-NEXT: %[[V1:.*]] = "Concrete.int_to_cleartext"(%[[V0]]) : (i6) -> !Concrete.cleartext<6>
// CHECK-NEXT: return %[[V1]] : !Concrete.cleartext<6>

View File

@@ -1,8 +1,8 @@
// RUN: concretecompiler --action=dump-concrete %s 2>&1| FileCheck %s
// CHECK-LABEL: func @mul_cleartext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7>
func @mul_cleartext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @mul_cleartext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @mul_cleartext_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>, %arg1: !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.mul_cleartext_lwe_ciphertext"(%arg0, %arg1) : (!Concrete.lwe_ciphertext<2048,7>, !Concrete.cleartext<7>) -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>
@@ -10,8 +10,8 @@
return %1: !Concrete.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @mul_cleartext_lwe_ciphertext_0(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func @mul_cleartext_lwe_ciphertext_0(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @mul_cleartext_lwe_ciphertext_0(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @mul_cleartext_lwe_ciphertext_0(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.zero"() : () -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>
@@ -21,8 +21,8 @@ func @mul_cleartext_lwe_ciphertext_0(%arg0: !Concrete.lwe_ciphertext<2048,7>) ->
return %2: !Concrete.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @mul_cleartext_lwe_ciphertext_minus_1(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func @mul_cleartext_lwe_ciphertext_minus_1(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @mul_cleartext_lwe_ciphertext_minus_1(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @mul_cleartext_lwe_ciphertext_minus_1(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: %[[V1:.*]] = "Concrete.negate_lwe_ciphertext"(%arg0) : (!Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
// CHECK-NEXT: return %[[V1]] : !Concrete.lwe_ciphertext<2048,7>

View File

@@ -1,20 +1,20 @@
// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: func @type_plaintext(%arg0: !Concrete.plaintext<7>) -> !Concrete.plaintext<7>
func @type_plaintext(%arg0: !Concrete.plaintext<7>) -> !Concrete.plaintext<7> {
// CHECK-LABEL: func.func @type_plaintext(%arg0: !Concrete.plaintext<7>) -> !Concrete.plaintext<7>
func.func @type_plaintext(%arg0: !Concrete.plaintext<7>) -> !Concrete.plaintext<7> {
// CHECK-NEXT: return %arg0 : !Concrete.plaintext<7>
return %arg0: !Concrete.plaintext<7>
}
// CHECK-LABEL: func @type_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func @type_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-LABEL: func.func @type_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7>
func.func @type_lwe_ciphertext(%arg0: !Concrete.lwe_ciphertext<2048,7>) -> !Concrete.lwe_ciphertext<2048,7> {
// CHECK-NEXT: return %arg0 : !Concrete.lwe_ciphertext<2048,7>
return %arg0: !Concrete.lwe_ciphertext<2048,7>
}
// CHECK-LABEL: func @type_cleartext(%arg0: !Concrete.cleartext<5>) -> !Concrete.cleartext<5>
func @type_cleartext(%arg0: !Concrete.cleartext<5>) -> !Concrete.cleartext<5> {
// CHECK-LABEL: func.func @type_cleartext(%arg0: !Concrete.cleartext<5>) -> !Concrete.cleartext<5>
func.func @type_cleartext(%arg0: !Concrete.cleartext<5>) -> !Concrete.cleartext<5> {
// CHECK-NEXT: return %arg0 : !Concrete.cleartext<5>
return %arg0: !Concrete.cleartext<5>
}

View File

@@ -1,6 +1,6 @@
// RUN: concretecompiler --passes MANP --action=dump-fhe --split-input-file %s 2>&1 | FileCheck %s
func @single_zero() -> !FHE.eint<2>
func.func @single_zero() -> !FHE.eint<2>
{
// CHECK: %[[ret:.*]] = "FHE.zero"() {MANP = 1 : ui{{[[0-9]+}}} : () -> !FHE.eint<2>
%0 = "FHE.zero"() : () -> !FHE.eint<2>
@@ -10,7 +10,7 @@ func @single_zero() -> !FHE.eint<2>
// -----
func @zero() -> tensor<8x!FHE.eint<2>>
func.func @zero() -> tensor<8x!FHE.eint<2>>
{
// CHECK: %[[ret:.*]] = "FHE.zero_tensor"() {MANP = 1 : ui{{[0-9]+}}} : () -> tensor<8x!FHE.eint<2>>
%0 = "FHE.zero_tensor"() : () -> tensor<8x!FHE.eint<2>>
@@ -20,7 +20,7 @@ func @zero() -> tensor<8x!FHE.eint<2>>
// -----
func @single_cst_add_eint_int(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_cst_add_eint_int(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
%cst = arith.constant 3 : i3
@@ -32,7 +32,7 @@ func @single_cst_add_eint_int(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_cst_add_eint_int_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_cst_add_eint_int_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
%cst = arith.constant -3 : i3
@@ -44,7 +44,7 @@ func @single_cst_add_eint_int_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_dyn_add_eint_int(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
func.func @single_dyn_add_eint_int(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
{
// sqrt(1 + (2^2-1)^2) = 3.16
// CHECK: %[[ret:.*]] = "FHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!FHE.eint<2>, i3) -> !FHE.eint<2>
@@ -55,7 +55,7 @@ func @single_dyn_add_eint_int(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
// -----
func @single_add_eint(%e0: !FHE.eint<2>, %e1: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_add_eint(%e0: !FHE.eint<2>, %e1: !FHE.eint<2>) -> !FHE.eint<2>
{
// CHECK: %[[ret:.*]] = "FHE.add_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!FHE.eint<2>, !FHE.eint<2>) -> !FHE.eint<2>
%0 = "FHE.add_eint"(%e0, %e1) : (!FHE.eint<2>, !FHE.eint<2>) -> !FHE.eint<2>
@@ -65,7 +65,7 @@ func @single_add_eint(%e0: !FHE.eint<2>, %e1: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_cst_sub_int_eint(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_cst_sub_int_eint(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
%cst = arith.constant 3 : i3
@@ -77,7 +77,7 @@ func @single_cst_sub_int_eint(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_cst_sub_int_eint_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_cst_sub_int_eint_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
%cst = arith.constant -3 : i3
@@ -89,7 +89,7 @@ func @single_cst_sub_int_eint_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_dyn_sub_int_eint(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
func.func @single_dyn_sub_int_eint(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
{
// sqrt(1 + (2^2-1)^2) = 3.16
// CHECK: %[[ret:.*]] = "FHE.sub_int_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (i3, !FHE.eint<2>) -> !FHE.eint<2>
@@ -100,7 +100,7 @@ func @single_dyn_sub_int_eint(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
// -----
func @single_cst_sub_eint_int(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_cst_sub_eint_int(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
%cst = arith.constant 3 : i3
@@ -112,7 +112,7 @@ func @single_cst_sub_eint_int(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_cst_sub_eint_int_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_cst_sub_eint_int_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
%cst = arith.constant -3 : i3
@@ -124,7 +124,7 @@ func @single_cst_sub_eint_int_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_dyn_sub_eint_int(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
func.func @single_dyn_sub_eint_int(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
{
// sqrt(1 + (2^2-1)^2) = 3.16
// CHECK: %[[ret:.*]] = "FHE.sub_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!FHE.eint<2>, i3) -> !FHE.eint<2>
@@ -135,7 +135,7 @@ func @single_dyn_sub_eint_int(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
// -----
func @chain_sub_eint(%e0: !FHE.eint<2>, %e1: !FHE.eint<2>, %e2: !FHE.eint<2>, %e3: !FHE.eint<2>, %e4: !FHE.eint<2>) -> !FHE.eint<2>
func.func @chain_sub_eint(%e0: !FHE.eint<2>, %e1: !FHE.eint<2>, %e2: !FHE.eint<2>, %e3: !FHE.eint<2>, %e4: !FHE.eint<2>) -> !FHE.eint<2>
{
// CHECK: %[[V0:.*]] = "FHE.sub_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!FHE.eint<2>, !FHE.eint<2>) -> !FHE.eint<2>
%0 = "FHE.sub_eint"(%e0, %e1) : (!FHE.eint<2>, !FHE.eint<2>) -> !FHE.eint<2>
@@ -154,7 +154,7 @@ func @chain_sub_eint(%e0: !FHE.eint<2>, %e1: !FHE.eint<2>, %e2: !FHE.eint<2>, %e
// -----
func @single_neg_eint(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_neg_eint(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
// CHECK: %[[ret:.*]] = "FHE.neg_eint"(%[[op0:.*]]) {MANP = 1 : ui{{[0-9]+}}} : (!FHE.eint<2>) -> !FHE.eint<2>
%0 = "FHE.neg_eint"(%e) : (!FHE.eint<2>) -> !FHE.eint<2>
@@ -164,7 +164,7 @@ func @single_neg_eint(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_cst_mul_eint_int(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_cst_mul_eint_int(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
%cst = arith.constant 3 : i3
@@ -176,7 +176,7 @@ func @single_cst_mul_eint_int(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_cst_mul_eint_int_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @single_cst_mul_eint_int_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
%cst = arith.constant -3 : i3
@@ -189,7 +189,7 @@ func @single_cst_mul_eint_int_neg(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
func @single_dyn_mul_eint_int(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
func.func @single_dyn_mul_eint_int(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
{
// sqrt(1 + (2^2-1)^2) = 3
// CHECK: %[[ret:.*]] = "FHE.mul_eint_int"([[op0:.*]], %[[op1:.*]]) {MANP = 3 : ui{{[0-9]+}}} : (!FHE.eint<2>, i3) -> !FHE.eint<2>
@@ -200,7 +200,7 @@ func @single_dyn_mul_eint_int(%e: !FHE.eint<2>, %i: i3) -> !FHE.eint<2>
// -----
func @single_apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<4xi64>) -> !FHE.eint<2> {
func.func @single_apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<4xi64>) -> !FHE.eint<2> {
// CHECK: %[[ret:.*]] = "FHE.apply_lookup_table"(%[[op0:.*]], %[[op1:.*]]) {MANP = 1 : ui{{[0-9]+}}} : (!FHE.eint<2>, tensor<4xi64>) -> !FHE.eint<2>
%1 = "FHE.apply_lookup_table"(%arg0, %arg1): (!FHE.eint<2>, tensor<4xi64>) -> !FHE.eint<2>
return %1: !FHE.eint<2>
@@ -208,7 +208,7 @@ func @single_apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<4xi64>) -> !F
// -----
func @chain_add_eint_int(%e: !FHE.eint<3>) -> !FHE.eint<3>
func.func @chain_add_eint_int(%e: !FHE.eint<3>) -> !FHE.eint<3>
{
%cst0 = arith.constant 3 : i4
%cst1 = arith.constant 7 : i4
@@ -229,7 +229,7 @@ func @chain_add_eint_int(%e: !FHE.eint<3>) -> !FHE.eint<3>
// -----
func @dag_add_eint_int(%e: !FHE.eint<3>) -> !FHE.eint<3>
func.func @dag_add_eint_int(%e: !FHE.eint<3>) -> !FHE.eint<3>
{
%Acst0 = arith.constant 3 : i4
%Acst1 = arith.constant 7 : i4
@@ -273,7 +273,7 @@ func @dag_add_eint_int(%e: !FHE.eint<3>) -> !FHE.eint<3>
// -----
func @chain_add_eint(%e0: !FHE.eint<2>, %e1: !FHE.eint<2>, %e2: !FHE.eint<2>, %e3: !FHE.eint<2>, %e4: !FHE.eint<2>) -> !FHE.eint<2>
func.func @chain_add_eint(%e0: !FHE.eint<2>, %e1: !FHE.eint<2>, %e2: !FHE.eint<2>, %e3: !FHE.eint<2>, %e4: !FHE.eint<2>) -> !FHE.eint<2>
{
// CHECK: %[[V0:.*]] = "FHE.add_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!FHE.eint<2>, !FHE.eint<2>) -> !FHE.eint<2>
%0 = "FHE.add_eint"(%e0, %e1) : (!FHE.eint<2>, !FHE.eint<2>) -> !FHE.eint<2>
@@ -293,7 +293,7 @@ func @chain_add_eint(%e0: !FHE.eint<2>, %e1: !FHE.eint<2>, %e2: !FHE.eint<2>, %e
// -----
func @chain_add_eint_neg_eint(%e: !FHE.eint<2>) -> !FHE.eint<2>
func.func @chain_add_eint_neg_eint(%e: !FHE.eint<2>) -> !FHE.eint<2>
{
%cst0 = arith.constant 3 : i3
@@ -308,7 +308,7 @@ func @chain_add_eint_neg_eint(%e: !FHE.eint<2>) -> !FHE.eint<2>
// -----
// CHECK-LABEL: @transpose_eint_3D(%arg0: tensor<3x4x5x!FHE.eint<6>>) -> tensor<5x4x3x!FHE.eint<6>>
func @transpose_eint_3D(%arg0: tensor<3x4x5x!FHE.eint<6>>) -> tensor<5x4x3x!FHE.eint<6>> {
func.func @transpose_eint_3D(%arg0: tensor<3x4x5x!FHE.eint<6>>) -> tensor<5x4x3x!FHE.eint<6>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.transpose"(%arg0) {MANP = 1 : ui1} : (tensor<3x4x5x!FHE.eint<6>>) -> tensor<5x4x3x!FHE.eint<6>>
// CHECK-NEXT: return %[[v0]] : tensor<5x4x3x!FHE.eint<6>>
// CHECK-NEXT: }
@@ -319,7 +319,7 @@ func @transpose_eint_3D(%arg0: tensor<3x4x5x!FHE.eint<6>>) -> tensor<5x4x3x!FHE.
// -----
// CHECK-LABEL: @transpose_eint_3D_after_op(%arg0: tensor<3x4x5x!FHE.eint<6>>, %arg1: tensor<3x4x5x!FHE.eint<6>>) -> tensor<5x4x3x!FHE.eint<6>>
func @transpose_eint_3D_after_op(%arg0: tensor<3x4x5x!FHE.eint<6>>, %arg1: tensor<3x4x5x!FHE.eint<6>>) -> tensor<5x4x3x!FHE.eint<6>> {
func.func @transpose_eint_3D_after_op(%arg0: tensor<3x4x5x!FHE.eint<6>>, %arg1: tensor<3x4x5x!FHE.eint<6>>) -> tensor<5x4x3x!FHE.eint<6>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.add_eint"(%arg0, %arg1) {MANP = 2 : ui{{[0-9]+}}} : (tensor<3x4x5x!FHE.eint<6>>, tensor<3x4x5x!FHE.eint<6>>) -> tensor<3x4x5x!FHE.eint<6>>
// CHECK-NEXT: %[[v1:.*]] = "FHELinalg.transpose"(%[[v0]]) {MANP = 2 : ui{{[0-9]+}}} : (tensor<3x4x5x!FHE.eint<6>>) -> tensor<5x4x3x!FHE.eint<6>>
// CHECK-NEXT: return %[[v1]] : tensor<5x4x3x!FHE.eint<6>>

View File

@@ -1,6 +1,6 @@
// RUN: concretecompiler --passes canonicalize --passes MANP --action=dump-fhe --split-input-file %s 2>&1 | FileCheck %s
func @single_cst_add_eint_int(%t: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_cst_add_eint_int(%t: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
%cst = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
@@ -12,7 +12,7 @@ func @single_cst_add_eint_int(%t: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<
// -----
func @single_cst_add_eint_int_from_cst_elements(%t: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_cst_add_eint_int_from_cst_elements(%t: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
%cst1 = arith.constant 1 : i3
%cst = tensor.from_elements %cst1, %cst1, %cst1, %cst1, %cst1, %cst1, %cst1, %cst1: tensor<8xi3>
@@ -24,7 +24,7 @@ func @single_cst_add_eint_int_from_cst_elements(%t: tensor<8x!FHE.eint<2>>) -> t
}
// -----
func @single_dyn_add_eint_int(%e: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
func.func @single_dyn_add_eint_int(%e: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
{
// sqrt(1 + (2^2-1)^2) = 3..16
// CHECK: %[[ret:.*]] = "FHELinalg.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (tensor<8x!FHE.eint<2>>, tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
@@ -35,7 +35,7 @@ func @single_dyn_add_eint_int(%e: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> t
// -----
func @single_add_eint(%e0: tensor<8x!FHE.eint<2>>, %e1: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_add_eint(%e0: tensor<8x!FHE.eint<2>>, %e1: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
// CHECK: %[[ret:.*]] = "FHELinalg.add_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (tensor<8x!FHE.eint<2>>, tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
%0 = "FHELinalg.add_eint"(%e0, %e1) : (tensor<8x!FHE.eint<2>>, tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
@@ -45,7 +45,7 @@ func @single_add_eint(%e0: tensor<8x!FHE.eint<2>>, %e1: tensor<8x!FHE.eint<2>>)
// -----
func @single_cst_sub_int_eint(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_cst_sub_int_eint(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
%cst = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
@@ -57,7 +57,7 @@ func @single_cst_sub_int_eint(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<
// -----
func @single_cst_sub_int_eint_from_cst_elements(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_cst_sub_int_eint_from_cst_elements(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
%cst1 = arith.constant 1 : i3
%cst = tensor.from_elements %cst1, %cst1, %cst1, %cst1, %cst1, %cst1, %cst1, %cst1: tensor<8xi3>
@@ -70,7 +70,7 @@ func @single_cst_sub_int_eint_from_cst_elements(%e: tensor<8x!FHE.eint<2>>) -> t
// -----
func @single_cst_sub_eint_int(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_cst_sub_eint_int(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
%cst = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
@@ -82,7 +82,7 @@ func @single_cst_sub_eint_int(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<
// -----
func @single_cst_sub_eint_int_from_cst_elements(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_cst_sub_eint_int_from_cst_elements(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
%cst1 = arith.constant 1 : i3
%cst = tensor.from_elements %cst1, %cst1, %cst1, %cst1, %cst1, %cst1, %cst1, %cst1: tensor<8xi3>
@@ -95,7 +95,7 @@ func @single_cst_sub_eint_int_from_cst_elements(%e: tensor<8x!FHE.eint<2>>) -> t
// -----
func @single_sub_eint(%e0: tensor<8x!FHE.eint<2>>, %e1: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_sub_eint(%e0: tensor<8x!FHE.eint<2>>, %e1: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
// CHECK: %[[ret:.*]] = "FHELinalg.sub_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (tensor<8x!FHE.eint<2>>, tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
%0 = "FHELinalg.sub_eint"(%e0, %e1) : (tensor<8x!FHE.eint<2>>, tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
@@ -105,7 +105,7 @@ func @single_sub_eint(%e0: tensor<8x!FHE.eint<2>>, %e1: tensor<8x!FHE.eint<2>>)
// -----
func @single_neg_eint(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_neg_eint(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
// CHECK: %[[ret:.*]] = "FHELinalg.neg_eint"(%[[op0:.*]]) {MANP = 1 : ui{{[0-9]+}}} : (tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
%0 = "FHELinalg.neg_eint"(%e) : (tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
@@ -115,7 +115,7 @@ func @single_neg_eint(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
// -----
func @single_dyn_sub_int_eint(%e: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
func.func @single_dyn_sub_int_eint(%e: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
{
// sqrt(1 + (2^2-1)^2) = 3.16
// CHECK: %[[ret:.*]] = "FHELinalg.sub_int_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (tensor<8xi3>, tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
@@ -126,7 +126,7 @@ func @single_dyn_sub_int_eint(%e: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> t
// -----
func @single_cst_mul_eint_int(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_cst_mul_eint_int(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
%cst = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
@@ -138,7 +138,7 @@ func @single_cst_mul_eint_int(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<
// -----
func @single_cst_mul_eint_int_from_cst_elements(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @single_cst_mul_eint_int_from_cst_elements(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
%cst1 = arith.constant 1 : i3
%cst = tensor.from_elements %cst1, %cst1, %cst1, %cst1, %cst1, %cst1, %cst1, %cst1: tensor<8xi3>
@@ -151,7 +151,7 @@ func @single_cst_mul_eint_int_from_cst_elements(%e: tensor<8x!FHE.eint<2>>) -> t
// -----
func @single_dyn_mul_eint_int(%e: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
func.func @single_dyn_mul_eint_int(%e: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
{
// sqrt(1 * (2^2-1)^2) = 3.16
// CHECK: %[[ret:.*]] = "FHELinalg.mul_eint_int"([[op0:.*]], %[[op1:.*]]) {MANP = 3 : ui{{[0-9]+}}} : (tensor<8x!FHE.eint<2>>, tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
@@ -162,7 +162,7 @@ func @single_dyn_mul_eint_int(%e: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> t
// -----
func @chain_add_eint_int(%e: tensor<8x!FHE.eint<3>>) -> tensor<8x!FHE.eint<3>>
func.func @chain_add_eint_int(%e: tensor<8x!FHE.eint<3>>) -> tensor<8x!FHE.eint<3>>
{
%cst0 = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi4>
%cst1 = arith.constant dense<[0, 7, 2, 5, 6, 2, 1, 7]> : tensor<8xi4>
@@ -181,7 +181,7 @@ func @chain_add_eint_int(%e: tensor<8x!FHE.eint<3>>) -> tensor<8x!FHE.eint<3>>
// -----
func @chain_add_eint_int_neg_eint(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
func.func @chain_add_eint_int_neg_eint(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.eint<2>>
{
%cst0 = arith.constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi3>
// CHECK: %[[ret:.*]] = "FHELinalg.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (tensor<8x!FHE.eint<2>>, tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
@@ -197,7 +197,7 @@ func @chain_add_eint_int_neg_eint(%e: tensor<8x!FHE.eint<2>>) -> tensor<8x!FHE.e
// FHELinalg.apply_multi_lookup_table
/////////////////////////////////////////////////
func @apply_lookup_table(%t: tensor<3x3x!FHE.eint<2>>) -> tensor<3x3x!FHE.eint<3>> {
func.func @apply_lookup_table(%t: tensor<3x3x!FHE.eint<2>>) -> tensor<3x3x!FHE.eint<3>> {
%lut = arith.constant dense<[1,3,5,7]> : tensor<4xi64>
// CHECK: %[[RES:.*]] = "FHELinalg.apply_lookup_table"(%[[T:.*]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<3x3x!FHE.eint<2>>, tensor<4xi64>) -> tensor<3x3x!FHE.eint<3>>
%res = "FHELinalg.apply_lookup_table"(%t, %lut) : (tensor<3x3x!FHE.eint<2>>, tensor<4xi64>) -> tensor<3x3x!FHE.eint<3>>
@@ -206,7 +206,7 @@ func @apply_lookup_table(%t: tensor<3x3x!FHE.eint<2>>) -> tensor<3x3x!FHE.eint<3
// -----
func @apply_lookup_table_after_op(%t: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> tensor<8x!FHE.eint<3>> {
func.func @apply_lookup_table_after_op(%t: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>) -> tensor<8x!FHE.eint<3>> {
%lut = arith.constant dense<[1,3,5,7]> : tensor<4xi64>
// CHECK: %[[V0:.*]] = "FHELinalg.mul_eint_int"([[T:.*]], %[[I:.*]]) {MANP = 3 : ui{{[0-9]+}}} : (tensor<8x!FHE.eint<2>>, tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
%0 = "FHELinalg.mul_eint_int"(%t, %i) : (tensor<8x!FHE.eint<2>>, tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
@@ -218,7 +218,7 @@ func @apply_lookup_table_after_op(%t: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>)
// -----
func @apply_multi_lookup_table(%t: tensor<3x3x!FHE.eint<2>>, %luts: tensor<3x3x4xi64>) -> tensor<3x3x!FHE.eint<3>> {
func.func @apply_multi_lookup_table(%t: tensor<3x3x!FHE.eint<2>>, %luts: tensor<3x3x4xi64>) -> tensor<3x3x!FHE.eint<3>> {
// CHECK: %[[RES:.*]] = "FHELinalg.apply_multi_lookup_table"(%[[T:.*]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<3x3x!FHE.eint<2>>, tensor<3x3x4xi64>) -> tensor<3x3x!FHE.eint<3>>
%res = "FHELinalg.apply_multi_lookup_table"(%t, %luts) : (tensor<3x3x!FHE.eint<2>>, tensor<3x3x4xi64>) -> tensor<3x3x!FHE.eint<3>>
return %res : tensor<3x3x!FHE.eint<3>>
@@ -226,7 +226,7 @@ func @apply_multi_lookup_table(%t: tensor<3x3x!FHE.eint<2>>, %luts: tensor<3x3x4
// -----
func @apply_multi_lookup_table_after_op(%t: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>, %luts: tensor<8x4xi64>) -> tensor<8x!FHE.eint<3>> {
func.func @apply_multi_lookup_table_after_op(%t: tensor<8x!FHE.eint<2>>, %i: tensor<8xi3>, %luts: tensor<8x4xi64>) -> tensor<8x!FHE.eint<3>> {
// CHECK: %[[V0:.*]] = "FHELinalg.mul_eint_int"([[T:.*]], %[[I:.*]]) {MANP = 3 : ui{{[0-9]+}}} : (tensor<8x!FHE.eint<2>>, tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
%0 = "FHELinalg.mul_eint_int"(%t, %i) : (tensor<8x!FHE.eint<2>>, tensor<8xi3>) -> tensor<8x!FHE.eint<2>>
// CHECK-NEXT: %[[RES:.*]] = "FHELinalg.apply_multi_lookup_table"(%[[V0]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<8x!FHE.eint<2>>, tensor<8x4xi64>) -> tensor<8x!FHE.eint<3>>
@@ -240,7 +240,7 @@ func @apply_multi_lookup_table_after_op(%t: tensor<8x!FHE.eint<2>>, %i: tensor<8
// FHELinalg.dot_eint_int
/////////////////////////////////////////////////
func @single_cst_dot(%t: tensor<4x!FHE.eint<2>>) -> !FHE.eint<2>
func.func @single_cst_dot(%t: tensor<4x!FHE.eint<2>>) -> !FHE.eint<2>
{
%cst = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi3>
// sqrt(1^2*1 + 2^2*1 + 3^2*1 + 4^2*1) = 5.477225575
@@ -252,7 +252,7 @@ func @single_cst_dot(%t: tensor<4x!FHE.eint<2>>) -> !FHE.eint<2>
// -----
func @single_dyn_dot(%t: tensor<4x!FHE.eint<2>>, %dyn: tensor<4xi3>) -> !FHE.eint<2>
func.func @single_dyn_dot(%t: tensor<4x!FHE.eint<2>>, %dyn: tensor<4xi3>) -> !FHE.eint<2>
{
// sqrt(1*(2^2-1)^2*4) = 16
// CHECK: %[[V0:.*]] = "FHELinalg.dot_eint_int"([[T:.*]], %[[DYN:.*]]) {MANP = 6 : ui{{[[0-9]+}}} : (tensor<4x!FHE.eint<2>>, tensor<4xi3>) -> !FHE.eint<2>
@@ -263,7 +263,7 @@ func @single_dyn_dot(%t: tensor<4x!FHE.eint<2>>, %dyn: tensor<4xi3>) -> !FHE.ein
// -----
func @single_cst_dot_after_op(%t: tensor<4x!FHE.eint<2>>, %i: tensor<4xi3>) -> !FHE.eint<2>
func.func @single_cst_dot_after_op(%t: tensor<4x!FHE.eint<2>>, %i: tensor<4xi3>) -> !FHE.eint<2>
{
// sqrt((2^2-1)^2*1) = sqrt(9) = 3
// CHECK: %[[V0:.*]] = "FHELinalg.mul_eint_int"([[T:.*]], %[[I:.*]]) {MANP = 3 : ui{{[0-9]+}}}
@@ -279,7 +279,7 @@ func @single_cst_dot_after_op(%t: tensor<4x!FHE.eint<2>>, %i: tensor<4xi3>) -> !
// -----
func @single_dyn_dot_after_op(%t: tensor<4x!FHE.eint<2>>, %i: tensor<4xi3>) -> !FHE.eint<2>
func.func @single_dyn_dot_after_op(%t: tensor<4x!FHE.eint<2>>, %i: tensor<4xi3>) -> !FHE.eint<2>
{
// sqrt((2^2-1)^2*1) = sqrt(9) = 3
// CHECK: %[[V0:.*]] = "FHELinalg.mul_eint_int"([[T:.*]], %[[I:.*]]) {MANP = 3 : ui{{[0-9]+}}}
@@ -298,7 +298,7 @@ func @single_dyn_dot_after_op(%t: tensor<4x!FHE.eint<2>>, %i: tensor<4xi3>) -> !
// FHELinalg.matmul_ent_int
/////////////////////////////////////////////////
func @matmul_eint_int_dyn_p_1(%arg0: tensor<3x1x!FHE.eint<2>>, %arg1: tensor<1x2xi3>) -> tensor<3x2x!FHE.eint<2>> {
func.func @matmul_eint_int_dyn_p_1(%arg0: tensor<3x1x!FHE.eint<2>>, %arg1: tensor<1x2xi3>) -> tensor<3x2x!FHE.eint<2>> {
// p = 0
// acc = manp(0) = 1
// mul = manp(mul_eint_int(eint<2>, i3) = 1 * (2^2-1)^2 = 9
@@ -311,7 +311,7 @@ func @matmul_eint_int_dyn_p_1(%arg0: tensor<3x1x!FHE.eint<2>>, %arg1: tensor<1x2
// -----
func @matmul_eint_int_dyn_p_2(%arg0: tensor<3x2x!FHE.eint<2>>, %arg1: tensor<2x2xi3>) -> tensor<3x2x!FHE.eint<2>> {
func.func @matmul_eint_int_dyn_p_2(%arg0: tensor<3x2x!FHE.eint<2>>, %arg1: tensor<2x2xi3>) -> tensor<3x2x!FHE.eint<2>> {
// p = 0
// acc = manp(0) = 1
// mul = manp(mul_eint_int(eint<2>, i3) = 1 * (2^2-1)^2 = 9
@@ -327,7 +327,7 @@ func @matmul_eint_int_dyn_p_2(%arg0: tensor<3x2x!FHE.eint<2>>, %arg1: tensor<2x2
// -----
func @matmul_eint_int_cst_p_1(%arg0: tensor<3x1x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
func.func @matmul_eint_int_cst_p_1(%arg0: tensor<3x1x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
%0 = arith.constant dense<[[3, 1]]> : tensor<1x2xi3>
// c(m,n) = a(m,p) * b(p,n) the max cst is used for n = 0
// acc = manp(0) = 1
@@ -341,7 +341,7 @@ func @matmul_eint_int_cst_p_1(%arg0: tensor<3x1x!FHE.eint<2>>) -> tensor<3x2x!FH
// -----
func @matmul_eint_int_cst_p_2_n_0(%arg0: tensor<3x2x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
func.func @matmul_eint_int_cst_p_2_n_0(%arg0: tensor<3x2x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
%0 = arith.constant dense<[[4, 1],[3, 1]]> : tensor<2x2xi3>
// c(m,n) = a(m,p) * b(p,n) the max csts [4,3] are used for n = 0
// p = 0
@@ -359,7 +359,7 @@ func @matmul_eint_int_cst_p_2_n_0(%arg0: tensor<3x2x!FHE.eint<2>>) -> tensor<3x2
// -----
func @matmul_eint_int_cst_p_2_n_1(%arg0: tensor<3x2x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
func.func @matmul_eint_int_cst_p_2_n_1(%arg0: tensor<3x2x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
%0 = arith.constant dense<[[1, 4],[3, 1]]> : tensor<2x2xi3>
// c(m,n) = a(m,p) * b(p,n) the max csts [4,1] are used for n = 1
// p = 0
@@ -377,7 +377,7 @@ func @matmul_eint_int_cst_p_2_n_1(%arg0: tensor<3x2x!FHE.eint<2>>) -> tensor<3x2
// -----
func @matmul_eint_int_cst() -> tensor<4x3x!FHE.eint<7>> {
func.func @matmul_eint_int_cst() -> tensor<4x3x!FHE.eint<7>> {
%0 = "FHE.zero_tensor"() : () -> tensor<4x3x!FHE.eint<7>>
// ===============================
@@ -553,7 +553,7 @@ func @matmul_eint_int_cst() -> tensor<4x3x!FHE.eint<7>> {
// -----
func @matmul_eint_int_cst_different_operand_manp() -> tensor<4x3x!FHE.eint<7>> {
func.func @matmul_eint_int_cst_different_operand_manp() -> tensor<4x3x!FHE.eint<7>> {
%z = "FHE.zero_tensor"() : () -> tensor<4x3x!FHE.eint<7>>
%a = arith.constant dense<[[4, 6, 5], [2, 6, 3], [5, 6, 1], [5, 5, 3]]> : tensor<4x3xi8>
@@ -581,7 +581,7 @@ func @matmul_eint_int_cst_different_operand_manp() -> tensor<4x3x!FHE.eint<7>> {
// -----
func @matmul_int_eint_dyn_p_1(%arg0: tensor<3x1xi3>, %arg1: tensor<1x2x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
func.func @matmul_int_eint_dyn_p_1(%arg0: tensor<3x1xi3>, %arg1: tensor<1x2x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
// p = 0
// acc = manp(0) = 1
// mul = manp(mul_eint_int(eint<2>, i3) = 1 * (2^2-1)^2 = 9
@@ -594,7 +594,7 @@ func @matmul_int_eint_dyn_p_1(%arg0: tensor<3x1xi3>, %arg1: tensor<1x2x!FHE.eint
// -----
func @matmul_int_eint_dyn_p_2(%arg0: tensor<3x2xi3>, %arg1: tensor<2x2x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
func.func @matmul_int_eint_dyn_p_2(%arg0: tensor<3x2xi3>, %arg1: tensor<2x2x!FHE.eint<2>>) -> tensor<3x2x!FHE.eint<2>> {
// p = 0
// acc = manp(0) = 1
// mul = manp(mul_eint_int(eint<2>, i3) = 1 * (2^2-1)^2 = 9
@@ -610,7 +610,7 @@ func @matmul_int_eint_dyn_p_2(%arg0: tensor<3x2xi3>, %arg1: tensor<2x2x!FHE.eint
// -----
func @matmul_int_eint_cst_p_1(%arg0: tensor<1x3x!FHE.eint<2>>) -> tensor<2x3x!FHE.eint<2>> {
func.func @matmul_int_eint_cst_p_1(%arg0: tensor<1x3x!FHE.eint<2>>) -> tensor<2x3x!FHE.eint<2>> {
%0 = arith.constant dense<[[3], [1]]> : tensor<2x1xi3>
// c(m,n) = a(m,p) * b(p,n) the max cst is used for m = 0
// acc = manp(0) = 1
@@ -624,7 +624,7 @@ func @matmul_int_eint_cst_p_1(%arg0: tensor<1x3x!FHE.eint<2>>) -> tensor<2x3x!FH
// -----
func @matmul_int_eint_cst_p_2_n_0(%arg0: tensor<2x3x!FHE.eint<2>>) -> tensor<2x3x!FHE.eint<2>> {
func.func @matmul_int_eint_cst_p_2_n_0(%arg0: tensor<2x3x!FHE.eint<2>>) -> tensor<2x3x!FHE.eint<2>> {
%0 = arith.constant dense<[[3, 4],[1, 1]]> : tensor<2x2xi3>
// c(m,n) = a(m,p) * b(p,n) the max csts [4,3] are used for m = 0
// p = 0
@@ -642,7 +642,7 @@ func @matmul_int_eint_cst_p_2_n_0(%arg0: tensor<2x3x!FHE.eint<2>>) -> tensor<2x3
// -----
func @matmul_int_eint_cst_p_2_n_1(%arg0: tensor<2x3x!FHE.eint<2>>) -> tensor<2x3x!FHE.eint<2>> {
func.func @matmul_int_eint_cst_p_2_n_1(%arg0: tensor<2x3x!FHE.eint<2>>) -> tensor<2x3x!FHE.eint<2>> {
%0 = arith.constant dense<[[4, 1],[3, 1]]> : tensor<2x2xi3>
// c(m,n) = a(m,p) * b(p,n) the max csts [4,1] are used for m = 1
// p = 0
@@ -660,7 +660,7 @@ func @matmul_int_eint_cst_p_2_n_1(%arg0: tensor<2x3x!FHE.eint<2>>) -> tensor<2x3
// -----
func @matmul_int_eint_cst() -> tensor<3x2x!FHE.eint<7>> {
func.func @matmul_int_eint_cst() -> tensor<3x2x!FHE.eint<7>> {
%0 = "FHE.zero_tensor"() : () -> tensor<3x2x!FHE.eint<7>>
// ===============================
@@ -820,7 +820,7 @@ func @matmul_int_eint_cst() -> tensor<3x2x!FHE.eint<7>> {
// -----
func @matmul_int_eint_cst_different_operand_manp() -> tensor<3x2x!FHE.eint<7>> {
func.func @matmul_int_eint_cst_different_operand_manp() -> tensor<3x2x!FHE.eint<7>> {
%z = "FHE.zero_tensor"() : () -> tensor<3x2x!FHE.eint<7>>
%a = arith.constant dense<[[4, 6], [2, 6], [5, 6]]> : tensor<3x2xi8>
@@ -844,7 +844,7 @@ func @matmul_int_eint_cst_different_operand_manp() -> tensor<3x2x!FHE.eint<7>> {
// -----
func @sum() -> !FHE.eint<7> {
func.func @sum() -> !FHE.eint<7> {
%0 = "FHE.zero_tensor"() : () -> tensor<5x3x4x2x!FHE.eint<7>>
// CHECK: MANP = 11 : ui{{[0-9]+}}
@@ -1000,7 +1000,7 @@ func @sum() -> !FHE.eint<7> {
// -----
func @concat() -> tensor<3x!FHE.eint<7>> {
func.func @concat() -> tensor<3x!FHE.eint<7>> {
%0 = "FHE.zero_tensor"() : () -> tensor<4x!FHE.eint<7>>
// CHECK: MANP = 2 : ui{{[0-9]+}}
%1 = "FHELinalg.sum"(%0) { keep_dims = true } : (tensor<4x!FHE.eint<7>>) -> tensor<1x!FHE.eint<7>>
@@ -1032,7 +1032,7 @@ func @concat() -> tensor<3x!FHE.eint<7>> {
// -----
func @conv2d_const_weight_const_bias(%input: tensor<1x1x4x4x!FHE.eint<6>>) -> tensor<1x1x2x2x!FHE.eint<6>> {
func.func @conv2d_const_weight_const_bias(%input: tensor<1x1x4x4x!FHE.eint<6>>) -> tensor<1x1x2x2x!FHE.eint<6>> {
%weight = arith.constant dense<[[[[1, 2], [2, 1]]]]> : tensor<1x1x2x2xi7>
%bias = arith.constant dense<[5]> : tensor<1xi7>
// CHECK: %[[V1:.*]] = "FHELinalg.conv2d"(%[[A0:.*]], %[[A1:.*]], %[[A2:.*]]) {MANP = 6 : ui{{[0-9]+}}
@@ -1044,7 +1044,7 @@ func @conv2d_const_weight_const_bias(%input: tensor<1x1x4x4x!FHE.eint<6>>) -> te
// -----
func @conv2d_const_weight(%input: tensor<1x1x4x4x!FHE.eint<6>>, %bias : tensor<1xi7>) -> tensor<1x1x2x2x!FHE.eint<6>> {
func.func @conv2d_const_weight(%input: tensor<1x1x4x4x!FHE.eint<6>>, %bias : tensor<1xi7>) -> tensor<1x1x2x2x!FHE.eint<6>> {
%weight = arith.constant dense<[[[[1, 2], [2, 1]]]]> : tensor<1x1x2x2xi7>
// CHECK: %[[V1:.*]] = "FHELinalg.conv2d"(%[[A0:.*]], %[[A1:.*]], %[[A2:.*]]) {MANP = 64 : ui{{[0-9]+}}
%0 = "FHELinalg.conv2d"(%input, %weight, %bias){
@@ -1055,7 +1055,7 @@ func @conv2d_const_weight(%input: tensor<1x1x4x4x!FHE.eint<6>>, %bias : tensor<1
// -----
func @conv2d_const_bias(%input: tensor<1x1x4x4x!FHE.eint<2>>, %weight: tensor<1x1x2x2xi3>) -> tensor<1x1x2x2x!FHE.eint<2>> {
func.func @conv2d_const_bias(%input: tensor<1x1x4x4x!FHE.eint<2>>, %weight: tensor<1x1x2x2xi3>) -> tensor<1x1x2x2x!FHE.eint<2>> {
%bias = arith.constant dense<[5]> : tensor<1xi3>
// CHECK: %[[V1:.*]] = "FHELinalg.conv2d"(%[[A0:.*]], %[[A1:.*]], %[[A2:.*]]) {MANP = 7 : ui{{[0-9]+}}
%0 = "FHELinalg.conv2d"(%input, %weight, %bias){
@@ -1066,7 +1066,7 @@ func @conv2d_const_bias(%input: tensor<1x1x4x4x!FHE.eint<2>>, %weight: tensor<1x
// -----
func @conv2d_weight_const_bias(%input: tensor<1x1x4x4x!FHE.eint<2>>, %weight: tensor<1x1x2x2xi3>, %bias : tensor<1xi3>) -> tensor<1x1x2x2x!FHE.eint<2>> {
func.func @conv2d_weight_const_bias(%input: tensor<1x1x4x4x!FHE.eint<2>>, %weight: tensor<1x1x2x2xi3>, %bias : tensor<1xi3>) -> tensor<1x1x2x2x!FHE.eint<2>> {
// CHECK: %[[V1:.*]] = "FHELinalg.conv2d"(%[[A0:.*]], %[[A1:.*]], %[[A2:.*]]) {MANP = 7 : ui{{[0-9]+}}
%0 = "FHELinalg.conv2d"(%input, %weight, %bias){
strides = dense<[2,2]> : tensor<2xi64>, dilations = dense<[1,1]> : tensor<2xi64>, padding = dense<[0,0,0,0]> : tensor<4xi64>
@@ -1076,7 +1076,7 @@ func @conv2d_weight_const_bias(%input: tensor<1x1x4x4x!FHE.eint<2>>, %weight: te
// -----
func @conv2d_batched_multiple_channels(%input: tensor<100x3x4x4x!FHE.eint<2>>, %weight: tensor<5x3x2x2xi3>, %bias : tensor<5xi3>) -> tensor<100x5x2x2x!FHE.eint<2>> {
func.func @conv2d_batched_multiple_channels(%input: tensor<100x3x4x4x!FHE.eint<2>>, %weight: tensor<5x3x2x2xi3>, %bias : tensor<5xi3>) -> tensor<100x5x2x2x!FHE.eint<2>> {
// CHECK: %[[V1:.*]] = "FHELinalg.conv2d"(%[[A0:.*]], %[[A1:.*]], %[[A2:.*]]) {MANP = 11 : ui{{[0-9]+}}
%0 = "FHELinalg.conv2d"(%input, %weight, %bias){
strides = dense<[2,2]> : tensor<2xi64>, dilations = dense<[1,1]> : tensor<2xi64>, padding = dense<[0,0,0,0]> : tensor<4xi64>

View File

@@ -1,6 +1,6 @@
// RUN: concretecompiler --passes MANP --action=dump-fhe --split-input-file %s 2>&1 | FileCheck %s
func @tensor_from_elements_1(%a: !FHE.eint<2>, %b: !FHE.eint<2>, %c: !FHE.eint<2>, %d: !FHE.eint<2>) -> tensor<4x!FHE.eint<2>>
func.func @tensor_from_elements_1(%a: !FHE.eint<2>, %b: !FHE.eint<2>, %c: !FHE.eint<2>, %d: !FHE.eint<2>) -> tensor<4x!FHE.eint<2>>
{
// The MANP value is 1 as all operands are function arguments
// CHECK: %[[ret:.*]] = tensor.from_elements %[[a:.*]], %[[b:.*]], %[[c:.*]], %[[d:.*]] {MANP = 1 : ui{{[[0-9]+}}} : tensor<4x!FHE.eint<2>>
@@ -11,7 +11,7 @@ func @tensor_from_elements_1(%a: !FHE.eint<2>, %b: !FHE.eint<2>, %c: !FHE.eint<2
// -----
func @tensor_from_elements_2(%a: !FHE.eint<2>, %b: !FHE.eint<2>, %c: !FHE.eint<2>, %d: !FHE.eint<2>) -> tensor<4x!FHE.eint<2>>
func.func @tensor_from_elements_2(%a: !FHE.eint<2>, %b: !FHE.eint<2>, %c: !FHE.eint<2>, %d: !FHE.eint<2>) -> tensor<4x!FHE.eint<2>>
{
%cst = arith.constant 3 : i3
@@ -27,7 +27,7 @@ func @tensor_from_elements_2(%a: !FHE.eint<2>, %b: !FHE.eint<2>, %c: !FHE.eint<2
// -----
func @tensor_extract_1(%t: tensor<4x!FHE.eint<2>>) -> !FHE.eint<2>
func.func @tensor_extract_1(%t: tensor<4x!FHE.eint<2>>) -> !FHE.eint<2>
{
%cst = arith.constant 1 : index
@@ -40,7 +40,7 @@ func @tensor_extract_1(%t: tensor<4x!FHE.eint<2>>) -> !FHE.eint<2>
// -----
func @tensor_extract_2(%a: tensor<4x!FHE.eint<2>>) -> !FHE.eint<2>
func.func @tensor_extract_2(%a: tensor<4x!FHE.eint<2>>) -> !FHE.eint<2>
{
%c1 = arith.constant 1 : index
%c3 = arith.constant dense<3> : tensor<4xi3>
@@ -54,7 +54,7 @@ func @tensor_extract_2(%a: tensor<4x!FHE.eint<2>>) -> !FHE.eint<2>
// -----
func @tensor_extract_slice_1(%t: tensor<2x10x!FHE.eint<2>>) -> tensor<1x5x!FHE.eint<2>>
func.func @tensor_extract_slice_1(%t: tensor<2x10x!FHE.eint<2>>) -> tensor<1x5x!FHE.eint<2>>
{
// CHECK: %[[V0:.*]] = tensor.extract_slice %[[t:.*]][1, 5] [1, 5] [1, 1] {MANP = 1 : ui{{[[0-9]+}}} : tensor<2x10x!FHE.eint<2>> to tensor<1x5x!FHE.eint<2>>
%0 = tensor.extract_slice %t[1, 5] [1, 5] [1, 1] : tensor<2x10x!FHE.eint<2>> to tensor<1x5x!FHE.eint<2>>
@@ -64,7 +64,7 @@ func @tensor_extract_slice_1(%t: tensor<2x10x!FHE.eint<2>>) -> tensor<1x5x!FHE.e
// -----
func @tensor_extract_slice_2(%a: tensor<4x!FHE.eint<2>>) -> tensor<2x!FHE.eint<2>>
func.func @tensor_extract_slice_2(%a: tensor<4x!FHE.eint<2>>) -> tensor<2x!FHE.eint<2>>
{
%c3 = arith.constant dense <3> : tensor<4xi3>
@@ -79,7 +79,7 @@ func @tensor_extract_slice_2(%a: tensor<4x!FHE.eint<2>>) -> tensor<2x!FHE.eint<2
// -----
func @tensor_insert_slice_1(%t0: tensor<2x10x!FHE.eint<2>>, %t1: tensor<2x2x!FHE.eint<2>>) -> tensor<2x10x!FHE.eint<2>>
func.func @tensor_insert_slice_1(%t0: tensor<2x10x!FHE.eint<2>>, %t1: tensor<2x2x!FHE.eint<2>>) -> tensor<2x10x!FHE.eint<2>>
{
// %[[V0:.*]] = tensor.insert_slice %[[t1:.*]] into %[[t0:.*]][0, 5] [2, 2] [1, 1] {MANP = 1 : ui{{[[0-9]+}}} : tensor<2x2x!FHE.eint<2>> into tensor<2x10x!FHE.eint<2>>
%0 = tensor.insert_slice %t1 into %t0[0, 5] [2, 2] [1, 1] : tensor<2x2x!FHE.eint<2>> into tensor<2x10x!FHE.eint<2>>
@@ -89,7 +89,7 @@ func @tensor_insert_slice_1(%t0: tensor<2x10x!FHE.eint<2>>, %t1: tensor<2x2x!FHE
// -----
func @tensor_collapse_shape_1(%a: tensor<2x2x4x!FHE.eint<6>>) -> tensor<2x8x!FHE.eint<6>> {
func.func @tensor_collapse_shape_1(%a: tensor<2x2x4x!FHE.eint<6>>) -> tensor<2x8x!FHE.eint<6>> {
// CHECK: tensor.collapse_shape %[[A:.*]] [[X:.*]] {MANP = 1 : ui{{[0-9]+}}}
%0 = tensor.collapse_shape %a [[0],[1,2]] : tensor<2x2x4x!FHE.eint<6>> into tensor<2x8x!FHE.eint<6>>
return %0 : tensor<2x8x!FHE.eint<6>>
@@ -97,7 +97,7 @@ func @tensor_collapse_shape_1(%a: tensor<2x2x4x!FHE.eint<6>>) -> tensor<2x8x!FHE
// -----
func @tensor_collapse_shape_2(%a: tensor<2x2x4x!FHE.eint<2>>, %b: tensor<2x2x4xi3>) -> tensor<2x8x!FHE.eint<2>>
func.func @tensor_collapse_shape_2(%a: tensor<2x2x4x!FHE.eint<2>>, %b: tensor<2x2x4xi3>) -> tensor<2x8x!FHE.eint<2>>
{
// CHECK: "FHELinalg.add_eint_int"(%[[A:.*]], %[[B:.*]]) {MANP = 4 : ui{{[0-9]+}}}
%0 = "FHELinalg.add_eint_int"(%a, %b) : (tensor<2x2x4x!FHE.eint<2>>, tensor<2x2x4xi3>) -> tensor<2x2x4x!FHE.eint<2>>
@@ -108,7 +108,7 @@ func @tensor_collapse_shape_2(%a: tensor<2x2x4x!FHE.eint<2>>, %b: tensor<2x2x4xi
// -----
func @tensor_expand_shape_1(%a: tensor<2x8x!FHE.eint<6>>) -> tensor<2x2x4x!FHE.eint<6>> {
func.func @tensor_expand_shape_1(%a: tensor<2x8x!FHE.eint<6>>) -> tensor<2x2x4x!FHE.eint<6>> {
// CHECK: tensor.expand_shape %[[A:.*]] [[X:.*]] {MANP = 1 : ui{{[0-9]+}}}
%0 = tensor.expand_shape %a [[0],[1,2]] : tensor<2x8x!FHE.eint<6>> into tensor<2x2x4x!FHE.eint<6>>
return %0 : tensor<2x2x4x!FHE.eint<6>>
@@ -116,7 +116,7 @@ func @tensor_expand_shape_1(%a: tensor<2x8x!FHE.eint<6>>) -> tensor<2x2x4x!FHE.e
// -----
func @tensor_expand_shape_2(%a: tensor<2x8x!FHE.eint<2>>, %b: tensor<2x8xi3>) -> tensor<2x2x4x!FHE.eint<2>>
func.func @tensor_expand_shape_2(%a: tensor<2x8x!FHE.eint<2>>, %b: tensor<2x8xi3>) -> tensor<2x2x4x!FHE.eint<2>>
{
// CHECK: "FHELinalg.add_eint_int"(%[[A:.*]], %[[B:.*]]) {MANP = 4 : ui{{[0-9]+}}}
%0 = "FHELinalg.add_eint_int"(%a, %b) : (tensor<2x8x!FHE.eint<2>>, tensor<2x8xi3>) -> tensor<2x8x!FHE.eint<2>>

View File

@@ -1,6 +1,6 @@
// RUN: not concretecompiler --action=dump-llvm-ir %s 2>&1| FileCheck %s
// CHECK-LABEL: Could not determine V0 parameters
func @test(%arg0: !FHE.eint<9>) {
func.func @test(%arg0: !FHE.eint<9>) {
return
}

View File

@@ -1,6 +1,6 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: FHE.eint didn't support precision equals to 0
func @test(%arg0: !FHE.eint<0>) {
func.func @test(%arg0: !FHE.eint<0>) {
return
}

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --action=dump-fhe %s 2>&1| FileCheck %s
// CHECK-LABEL: func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func.func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: return %arg0 : !FHE.eint<2>
%0 = arith.constant 0 : i3
@@ -9,8 +9,8 @@ func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK-LABEL: func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func.func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: return %arg0 : !FHE.eint<2>
%0 = arith.constant 0 : i3
@@ -18,8 +18,8 @@ func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK-LABEL: func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func.func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: return %arg0 : !FHE.eint<2>
%0 = arith.constant 1 : i3

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.add_eint' op should have the width of encrypted inputs equals
func @add_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<3>) -> !FHE.eint<2> {
func.func @add_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<3>) -> !FHE.eint<2> {
%1 = "FHE.add_eint"(%arg0, %arg1): (!FHE.eint<2>, !FHE.eint<3>) -> (!FHE.eint<2>)
return %1: !FHE.eint<2>
}

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.add_eint' op should have the width of encrypted inputs and result equals
func @add_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<3> {
func.func @add_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<3> {
%1 = "FHE.add_eint"(%arg0, %arg1): (!FHE.eint<2>, !FHE.eint<2>) -> (!FHE.eint<3>)
return %1: !FHE.eint<3>
}

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.add_eint_int' op should have the width of plain input equals to width of encrypted input + 1
func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
func.func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
%0 = arith.constant 1 : i4
%1 = "FHE.add_eint_int"(%arg0, %0): (!FHE.eint<2>, i4) -> (!FHE.eint<2>)
return %1: !FHE.eint<2>

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.add_eint_int' op should have the width of encrypted inputs and result equals
func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<3> {
func.func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<3> {
%0 = arith.constant 1 : i2
%1 = "FHE.add_eint_int"(%arg0, %0): (!FHE.eint<2>, i2) -> (!FHE.eint<3>)
return %1: !FHE.eint<3>

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.apply_lookup_table' op : `lut` (operand #2) inner dimension should have size 4(=2^2) to match `ct` (operand #1) elements bitwidth (2)
func @apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<8xi3>) -> !FHE.eint<2> {
func.func @apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<8xi3>) -> !FHE.eint<2> {
%1 = "FHE.apply_lookup_table"(%arg0, %arg1): (!FHE.eint<2>, tensor<8xi3>) -> (!FHE.eint<2>)
return %1: !FHE.eint<2>
}

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.mul_eint_int' op should have the width of plain input equals to width of encrypted input + 1
func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
func.func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
%0 = arith.constant 1 : i4
%1 = "FHE.mul_eint_int"(%arg0, %0): (!FHE.eint<2>, i4) -> (!FHE.eint<2>)
return %1: !FHE.eint<2>

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.mul_eint_int' op should have the width of encrypted inputs and result equals
func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<3> {
func.func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<3> {
%0 = arith.constant 1 : i2
%1 = "FHE.mul_eint_int"(%arg0, %0): (!FHE.eint<2>, i2) -> (!FHE.eint<3>)
return %1: !FHE.eint<3>

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.neg_eint' op should have the width of encrypted inputs and result equals
func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<3> {
func.func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<3> {
%1 = "FHE.neg_eint"(%arg0): (!FHE.eint<2>) -> (!FHE.eint<3>)
return %1: !FHE.eint<3>
}

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.sub_int_eint' op should have the width of plain input equals to width of encrypted input + 1
func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
func.func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
%0 = arith.constant 1 : i4
%1 = "FHE.sub_int_eint"(%0, %arg0): (i4, !FHE.eint<2>) -> (!FHE.eint<2>)
return %1: !FHE.eint<2>

View File

@@ -1,7 +1,7 @@
// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: error: 'FHE.sub_int_eint' op should have the width of encrypted inputs and result equals
func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<3> {
func.func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<3> {
%0 = arith.constant 1 : i2
%1 = "FHE.sub_int_eint"(%0, %arg0): (i2, !FHE.eint<2>) -> (!FHE.eint<3>)
return %1: !FHE.eint<3>

View File

@@ -1,6 +1,6 @@
// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s
func @zero_1D_scalar() -> tensor<4x!FHE.eint<2>> {
func.func @zero_1D_scalar() -> tensor<4x!FHE.eint<2>> {
// expected-error @+1 {{'FHE.zero_tensor' op}}
%0 = "FHE.zero_tensor"() : () -> !FHE.eint<2>
return %0 : !FHE.eint<2>
@@ -8,7 +8,7 @@ func @zero_1D_scalar() -> tensor<4x!FHE.eint<2>> {
// -----
func @zero_plaintext() -> tensor<4x9xi32> {
func.func @zero_plaintext() -> tensor<4x9xi32> {
// expected-error @+1 {{'FHE.zero_tensor' op}}
%0 = "FHE.zero_tensor"() : () -> tensor<4x9xi32>
return %0 : tensor<4x9xi32>

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK: func @zero() -> !FHE.eint<2>
func @zero() -> !FHE.eint<2> {
// CHECK: func.func @zero() -> !FHE.eint<2>
func.func @zero() -> !FHE.eint<2> {
// CHECK-NEXT: %[[RET:.*]] = "FHE.zero"() : () -> !FHE.eint<2>
// CHECK-NEXT: return %[[RET]] : !FHE.eint<2>
@@ -9,26 +9,26 @@ func @zero() -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK: func @zero_1D() -> tensor<4x!FHE.eint<2>> {
// CHECK: func.func @zero_1D() -> tensor<4x!FHE.eint<2>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<4x!FHE.eint<2>>
// CHECK-NEXT: return %[[v0]] : tensor<4x!FHE.eint<2>>
// CHECK-NEXT: }
func @zero_1D() -> tensor<4x!FHE.eint<2>> {
func.func @zero_1D() -> tensor<4x!FHE.eint<2>> {
%0 = "FHE.zero_tensor"() : () -> tensor<4x!FHE.eint<2>>
return %0 : tensor<4x!FHE.eint<2>>
}
// CHECK: func @zero_2D() -> tensor<4x9x!FHE.eint<2>> {
// CHECK: func.func @zero_2D() -> tensor<4x9x!FHE.eint<2>> {
// CHECK-NEXT: %[[v0:.*]] = "FHE.zero_tensor"() : () -> tensor<4x9x!FHE.eint<2>>
// CHECK-NEXT: return %[[v0]] : tensor<4x9x!FHE.eint<2>>
// CHECK-NEXT: }
func @zero_2D() -> tensor<4x9x!FHE.eint<2>> {
func.func @zero_2D() -> tensor<4x9x!FHE.eint<2>> {
%0 = "FHE.zero_tensor"() : () -> tensor<4x9x!FHE.eint<2>>
return %0 : tensor<4x9x!FHE.eint<2>>
}
// CHECK-LABEL: func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func.func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i3
// CHECK-NEXT: %[[V2:.*]] = "FHE.add_eint_int"(%arg0, %[[V1]]) : (!FHE.eint<2>, i3) -> !FHE.eint<2>
// CHECK-NEXT: return %[[V2]] : !FHE.eint<2>
@@ -38,8 +38,8 @@ func @add_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK-LABEL: func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func.func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i3
// CHECK-NEXT: %[[V2:.*]] = "FHE.sub_int_eint"(%[[V1]], %arg0) : (i3, !FHE.eint<2>) -> !FHE.eint<2>
// CHECK-NEXT: return %[[V2]] : !FHE.eint<2>
@@ -49,8 +49,8 @@ func @sub_int_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK-LABEL: func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func.func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i3
// CHECK-NEXT: %[[V2:.*]] = "FHE.sub_eint_int"(%arg0, %[[V1]]) : (!FHE.eint<2>, i3) -> !FHE.eint<2>
// CHECK-NEXT: return %[[V2]] : !FHE.eint<2>
@@ -60,8 +60,8 @@ func @sub_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK-LABEL: func @sub_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2>
func @sub_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @sub_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2>
func.func @sub_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: %[[V1:.*]] = "FHE.sub_eint"(%arg0, %arg1) : (!FHE.eint<2>, !FHE.eint<2>) -> !FHE.eint<2>
// CHECK-NEXT: return %[[V1]] : !FHE.eint<2>
@@ -69,8 +69,8 @@ func @sub_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK-LABEL: func @neg_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func @neg_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @neg_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func.func @neg_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: %[[V1:.*]] = "FHE.neg_eint"(%arg0) : (!FHE.eint<2>) -> !FHE.eint<2>
// CHECK-NEXT: return %[[V1]] : !FHE.eint<2>
@@ -78,8 +78,8 @@ func @neg_eint(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK-LABEL: func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2>
func.func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: %[[V1:.*]] = arith.constant 1 : i3
// CHECK-NEXT: %[[V2:.*]] = "FHE.mul_eint_int"(%arg0, %[[V1]]) : (!FHE.eint<2>, i3) -> !FHE.eint<2>
// CHECK-NEXT: return %[[V2]] : !FHE.eint<2>
@@ -89,8 +89,8 @@ func @mul_eint_int(%arg0: !FHE.eint<2>) -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK-LABEL: func @add_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2>
func @add_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @add_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2>
func.func @add_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2> {
// CHECK-NEXT: %[[V1:.*]] = "FHE.add_eint"(%arg0, %arg1) : (!FHE.eint<2>, !FHE.eint<2>) -> !FHE.eint<2>
// CHECK-NEXT: return %[[V1]] : !FHE.eint<2>
@@ -98,8 +98,8 @@ func @add_eint(%arg0: !FHE.eint<2>, %arg1: !FHE.eint<2>) -> !FHE.eint<2> {
return %1: !FHE.eint<2>
}
// CHECK-LABEL: func @apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<4xi64>) -> !FHE.eint<2>
func @apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<4xi64>) -> !FHE.eint<2> {
// CHECK-LABEL: func.func @apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<4xi64>) -> !FHE.eint<2>
func.func @apply_lookup_table(%arg0: !FHE.eint<2>, %arg1: tensor<4xi64>) -> !FHE.eint<2> {
// CHECK-NEXT: %[[V1:.*]] = "FHE.apply_lookup_table"(%arg0, %arg1) : (!FHE.eint<2>, tensor<4xi64>) -> !FHE.eint<2>
// CHECK-NEXT: return %[[V1]] : !FHE.eint<2>

View File

@@ -1,6 +1,6 @@
// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s
// CHECK-LABEL: func @memref_arg(%arg0: memref<2x!FHE.eint<7>>
func @memref_arg(%arg0: memref<2x!FHE.eint<7>>) {
// CHECK-LABEL: func.func @memref_arg(%arg0: memref<2x!FHE.eint<7>>
func.func @memref_arg(%arg0: memref<2x!FHE.eint<7>>) {
return
}

View File

@@ -1,11 +1,11 @@
// RUN: concretecompiler %s --action=roundtrip 2>&1 | FileCheck %s
//CHECK: func @mapped_lut(%[[A0:.*]]: tensor<2x3x!FHE.eint<2>>, %[[A1:.*]]: tensor<5x4xi64>, %[[A2:.*]]: tensor<2x3xindex>) -> tensor<2x3x!FHE.eint<2>> {
//CHECK: func.func @mapped_lut(%[[A0:.*]]: tensor<2x3x!FHE.eint<2>>, %[[A1:.*]]: tensor<5x4xi64>, %[[A2:.*]]: tensor<2x3xindex>) -> tensor<2x3x!FHE.eint<2>> {
//CHECK-NEXT: %[[V0:.*]] = "FHELinalg.apply_mapped_lookup_table"(%[[A0]], %[[A1]], %[[A2]]) : (tensor<2x3x!FHE.eint<2>>, tensor<5x4xi64>, tensor<2x3xindex>) -> tensor<2x3x!FHE.eint<2>>
//CHECK-NEXT: return %[[V0]] : tensor<2x3x!FHE.eint<2>>
//CHECK-NEXT: }
func @mapped_lut(%t: tensor<2x3x!FHE.eint<2>>, %luts: tensor<5x4xi64>, %map: tensor<2x3xindex>) -> tensor<2x3x!FHE.eint<2>> {
func.func @mapped_lut(%t: tensor<2x3x!FHE.eint<2>>, %luts: tensor<5x4xi64>, %map: tensor<2x3xindex>) -> tensor<2x3x!FHE.eint<2>> {
%0 = "FHELinalg.apply_mapped_lookup_table"(%t, %luts, %map): (tensor<2x3x!FHE.eint<2>>, tensor<5x4xi64>, tensor<2x3xindex>) -> tensor<2x3x!FHE.eint<2>>
return %0: tensor<2x3x!FHE.eint<2>>
}

View File

@@ -1,10 +1,10 @@
// RUN: concretecompiler %s --action=roundtrip 2>&1 | FileCheck %s
//CHECK: func @multi_lut(%[[A0:.*]]: tensor<4x4x!FHE.eint<2>>, %[[A1:.*]]: tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>> {
//CHECK: func.func @multi_lut(%[[A0:.*]]: tensor<4x4x!FHE.eint<2>>, %[[A1:.*]]: tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>> {
//CHECK-NEXT: %[[V0:.*]] = "FHELinalg.apply_multi_lookup_table"(%[[A0]], %[[A1]]) : (tensor<4x4x!FHE.eint<2>>, tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>>
//CHECK-NEXT: return %[[V0]] : tensor<4x4x!FHE.eint<2>>
//CHECK-NEXT: }
func @multi_lut(%arg0: tensor<4x4x!FHE.eint<2>>, %arg1: tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>> {
func.func @multi_lut(%arg0: tensor<4x4x!FHE.eint<2>>, %arg1: tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>> {
%1 = "FHELinalg.apply_multi_lookup_table"(%arg0, %arg1): (tensor<4x4x!FHE.eint<2>>, tensor<4x4x4xi64>) -> tensor<4x4x!FHE.eint<2>>
return %1: tensor<4x4x!FHE.eint<2>>
}

View File

@@ -1,10 +1,10 @@
// RUN: concretecompiler %s --action=roundtrip 2>&1 | FileCheck %s
//CHECK: func @multi_lut(%[[A0:.*]]: tensor<4x3x!FHE.eint<2>>, %[[A1:.*]]: tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>> {
//CHECK: func.func @multi_lut(%[[A0:.*]]: tensor<4x3x!FHE.eint<2>>, %[[A1:.*]]: tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>> {
//CHECK-NEXT: %[[V0:.*]] = "FHELinalg.apply_multi_lookup_table"(%[[A0]], %[[A1]]) : (tensor<4x3x!FHE.eint<2>>, tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>>
//CHECK-NEXT: return %[[V0]] : tensor<4x3x!FHE.eint<2>>
//CHECK-NEXT: }
func @multi_lut(%arg0: tensor<4x3x!FHE.eint<2>>, %arg1: tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>> {
func.func @multi_lut(%arg0: tensor<4x3x!FHE.eint<2>>, %arg1: tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>> {
%1 = "FHELinalg.apply_multi_lookup_table"(%arg0, %arg1): (tensor<4x3x!FHE.eint<2>>, tensor<3x4xi64>) -> tensor<4x3x!FHE.eint<2>>
return %1: tensor<4x3x!FHE.eint<2>>
}

View File

@@ -2,7 +2,7 @@
// -----
func @main() -> tensor<0x!FHE.eint<7>> {
func.func @main() -> tensor<0x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op should have at least 2 inputs}}
%0 = "FHELinalg.concat"() : () -> tensor<0x!FHE.eint<7>>
return %0 : tensor<0x!FHE.eint<7>>
@@ -10,7 +10,7 @@ func @main() -> tensor<0x!FHE.eint<7>> {
// -----
func @main(%x: tensor<4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
func.func @main(%x: tensor<4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op should have at least 2 inputs}}
%0 = "FHELinalg.concat"(%x) : (tensor<4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>>
return %0 : tensor<4x!FHE.eint<7>>
@@ -18,7 +18,7 @@ func @main(%x: tensor<4x!FHE.eint<7>>) -> tensor<4x!FHE.eint<7>> {
// -----
func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<6>> {
func.func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<6>> {
// expected-error @+1 {{'FHELinalg.concat' op should have the width of encrypted inputs and result equals}}
%0 = "FHELinalg.concat"(%x, %y) : (tensor<4x!FHE.eint<7>>, tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<6>>
return %0 : tensor<7x!FHE.eint<6>>
@@ -26,7 +26,7 @@ func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!
// -----
func @main(%x: tensor<4x!FHE.eint<6>>, %y: tensor<3x!FHE.eint<6>>) -> tensor<7x!FHE.eint<7>> {
func.func @main(%x: tensor<4x!FHE.eint<6>>, %y: tensor<3x!FHE.eint<6>>) -> tensor<7x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op should have the width of encrypted inputs and result equals}}
%0 = "FHELinalg.concat"(%x, %y) : (tensor<4x!FHE.eint<6>>, tensor<3x!FHE.eint<6>>) -> tensor<7x!FHE.eint<7>>
return %0 : tensor<7x!FHE.eint<7>>
@@ -34,7 +34,7 @@ func @main(%x: tensor<4x!FHE.eint<6>>, %y: tensor<3x!FHE.eint<6>>) -> tensor<7x!
// -----
func @main(%x: tensor<4x!FHE.eint<6>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
func.func @main(%x: tensor<4x!FHE.eint<6>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op should have the width of encrypted inputs and result equals}}
%0 = "FHELinalg.concat"(%x, %y) : (tensor<4x!FHE.eint<6>>, tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>>
return %0 : tensor<7x!FHE.eint<7>>
@@ -42,7 +42,7 @@ func @main(%x: tensor<4x!FHE.eint<6>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!
// -----
func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
func.func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op has invalid axis attribute}}
%0 = "FHELinalg.concat"(%x, %y) { axis = 3 } : (tensor<4x!FHE.eint<7>>, tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>>
return %0 : tensor<7x!FHE.eint<7>>
@@ -50,7 +50,7 @@ func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!
// -----
func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
func.func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op has invalid axis attribute}}
%0 = "FHELinalg.concat"(%x, %y) { axis = -3 } : (tensor<4x!FHE.eint<7>>, tensor<3x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>>
return %0 : tensor<7x!FHE.eint<7>>
@@ -58,7 +58,7 @@ func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<7x!
// -----
func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<10x!FHE.eint<7>> {
func.func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<10x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op does not have the proper output shape of <7>}}
%0 = "FHELinalg.concat"(%x, %y) : (tensor<4x!FHE.eint<7>>, tensor<3x!FHE.eint<7>>) -> tensor<10x!FHE.eint<7>>
return %0 : tensor<10x!FHE.eint<7>>
@@ -66,7 +66,7 @@ func @main(%x: tensor<4x!FHE.eint<7>>, %y: tensor<3x!FHE.eint<7>>) -> tensor<10x
// -----
func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<5x4x!FHE.eint<7>>) -> tensor<10x4x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<5x4x!FHE.eint<7>>) -> tensor<10x4x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op does not have the proper output shape of <8x4>}}
%0 = "FHELinalg.concat"(%x, %y) : (tensor<3x4x!FHE.eint<7>>, tensor<5x4x!FHE.eint<7>>) -> tensor<10x4x!FHE.eint<7>>
return %0 : tensor<10x4x!FHE.eint<7>>
@@ -74,7 +74,7 @@ func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<5x4x!FHE.eint<7>>) -> tensor
// -----
func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x10x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x10x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op does not have the proper output shape of <3x9>}}
%0 = "FHELinalg.concat"(%x, %y) { axis = 1 } : (tensor<3x4x!FHE.eint<7>>, tensor<3x5x!FHE.eint<7>>) -> tensor<3x10x!FHE.eint<7>>
return %0 : tensor<3x10x!FHE.eint<7>>
@@ -82,7 +82,7 @@ func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor
// -----
func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op does not have the proper shape of <?x4x10> for input #0}}
%0 = "FHELinalg.concat"(%x, %y) { axis = 0 } : (tensor<3x4x!FHE.eint<7>>, tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>>
return %0 : tensor<3x4x10x!FHE.eint<7>>
@@ -90,7 +90,7 @@ func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor
// -----
func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op does not have the proper shape of <3x?x10> for input #0}}
%0 = "FHELinalg.concat"(%x, %y) { axis = 1 } : (tensor<3x4x!FHE.eint<7>>, tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>>
return %0 : tensor<3x4x10x!FHE.eint<7>>
@@ -98,7 +98,7 @@ func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor
// -----
func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op does not have the proper shape of <3x4x?> for input #0}}
%0 = "FHELinalg.concat"(%x, %y) { axis = 2 } : (tensor<3x4x!FHE.eint<7>>, tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>>
return %0 : tensor<3x4x10x!FHE.eint<7>>
@@ -106,7 +106,7 @@ func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor
// -----
func @main(%x: tensor<3x4x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op does not have the proper shape of <3x4x?> for input #1}}
%0 = "FHELinalg.concat"(%x, %y) { axis = 2 } : (tensor<3x4x4x!FHE.eint<7>>, tensor<3x5x!FHE.eint<7>>) -> tensor<3x4x10x!FHE.eint<7>>
return %0 : tensor<3x4x10x!FHE.eint<7>>
@@ -114,7 +114,7 @@ func @main(%x: tensor<3x4x4x!FHE.eint<7>>, %y: tensor<3x5x!FHE.eint<7>>) -> tens
// -----
func @main(%x: tensor<3x4x4x!FHE.eint<7>>, %y: tensor<3x5x4x!FHE.eint<7>>) -> tensor<3x10x4x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x4x!FHE.eint<7>>, %y: tensor<3x5x4x!FHE.eint<7>>) -> tensor<3x10x4x!FHE.eint<7>> {
// expected-error @+1 {{'FHELinalg.concat' op does not have the proper output shape of <3x9x4>}}
%0 = "FHELinalg.concat"(%x, %y) { axis = 1 } : (tensor<3x4x4x!FHE.eint<7>>, tensor<3x5x4x!FHE.eint<7>>) -> tensor<3x10x4x!FHE.eint<7>>
return %0 : tensor<3x10x4x!FHE.eint<7>>

View File

@@ -2,99 +2,99 @@
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.concat"(%[[a0]], %[[a1]]) : (tensor<3x!FHE.eint<7>>, tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<7x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<3x!FHE.eint<7>>, %y: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
func.func @main(%x: tensor<3x!FHE.eint<7>>, %y: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) : (tensor<3x!FHE.eint<7>>, tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>>
return %0 : tensor<7x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.concat"(%[[a0]], %[[a1]]) : (tensor<3x!FHE.eint<7>>, tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<7x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<3x!FHE.eint<7>>, %y: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
func.func @main(%x: tensor<3x!FHE.eint<7>>, %y: tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 0 } : (tensor<3x!FHE.eint<7>>, tensor<4x!FHE.eint<7>>) -> tensor<7x!FHE.eint<7>>
return %0 : tensor<7x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.concat"(%[[a0]], %[[a1]]) : (tensor<3x4x!FHE.eint<7>>, tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) : (tensor<3x4x!FHE.eint<7>>, tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>>
return %0 : tensor<7x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.concat"(%[[a0]], %[[a1]]) : (tensor<3x4x!FHE.eint<7>>, tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<7x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
func.func @main(%x: tensor<3x4x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 0 } : (tensor<3x4x!FHE.eint<7>>, tensor<4x4x!FHE.eint<7>>) -> tensor<7x4x!FHE.eint<7>>
return %0 : tensor<7x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<4x3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<4x3x!FHE.eint<7>>, %[[a1:.*]]: tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.concat"(%[[a0]], %[[a1]]) : (tensor<4x3x!FHE.eint<7>>, tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<4x7x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<4x3x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>> {
func.func @main(%x: tensor<4x3x!FHE.eint<7>>, %y: tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 1 } : (tensor<4x3x!FHE.eint<7>>, tensor<4x4x!FHE.eint<7>>) -> tensor<4x7x!FHE.eint<7>>
return %0 : tensor<4x7x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.concat"(%[[a0]], %[[a1]]) : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
func.func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>>
return %0 : tensor<4x3x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.concat"(%[[a0]], %[[a1]]) : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<4x3x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
func.func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 0 } : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<4x3x4x!FHE.eint<7>>
return %0 : tensor<4x3x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.concat"(%[[a0]], %[[a1]]) : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<2x6x4x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>> {
func.func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 1 } : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x6x4x!FHE.eint<7>>
return %0 : tensor<2x6x4x!FHE.eint<7>>
}
// -----
// CHECK: func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>> {
// CHECK: func.func @main(%[[a0:.*]]: tensor<2x3x4x!FHE.eint<7>>, %[[a1:.*]]: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>> {
// CHECK-NEXT: %[[v0:.*]] = "FHELinalg.concat"(%[[a0]], %[[a1]]) : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>>
// CHECK-NEXT: return %[[v0]] : tensor<2x3x8x!FHE.eint<7>>
// CHECK-NEXT: }
func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>> {
func.func @main(%x: tensor<2x3x4x!FHE.eint<7>>, %y: tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>> {
%0 = "FHELinalg.concat"(%x, %y) { axis = 2 } : (tensor<2x3x4x!FHE.eint<7>>, tensor<2x3x4x!FHE.eint<7>>) -> tensor<2x3x8x!FHE.eint<7>>
return %0 : tensor<2x3x8x!FHE.eint<7>>
}

View File

@@ -1,7 +1,7 @@
// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s
// Incompatible shapes
func @dot_incompatible_shapes(
func.func @dot_incompatible_shapes(
%arg0: tensor<5x!FHE.eint<5>>,
%arg1: tensor<4xi32>) -> !FHE.eint<5>
{
@@ -15,7 +15,7 @@ func @dot_incompatible_shapes(
// -----
// Incompatible input types
func @dot_incompatible_input_types(
func.func @dot_incompatible_input_types(
%arg0: tensor<5x!FHE.eint<2>>,
%arg1: tensor<4xf32>) -> !FHE.eint<2>
{
@@ -29,7 +29,7 @@ func @dot_incompatible_input_types(
// -----
// Wrong number of dimensions
func @dot_num_dims(
func.func @dot_num_dims(
%arg0: tensor<2x4x!FHE.eint<2>>,
%arg1: tensor<2x4xi3>) -> !FHE.eint<2>
{
@@ -43,7 +43,7 @@ func @dot_num_dims(
// -----
// Wrong returns type
func @dot_incompatible_return(
func.func @dot_incompatible_return(
%arg0: tensor<4x!FHE.eint<2>>,
%arg1: tensor<4xi3>) -> !FHE.eint<3>
{
@@ -57,7 +57,7 @@ func @dot_incompatible_return(
// -----
// Wrong integer size
func @dot_incompatible_int(
func.func @dot_incompatible_int(
%arg0: tensor<4x!FHE.eint<2>>,
%arg1: tensor<4xi4>) -> !FHE.eint<2>
{

Some files were not shown because too many files have changed in this diff Show More