[Mlir-commits] [mlir] fb0654c - [mlir][interfaces][NFC] Remove ViewLikeInterface::expandToRank

Matthias Springer llvmlistbot at llvm.org
Tue Jul 5 07:59:29 PDT 2022


Author: Matthias Springer
Date: 2022-07-05T16:59:18+02:00
New Revision: fb0654ced38830980d3edea628a7aeeabcf298ac

URL: https://github.com/llvm/llvm-project/commit/fb0654ced38830980d3edea628a7aeeabcf298ac
DIFF: https://github.com/llvm/llvm-project/commit/fb0654ced38830980d3edea628a7aeeabcf298ac.diff

LOG: [mlir][interfaces][NFC] Remove ViewLikeInterface::expandToRank

This helper function is no longer needed.

Differential Revision: https://reviews.llvm.org/D129145

Added: 
    

Modified: 
    mlir/include/mlir/Interfaces/ViewLikeInterface.td
    mlir/lib/Interfaces/ViewLikeInterface.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Interfaces/ViewLikeInterface.td b/mlir/include/mlir/Interfaces/ViewLikeInterface.td
index d389bab840a6a..8be74c928c488 100644
--- a/mlir/include/mlir/Interfaces/ViewLikeInterface.td
+++ b/mlir/include/mlir/Interfaces/ViewLikeInterface.td
@@ -457,20 +457,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
         ::mlir::OffsetSizeAndStrideOpInterface::getStaticStridesAttrName(),
         ::mlir::OpTrait::AttrSizedOperandSegments<void>::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<OpFoldResult> &offsets,
-     SmallVector<OpFoldResult> &sizes,
-     SmallVector<OpFoldResult> &strides,
-     llvm::function_ref<OpFoldResult(Value, int64_t)> createDim);
+    }
   }];
 
   let verify = [{

diff  --git a/mlir/lib/Interfaces/ViewLikeInterface.cpp b/mlir/lib/Interfaces/ViewLikeInterface.cpp
index 31b9d1a0ac436..dfeda72b38119 100644
--- a/mlir/lib/Interfaces/ViewLikeInterface.cpp
+++ b/mlir/lib/Interfaces/ViewLikeInterface.cpp
@@ -179,25 +179,6 @@ bool mlir::detail::sameOffsetsSizesAndStrides(
   return true;
 }
 
-void OffsetSizeAndStrideOpInterface::expandToRank(
-    Value target, SmallVector<OpFoldResult> &offsets,
-    SmallVector<OpFoldResult> &sizes, SmallVector<OpFoldResult> &strides,
-    llvm::function_ref<OpFoldResult(Value, int64_t)> createOrFoldDim) {
-  auto shapedType = target.getType().cast<ShapedType>();
-  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<OpFoldResult, 4>
 mlir::getMixedOffsets(OffsetSizeAndStrideOpInterface op,
                       ArrayAttr staticOffsets, ValueRange offsets) {


        


More information about the Mlir-commits mailing list