diff --git a/mlir/include/mlir/Interfaces/ViewLikeInterface.td b/mlir/include/mlir/Interfaces/ViewLikeInterface.td --- a/mlir/include/mlir/Interfaces/ViewLikeInterface.td +++ b/mlir/include/mlir/Interfaces/ViewLikeInterface.td @@ -457,20 +457,7 @@ ::mlir::OffsetSizeAndStrideOpInterface::getStaticStridesAttrName(), ::mlir::OpTrait::AttrSizedOperandSegments::getOperandSegmentSizeAttr()}; return names; - } - /// Assume target is a shaped type and offsets/sizes/strides are vectors of - /// the same length and lower than target's rank. - /// Complete missing dims `i` with offset=0, size=dim(target, i), stride=1 - /// until all vectors have size rank. The commpletion occurs for the most - /// minor dimensions (i.e. fastest varying). - /// Take a `createDim` lambda that knows how to build the size of a - /// particular dimension of `target` (to avoid dialect dependencies). - static void expandToRank( - Value target, - SmallVector &offsets, - SmallVector &sizes, - SmallVector &strides, - llvm::function_ref createDim); + } }]; let verify = [{ 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 @@ -2168,6 +2168,7 @@ continue; } // Drop this dimension. + assert(inferredShape[inferredIdx] == 1 && "invalid rank reduction"); dimsToProject.set(inferredIdx); ++inferredIdx; } diff --git a/mlir/lib/Interfaces/ViewLikeInterface.cpp b/mlir/lib/Interfaces/ViewLikeInterface.cpp --- a/mlir/lib/Interfaces/ViewLikeInterface.cpp +++ b/mlir/lib/Interfaces/ViewLikeInterface.cpp @@ -179,25 +179,6 @@ return true; } -void OffsetSizeAndStrideOpInterface::expandToRank( - Value target, SmallVector &offsets, - SmallVector &sizes, SmallVector &strides, - llvm::function_ref createOrFoldDim) { - auto shapedType = target.getType().cast(); - unsigned rank = shapedType.getRank(); - assert(offsets.size() == sizes.size() && "mismatched lengths"); - assert(offsets.size() == strides.size() && "mismatched lengths"); - assert(offsets.size() <= rank && "rank overflow"); - MLIRContext *ctx = target.getContext(); - Attribute zero = IntegerAttr::get(IndexType::get(ctx), APInt(64, 0)); - Attribute one = IntegerAttr::get(IndexType::get(ctx), APInt(64, 1)); - for (unsigned i = offsets.size(); i < rank; ++i) { - offsets.push_back(zero); - sizes.push_back(createOrFoldDim(target, i)); - strides.push_back(one); - } -} - SmallVector mlir::getMixedOffsets(OffsetSizeAndStrideOpInterface op, ArrayAttr staticOffsets, ValueRange offsets) {