From f1844f15c1ad54b78f2d84087df4b51fe5f703f6 Mon Sep 17 00:00:00 2001 From: Tobias Gysi Date: Wed, 23 Jun 2021 09:06:04 +0000 Subject: [PATCH] [mlir][linalg] Change the FillOp library call signature. Adapt the FillOp library call signature to the updated operand order introduced in https://reviews.llvm.org/D10412. The patch reverts the special treatment of FillOp in LinalgToStandard. Differential Revision: https://reviews.llvm.org/D104360 --- mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h | 6 +++--- mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp | 14 +------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h index 5ec7405..87c279a 100644 --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h @@ -73,18 +73,18 @@ getReassociationIndicesForReshape(ShapedType sourceType, ShapedType targetType); /// Examples: /// /// 1. linalg.fill(%f, %A) : f32, memref -/// name mangles into `linalg_fill_viewf32_f32_impl` +/// name mangles into `linalg_fill_f32_viewf32` /// /// 2. linalg.dot %A, %B, %C : /// (memref, /// memref, memref) -/// name mangles into `linalg_dot_viewxf32_viewxf32_viewf32_impl` +/// name mangles into `linalg_dot_viewxf32_viewxf32_viewf32` /// /// 3. linalg.matmul(...) : /// memref, /// memref, /// memref -/// name mangles into `linalg_matmul_viewxxf32_viewxxf32_viewxxf32_impl` +/// name mangles into `linalg_matmul_viewxxf32_viewxxf32_viewxxf32` std::string generateLibraryCallName(Operation *op); /// Returns `num` AffineDimExpr dimensions at positions diff --git a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp index 67a935d..6f422e5 100644 --- a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp +++ b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp @@ -100,21 +100,9 @@ LogicalResult mlir::linalg::LinalgOpToLibraryCallRewrite::matchAndRewrite( if (isa(op)) return failure(); - // Swap the operand order of the FillOp to maintain the pretty printed - // signature that takes an output buffer followed by the fill value. - SmallVector originalOperandOrder = op->getOperands(); - if (auto fillOp = dyn_cast(op.getOperation())) { - Value value = fillOp.value(); - Value output = fillOp.output(); - op->setOperands(ValueRange{output, value}); - } - auto libraryCallName = getLibraryCallSymbolRef(op, rewriter); - if (!libraryCallName) { - // Restore the operand order in case it has been modified. - op->setOperands(originalOperandOrder); + if (!libraryCallName) return failure(); - } // TODO: Add support for more complex library call signatures that include // indices or captured values. -- 2.7.4