From 406804609cea16ba718e5a0d1b8169cc3ee21cae Mon Sep 17 00:00:00 2001 From: Bourgerie Quentin Date: Mon, 25 Mar 2024 14:14:58 +0100 Subject: [PATCH] fix(compiler): Handle tensor.empty in the pass that lower tfhe to the simulatation code --- .../lib/Conversion/SimulateTFHE/SimulateTFHE.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/compilers/concrete-compiler/compiler/lib/Conversion/SimulateTFHE/SimulateTFHE.cpp b/compilers/concrete-compiler/compiler/lib/Conversion/SimulateTFHE/SimulateTFHE.cpp index f39f36cb80..211f95c8b2 100644 --- a/compilers/concrete-compiler/compiler/lib/Conversion/SimulateTFHE/SimulateTFHE.cpp +++ b/compilers/concrete-compiler/compiler/lib/Conversion/SimulateTFHE/SimulateTFHE.cpp @@ -607,18 +607,20 @@ void SimulateTFHEPass::runOnOperation() { mlir::concretelang::TypeConvertingReinstantiationPattern< mlir::tensor::CollapseShapeOp>, mlir::concretelang::TypeConvertingReinstantiationPattern< - mlir::tensor::YieldOp>>(&getContext(), converter); + mlir::tensor::YieldOp>, + mlir::concretelang::TypeConvertingReinstantiationPattern< + mlir::tensor::EmptyOp>>(&getContext(), converter); // legalize ops only if operand and result types are legal target.addDynamicallyLegalOp< mlir::tensor::YieldOp, mlir::scf::YieldOp, mlir::tensor::GenerateOp, mlir::tensor::ExtractSliceOp, mlir::tensor::ExtractOp, mlir::tensor::InsertOp, mlir::tensor::InsertSliceOp, mlir::tensor::FromElementsOp, mlir::tensor::ExpandShapeOp, - mlir::tensor::CollapseShapeOp, mlir::bufferization::AllocTensorOp>( - [&](mlir::Operation *op) { - return converter.isLegal(op->getResultTypes()) && - converter.isLegal(op->getOperandTypes()); - }); + mlir::tensor::CollapseShapeOp, mlir::bufferization::AllocTensorOp, + mlir::tensor::EmptyOp>([&](mlir::Operation *op) { + return converter.isLegal(op->getResultTypes()) && + converter.isLegal(op->getOperandTypes()); + }); // Make sure that no ops `linalg.generic` that have illegal types target .addDynamicallyLegalOp(