diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td @@ -232,8 +232,10 @@ AnyTypeOf<[AnyMemRef, AnyRankedTensor], "", "::mlir::ShapedType">; def ReduceOp : LinalgStructuredBase_Op<"reduce", [ - SameVariadicOperandSize, SingleBlockImplicitTerminator<"YieldOp"> - ]> { + DeclareOpInterfaceMethods, + DeclareOpInterfaceMethods, + SameVariadicOperandSize, + SingleBlockImplicitTerminator<"YieldOp">]> { let summary = "Reduce operator"; let description = [{ Executes `combiner` on the `dimensions` of `inputs` and returns the diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp --- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp @@ -1196,6 +1196,19 @@ // ReduceOp //===----------------------------------------------------------------------===// +void ReduceOp::getAsmBlockArgumentNames(Region ®ion, + OpAsmSetValueNameFn setNameFn) { + for (Value v : getRegionInputArgs()) + setNameFn(v, "in"); + for (Value v : getRegionOutputArgs()) + setNameFn(v, "init"); +} + +void ReduceOp::getAsmResultNames( + function_ref setNameFn) { + setNameFn(getResults().front(), "reduced"); +} + ArrayAttr ReduceOp::getIteratorTypes() { int64_t inputRank = getInputs()[0].getType().cast().getRank(); SmallVector iteratorTypes(inputRank,