diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td --- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td +++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td @@ -1256,7 +1256,7 @@ the behavior is undefined. The source memref can be zero-ranked. In that case, the reassociation - indices must be empty and the the result shape may only consist of unit + indices must be empty and the result shape may only consist of unit dimensions. For simplicity, this op may not be used to cast dynamicity of dimension @@ -1294,15 +1294,7 @@ OpBuilder<(ins "ArrayRef":$resultShape, "Value":$src, "ArrayRef":$reassociation)> ]; - - let extraClassDeclaration = commonExtraClassDeclaration # [{ - /// Return `true` if this source MemRef type is guaranteed to be collapsible - /// according to the given reassociation indices. In the presence of dynamic - /// strides this is usually not the case. - static bool isGuaranteedCollapsible( - MemRefType srcType, ArrayRef reassociation); - }]; - + let extraClassDeclaration = commonExtraClassDeclaration; let hasVerifier = 1; } @@ -1382,7 +1374,14 @@ build($_builder, $_state, resultType, src, reassociationMaps, attrs); }]> ]; - let extraClassDeclaration = commonExtraClassDeclaration; + let extraClassDeclaration = commonExtraClassDeclaration # [{ + /// Return `true` if this source MemRef type is guaranteed to be collapsible + /// according to the given reassociation indices. In the presence of dynamic + /// strides this is usually not the case. + static bool isGuaranteedCollapsible( + MemRefType srcType, ArrayRef reassociation); + }]; + let hasVerifier = 1; } diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp --- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp +++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp @@ -1866,7 +1866,7 @@ srcType.getContext()); } -bool ExpandShapeOp::isGuaranteedCollapsible( +bool CollapseShapeOp::isGuaranteedCollapsible( MemRefType srcType, ArrayRef reassociation) { // MemRefs with standard layout are always collapsible. if (srcType.getLayout().isIdentity()) diff --git a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp --- a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp @@ -144,7 +144,7 @@ // If the dims are not collapsible (due to an incompatible source layout // map), force an out-of-place bufferization, i.e., a buffer copy. This // newly allocated buffer will have no layout map and thus be collapsible. - bool canBeCollapsed = memref::ExpandShapeOp::isGuaranteedCollapsible( + bool canBeCollapsed = memref::CollapseShapeOp::isGuaranteedCollapsible( bufferType, collapseShapeOp.getReassociationIndices()); Optional overrideInPlace = canBeCollapsed