[Mlir-commits] [mlir] 334a415 - [mlir][Vector] NFC - Rename vector.strided_slice into vector.extract_strided_slice

Reid Tatge llvmlistbot at llvm.org
Mon May 11 14:21:48 PDT 2020


Author: Reid Tatge
Date: 2020-05-11T14:21:10-07:00
New Revision: 334a4159eca05b0d77972a142fa957311c3247b1

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

LOG: [mlir][Vector] NFC - Rename vector.strided_slice into vector.extract_strided_slice

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Vector/VectorOps.td
    mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
    mlir/lib/Dialect/Vector/VectorOps.cpp
    mlir/lib/Dialect/Vector/VectorTransforms.cpp
    mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
    mlir/test/Dialect/Vector/canonicalize.mlir
    mlir/test/Dialect/Vector/invalid.mlir
    mlir/test/Dialect/Vector/ops.mlir
    mlir/test/Dialect/Vector/vector-contract-transforms.mlir
    mlir/test/Dialect/Vector/vector-slices-transforms.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Vector/VectorOps.td b/mlir/include/mlir/Dialect/Vector/VectorOps.td
index 94261fa93e4d..1b2a60700bde 100644
--- a/mlir/include/mlir/Dialect/Vector/VectorOps.td
+++ b/mlir/include/mlir/Dialect/Vector/VectorOps.td
@@ -816,14 +816,14 @@ def Vector_ReshapeOp :
   }];
 }
 
-def Vector_StridedSliceOp :
-  Vector_Op<"strided_slice", [NoSideEffect,
+def Vector_ExtractStridedSliceOp :
+  Vector_Op<"extract_strided_slice", [NoSideEffect,
     PredOpTrait<"operand and result have same element type",
                  TCresVTEtIsSameAsOpBase<0, 0>>]>,
     Arguments<(ins AnyVector:$vector, I64ArrayAttr:$offsets,
                I64ArrayAttr:$sizes, I64ArrayAttr:$strides)>,
     Results<(outs AnyVector)> {
-  let summary = "strided_slice operation";
+  let summary = "extract_strided_slice operation";
   let description = [{
     Takes an n-D vector, k-D `offsets` integer array attribute, a k-sized
     `sizes` integer array attribute, a k-sized `strides` integer array
@@ -839,12 +839,12 @@ def Vector_StridedSliceOp :
     Example:
 
     ```mlir
-    %1 = vector.strided_slice %0
+    %1 = vector.extract_strided_slice %0
         {offsets = [0, 2], sizes = [2, 4], strides = [1, 1]}:
       vector<4x8x16xf32> to vector<2x4x16xf32>
 
     // TODO(ntv) Evolve to a range form syntax similar to:
-    %1 = vector.strided_slice %0[0:2:1][2:4:1]
+    %1 = vector.extract_strided_slice %0[0:2:1][2:4:1]
       vector<4x8x16xf32> to vector<2x4x16xf32>
     ```
   }];

diff  --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index 1dea41b2d99d..51cb61b0eaca 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -1057,14 +1057,15 @@ class VectorPrintOpConversion : public ConvertToLLVMPattern {
   }
 };
 
-/// Progressive lowering of StridedSliceOp to either:
+/// Progressive lowering of ExtractStridedSliceOp to either:
 ///   1. extractelement + insertelement for the 1-D case
 ///   2. extract + optional strided_slice + insert for the n-D case.
-class VectorStridedSliceOpConversion : public OpRewritePattern<StridedSliceOp> {
+class VectorStridedSliceOpConversion
+    : public OpRewritePattern<ExtractStridedSliceOp> {
 public:
-  using OpRewritePattern<StridedSliceOp>::OpRewritePattern;
+  using OpRewritePattern<ExtractStridedSliceOp>::OpRewritePattern;
 
-  LogicalResult matchAndRewrite(StridedSliceOp op,
+  LogicalResult matchAndRewrite(ExtractStridedSliceOp op,
                                 PatternRewriter &rewriter) const override {
     auto dstType = op.getResult().getType().cast<VectorType>();
 
@@ -1086,7 +1087,7 @@ class VectorStridedSliceOpConversion : public OpRewritePattern<StridedSliceOp> {
          off += stride, ++idx) {
       Value extracted = extractOne(rewriter, loc, op.vector(), off);
       if (op.offsets().getValue().size() > 1) {
-        extracted = rewriter.create<StridedSliceOp>(
+        extracted = rewriter.create<ExtractStridedSliceOp>(
             loc, extracted, getI64SubArray(op.offsets(), /* dropFront=*/1),
             getI64SubArray(op.sizes(), /* dropFront=*/1),
             getI64SubArray(op.strides(), /* dropFront=*/1));
@@ -1096,7 +1097,7 @@ class VectorStridedSliceOpConversion : public OpRewritePattern<StridedSliceOp> {
     rewriter.replaceOp(op, {res});
     return success();
   }
-  /// This pattern creates recursive StridedSliceOp, but the recursion is
+  /// This pattern creates recursive ExtractStridedSliceOp, but the recursion is
   /// bounded as the rank is strictly decreasing.
   bool hasBoundedRewriteRecursion() const final { return true; }
 };

diff  --git a/mlir/lib/Dialect/Vector/VectorOps.cpp b/mlir/lib/Dialect/Vector/VectorOps.cpp
index 96f8597baa34..ec4ef0f50361 100644
--- a/mlir/lib/Dialect/Vector/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/VectorOps.cpp
@@ -1053,7 +1053,7 @@ void ReshapeOp::getFixedVectorSizes(SmallVectorImpl<int64_t> &results) {
 }
 
 //===----------------------------------------------------------------------===//
-// StridedSliceOp
+// ExtractStridedSliceOp
 //===----------------------------------------------------------------------===//
 
 // Inference works as follows:
@@ -1074,9 +1074,10 @@ static Type inferStridedSliceOpResultType(VectorType vectorType,
   return VectorType::get(shape, vectorType.getElementType());
 }
 
-void StridedSliceOp::build(OpBuilder &builder, OperationState &result,
-                           Value source, ArrayRef<int64_t> offsets,
-                           ArrayRef<int64_t> sizes, ArrayRef<int64_t> strides) {
+void ExtractStridedSliceOp::build(OpBuilder &builder, OperationState &result,
+                                  Value source, ArrayRef<int64_t> offsets,
+                                  ArrayRef<int64_t> sizes,
+                                  ArrayRef<int64_t> strides) {
   result.addOperands(source);
   auto offsetsAttr = getVectorSubscriptAttr(builder, offsets);
   auto sizesAttr = getVectorSubscriptAttr(builder, sizes);
@@ -1089,7 +1090,7 @@ void StridedSliceOp::build(OpBuilder &builder, OperationState &result,
   result.addAttribute(getStridesAttrName(), stridesAttr);
 }
 
-static LogicalResult verify(StridedSliceOp op) {
+static LogicalResult verify(ExtractStridedSliceOp op) {
   auto type = op.getVectorType();
   auto offsets = op.offsets();
   auto sizes = op.sizes();
@@ -1101,9 +1102,9 @@ static LogicalResult verify(StridedSliceOp op) {
   }
 
   auto shape = type.getShape();
-  auto offName = StridedSliceOp::getOffsetsAttrName();
-  auto sizesName = StridedSliceOp::getSizesAttrName();
-  auto stridesName = StridedSliceOp::getStridesAttrName();
+  auto offName = ExtractStridedSliceOp::getOffsetsAttrName();
+  auto sizesName = ExtractStridedSliceOp::getSizesAttrName();
+  auto stridesName = ExtractStridedSliceOp::getStridesAttrName();
   if (failed(isIntegerArrayAttrSmallerThanShape(op, offsets, shape, offName)) ||
       failed(isIntegerArrayAttrSmallerThanShape(op, sizes, shape, sizesName)) ||
       failed(isIntegerArrayAttrSmallerThanShape(op, strides, shape,
@@ -1129,27 +1130,28 @@ static LogicalResult verify(StridedSliceOp op) {
   return success();
 }
 
-void StridedSliceOp::getOffsets(SmallVectorImpl<int64_t> &results) {
+void ExtractStridedSliceOp::getOffsets(SmallVectorImpl<int64_t> &results) {
   populateFromInt64AttrArray(offsets(), results);
 }
 
 namespace {
 
-// Pattern to rewrite a StridedSliceOp(ConstantMaskOp) -> ConstantMaskOp.
+// Pattern to rewrite a ExtractStridedSliceOp(ConstantMaskOp) -> ConstantMaskOp.
 class StridedSliceConstantMaskFolder final
-    : public OpRewritePattern<StridedSliceOp> {
+    : public OpRewritePattern<ExtractStridedSliceOp> {
 public:
-  using OpRewritePattern<StridedSliceOp>::OpRewritePattern;
+  using OpRewritePattern<ExtractStridedSliceOp>::OpRewritePattern;
 
-  LogicalResult matchAndRewrite(StridedSliceOp stridedSliceOp,
+  LogicalResult matchAndRewrite(ExtractStridedSliceOp extractStridedSliceOp,
                                 PatternRewriter &rewriter) const override {
-    // Return if 'stridedSliceOp' operand is not defined by a ConstantMaskOp.
-    auto defOp = stridedSliceOp.vector().getDefiningOp();
+    // Return if 'extractStridedSliceOp' operand is not defined by a
+    // ConstantMaskOp.
+    auto defOp = extractStridedSliceOp.vector().getDefiningOp();
     auto constantMaskOp = dyn_cast_or_null<ConstantMaskOp>(defOp);
     if (!constantMaskOp)
       return failure();
-    // Return if 'stridedSliceOp' has non-unit strides.
-    if (llvm::any_of(stridedSliceOp.strides(), [](Attribute attr) {
+    // Return if 'extractStridedSliceOp' has non-unit strides.
+    if (llvm::any_of(extractStridedSliceOp.strides(), [](Attribute attr) {
           return attr.cast<IntegerAttr>().getInt() != 1;
         }))
       return failure();
@@ -1158,9 +1160,9 @@ class StridedSliceConstantMaskFolder final
     populateFromInt64AttrArray(constantMaskOp.mask_dim_sizes(), maskDimSizes);
     // Gather strided slice offsets and sizes.
     SmallVector<int64_t, 4> sliceOffsets;
-    populateFromInt64AttrArray(stridedSliceOp.offsets(), sliceOffsets);
+    populateFromInt64AttrArray(extractStridedSliceOp.offsets(), sliceOffsets);
     SmallVector<int64_t, 4> sliceSizes;
-    populateFromInt64AttrArray(stridedSliceOp.sizes(), sliceSizes);
+    populateFromInt64AttrArray(extractStridedSliceOp.sizes(), sliceSizes);
 
     // Compute slice of vector mask region.
     SmallVector<int64_t, 4> sliceMaskDimSizes;
@@ -1179,9 +1181,10 @@ class StridedSliceConstantMaskFolder final
     if (llvm::any_of(sliceMaskDimSizes, [](int64_t sz) { return sz == 0; }))
       sliceMaskDimSizes.assign(maskDimSizes.size(), 0);
 
-    // Replace 'stridedSliceOp' with ConstantMaskOp with sliced mask region.
+    // Replace 'extractStridedSliceOp' with ConstantMaskOp with sliced mask
+    // region.
     rewriter.replaceOpWithNewOp<ConstantMaskOp>(
-        stridedSliceOp, stridedSliceOp.getResult().getType(),
+        extractStridedSliceOp, extractStridedSliceOp.getResult().getType(),
         vector::getVectorSubscriptAttr(rewriter, sliceMaskDimSizes));
     return success();
   }
@@ -1189,9 +1192,10 @@ class StridedSliceConstantMaskFolder final
 
 } // end anonymous namespace
 
-void StridedSliceOp::getCanonicalizationPatterns(
+void ExtractStridedSliceOp::getCanonicalizationPatterns(
     OwningRewritePatternList &results, MLIRContext *context) {
-  // Pattern to rewrite a StridedSliceOp(ConstantMaskOp) -> ConstantMaskOp.
+  // Pattern to rewrite a ExtractStridedSliceOp(ConstantMaskOp) ->
+  // ConstantMaskOp.
   results.insert<StridedSliceConstantMaskFolder>(context);
 }
 

diff  --git a/mlir/lib/Dialect/Vector/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/VectorTransforms.cpp
index c0d6ce931d10..bc309f0c89c0 100644
--- a/mlir/lib/Dialect/Vector/VectorTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/VectorTransforms.cpp
@@ -880,7 +880,7 @@ struct TupleGetFolderOp : public OpRewritePattern<vector::TupleGetOp> {
   }
 };
 
-/// Progressive lowering of ExtractSlicesOp to tuple of StridedSliceOp.
+/// Progressive lowering of ExtractSlicesOp to tuple of ExtractStridedSliceOp.
 /// One:
 ///   %x = vector.extract_slices %0
 /// is replaced by:
@@ -916,7 +916,7 @@ class ExtractSlicesOpLowering
           computeElementOffsetsFromVectorSliceOffsets(sizes, vectorOffsets);
       auto sliceSizes = computeSliceSizes(shape, sizes, elementOffsets);
       // Insert in tuple.
-      tupleValues[i] = rewriter.create<vector::StridedSliceOp>(
+      tupleValues[i] = rewriter.create<vector::ExtractStridedSliceOp>(
           loc, op.vector(), elementOffsets, sliceSizes, strides);
     }
 
@@ -1595,7 +1595,7 @@ class ShapeCastOp2DUpCastRewritePattern
     Value desc = rewriter.create<SplatOp>(loc, resultVectorType, zero);
     unsigned mostMinorVectorSize = resultVectorType.getShape()[1];
     for (int64_t i = 0, e = resultVectorType.getShape().front(); i != e; ++i) {
-      Value vec = rewriter.create<vector::StridedSliceOp>(
+      Value vec = rewriter.create<vector::ExtractStridedSliceOp>(
           loc, op.source(), /*offsets=*/i * mostMinorVectorSize,
           /*sizes=*/mostMinorVectorSize,
           /*strides=*/1);

diff  --git a/mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
index bd42b73f4496..9e0b9464689c 100644
--- a/mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
+++ b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
@@ -509,11 +509,11 @@ func @vector_print_vector(%arg0: vector<2x2xf32>) {
 //       CHECK:    llvm.call @print_close() : () -> ()
 //       CHECK:    llvm.call @print_newline() : () -> ()
 
-func @strided_slice1(%arg0: vector<4xf32>) -> vector<2xf32> {
-  %0 = vector.strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4xf32> to vector<2xf32>
+func @extract_strided_slice1(%arg0: vector<4xf32>) -> vector<2xf32> {
+  %0 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4xf32> to vector<2xf32>
   return %0 : vector<2xf32>
 }
-// CHECK-LABEL: llvm.func @strided_slice1
+// CHECK-LABEL: llvm.func @extract_strided_slice1
 //       CHECK:    llvm.mlir.constant(0.000000e+00 : f32) : !llvm.float
 //       CHECK:    llvm.mlir.constant(dense<0.000000e+00> : vector<2xf32>) : !llvm<"<2 x float>">
 //       CHECK:    llvm.mlir.constant(2 : index) : !llvm.i64
@@ -525,11 +525,11 @@ func @strided_slice1(%arg0: vector<4xf32>) -> vector<2xf32> {
 //       CHECK:    llvm.mlir.constant(1 : index) : !llvm.i64
 //       CHECK:    llvm.insertelement %{{.*}}, %{{.*}}[%{{.*}} : !llvm.i64] : !llvm<"<2 x float>">
 
-func @strided_slice2(%arg0: vector<4x8xf32>) -> vector<2x8xf32> {
-  %0 = vector.strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4x8xf32> to vector<2x8xf32>
+func @extract_strided_slice2(%arg0: vector<4x8xf32>) -> vector<2x8xf32> {
+  %0 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4x8xf32> to vector<2x8xf32>
   return %0 : vector<2x8xf32>
 }
-// CHECK-LABEL: llvm.func @strided_slice2
+// CHECK-LABEL: llvm.func @extract_strided_slice2
 //       CHECK:    llvm.mlir.constant(0.000000e+00 : f32) : !llvm.float
 //       CHECK:    llvm.mlir.constant(dense<0.000000e+00> : vector<2x8xf32>) : !llvm<"[2 x <8 x float>]">
 //       CHECK:    llvm.extractvalue %{{.*}}[2] : !llvm<"[4 x <8 x float>]">
@@ -537,11 +537,11 @@ func @strided_slice2(%arg0: vector<4x8xf32>) -> vector<2x8xf32> {
 //       CHECK:    llvm.extractvalue %{{.*}}[3] : !llvm<"[4 x <8 x float>]">
 //       CHECK:    llvm.insertvalue %{{.*}}, %{{.*}}[1] : !llvm<"[2 x <8 x float>]">
 
-func @strided_slice3(%arg0: vector<4x8xf32>) -> vector<2x2xf32> {
-  %0 = vector.strided_slice %arg0 {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x8xf32> to vector<2x2xf32>
+func @extract_strided_slice3(%arg0: vector<4x8xf32>) -> vector<2x2xf32> {
+  %0 = vector.extract_strided_slice %arg0 {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x8xf32> to vector<2x2xf32>
   return %0 : vector<2x2xf32>
 }
-// CHECK-LABEL: llvm.func @strided_slice3
+// CHECK-LABEL: llvm.func @extract_strided_slice3
 //       CHECK:    llvm.mlir.constant(0.000000e+00 : f32) : !llvm.float
 //       CHECK:    llvm.mlir.constant(dense<0.000000e+00> : vector<2x2xf32>) : !llvm<"[2 x <2 x float>]">
 //

diff  --git a/mlir/test/Dialect/Vector/canonicalize.mlir b/mlir/test/Dialect/Vector/canonicalize.mlir
index 61163a704d64..db504bf66ca0 100644
--- a/mlir/test/Dialect/Vector/canonicalize.mlir
+++ b/mlir/test/Dialect/Vector/canonicalize.mlir
@@ -13,9 +13,9 @@ func @create_vector_mask_to_constant_mask() -> (vector<4x3xi1>) {
 
 // -----
 
-func @strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
+func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
   %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
-  %1 = vector.strided_slice %0
+  %1 = vector.extract_strided_slice %0
     {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]}
       : vector<4x3xi1> to vector<2x2xi1>
   // CHECK: vector.constant_mask [2, 2] : vector<2x2xi1>
@@ -24,9 +24,9 @@ func @strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
 
 // -----
 
-func @strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
+func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
   %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
-  %1 = vector.strided_slice %0
+  %1 = vector.extract_strided_slice %0
     {offsets = [1, 0], sizes = [2, 2], strides = [1, 1]}
       : vector<4x3xi1> to vector<2x2xi1>
   // CHECK: vector.constant_mask [1, 2] : vector<2x2xi1>
@@ -35,9 +35,9 @@ func @strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
 
 // -----
 
-func @strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
+func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
   %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
-  %1 = vector.strided_slice %0
+  %1 = vector.extract_strided_slice %0
     {offsets = [0, 1], sizes = [2, 2], strides = [1, 1]}
       : vector<4x3xi1> to vector<2x2xi1>
   // CHECK: vector.constant_mask [2, 1] : vector<2x2xi1>
@@ -46,9 +46,9 @@ func @strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
 
 // -----
 
-func @strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
+func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
   %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
-  %1 = vector.strided_slice %0
+  %1 = vector.extract_strided_slice %0
     {offsets = [2, 0], sizes = [2, 2], strides = [1, 1]}
       : vector<4x3xi1> to vector<2x2xi1>
   // CHECK: vector.constant_mask [0, 0] : vector<2x2xi1>
@@ -57,9 +57,9 @@ func @strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
 
 // -----
 
-func @strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
+func @extract_strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
   %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
-  %1 = vector.strided_slice %0
+  %1 = vector.extract_strided_slice %0
     {offsets = [0, 2], sizes = [2, 1], strides = [1, 1]}
       : vector<4x3xi1> to vector<2x1xi1>
   // CHECK: vector.constant_mask [0, 0] : vector<2x1xi1>
@@ -68,9 +68,9 @@ func @strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
 
 // -----
 
-func @strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
+func @extract_strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
   %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
-  %1 = vector.strided_slice %0
+  %1 = vector.extract_strided_slice %0
     {offsets = [0, 1], sizes = [2, 1], strides = [1, 1]}
       : vector<4x3xi1> to vector<2x1xi1>
   // CHECK: vector.constant_mask [2, 1] : vector<2x1xi1>
@@ -79,9 +79,9 @@ func @strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
 
 // -----
 
-func @strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
+func @extract_strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
   %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
-  %1 = vector.strided_slice %0
+  %1 = vector.extract_strided_slice %0
     {offsets = [1, 1], sizes = [2, 1], strides = [1, 1]}
       : vector<4x3xi1> to vector<2x1xi1>
   // CHECK: vector.constant_mask [1, 1] : vector<2x1xi1>

diff  --git a/mlir/test/Dialect/Vector/invalid.mlir b/mlir/test/Dialect/Vector/invalid.mlir
index bb5eca0a361b..ab50c566f9b3 100644
--- a/mlir/test/Dialect/Vector/invalid.mlir
+++ b/mlir/test/Dialect/Vector/invalid.mlir
@@ -451,65 +451,65 @@ func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {
 
 // -----
 
-func @strided_slice(%arg0: vector<4x8x16xf32>) {
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
   // expected-error at +1 {{expected offsets, sizes and strides attributes of same size}}
-  %1 = vector.strided_slice %arg0 {offsets = [100], sizes = [2, 2], strides = [1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [100], sizes = [2, 2], strides = [1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>
 }
 
 // -----
 
-func @strided_slice(%arg0: vector<4x8x16xf32>) {
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
   // expected-error at +1 {{expected offsets attribute of rank smaller than vector rank}}
-  %1 = vector.strided_slice %arg0 {offsets = [2, 2, 2, 2], sizes = [2, 2, 2, 2], strides = [1, 1, 1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [2, 2, 2, 2], sizes = [2, 2, 2, 2], strides = [1, 1, 1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>
 }
 
 // -----
 
-func @strided_slice(%arg0: vector<4x8x16xf32>) {
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
   // expected-error at +1 {{expected offsets attribute of rank smaller than vector rank}}
-  %1 = vector.strided_slice %arg0 {offsets = [2, 2, 2, 2], sizes = [2, 2, 2, 2], strides = [1, 1, 1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [2, 2, 2, 2], sizes = [2, 2, 2, 2], strides = [1, 1, 1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>
 }
 
 // -----
 
-func @strided_slice(%arg0: vector<4x8x16xf32>) {
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
   // expected-error at +1 {{op expected offsets dimension 0 to be confined to [0, 4)}}
-  %1 = vector.strided_slice %arg0 {offsets = [100], sizes = [100], strides = [100]} : vector<4x8x16xf32> to vector<100x8x16xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [100], sizes = [100], strides = [100]} : vector<4x8x16xf32> to vector<100x8x16xf32>
 }
 
 // -----
 
-func @strided_slice(%arg0: vector<4x8x16xf32>) {
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
   // expected-error at +1 {{op expected sizes dimension 0 to be confined to [1, 5)}}
-  %1 = vector.strided_slice %arg0 {offsets = [2], sizes = [100], strides = [100]} : vector<4x8x16xf32> to vector<100x8x16xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [100], strides = [100]} : vector<4x8x16xf32> to vector<100x8x16xf32>
 }
 
 // -----
 
-func @strided_slice(%arg0: vector<4x8x16xf32>) {
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
   // expected-error at +1 {{op expected strides to be confined to [1, 2)}}
-  %1 = vector.strided_slice %arg0 {offsets = [2], sizes = [1], strides = [100]} : vector<4x8x16xf32> to vector<1x8x16xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [1], strides = [100]} : vector<4x8x16xf32> to vector<1x8x16xf32>
 }
 
 // -----
 
-func @strided_slice(%arg0: vector<4x8x16xf32>) {
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
   // expected-error at +1 {{op expected strides to be confined to [1, 2)}}
-  %1 = vector.strided_slice %arg0 {offsets = [2], sizes = [1], strides = [100]} : vector<4x8x16xf32> to vector<1x8x16xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [1], strides = [100]} : vector<4x8x16xf32> to vector<1x8x16xf32>
 }
 
 // -----
 
-func @strided_slice(%arg0: vector<4x8x16xf32>) {
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
   // expected-error at +1 {{op expected sum(offsets, sizes) dimension 0 to be confined to [1, 5)}}
-  %1 = vector.strided_slice %arg0 {offsets = [2], sizes = [3], strides = [1]} : vector<4x8x16xf32> to vector<3x8x16xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [3], strides = [1]} : vector<4x8x16xf32> to vector<3x8x16xf32>
 }
 
 // -----
 
-func @strided_slice(%arg0: vector<4x8x16xf32>) {
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
   // expected-error at +1 {{op expected result type to be 'vector<2x8x16xf32>'}}
-  %1 = vector.strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4x8x16xf32> to vector<3x1xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4x8x16xf32> to vector<3x1xf32>
 }
 
 // -----

diff  --git a/mlir/test/Dialect/Vector/ops.mlir b/mlir/test/Dialect/Vector/ops.mlir
index a3b3fcc9c23c..73690d6ebcc8 100644
--- a/mlir/test/Dialect/Vector/ops.mlir
+++ b/mlir/test/Dialect/Vector/ops.mlir
@@ -120,10 +120,10 @@ func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) {
   return
 }
 
-// CHECK-LABEL: @strided_slice
-func @strided_slice(%arg0: vector<4x8x16xf32>) -> vector<2x2x16xf32> {
-  // CHECK: vector.strided_slice %{{.*}} {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x8x16xf32>
-  %1 = vector.strided_slice %arg0 {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>
+// CHECK-LABEL: @extract_strided_slice
+func @extract_strided_slice(%arg0: vector<4x8x16xf32>) -> vector<2x2x16xf32> {
+  // CHECK: vector.extract_strided_slice %{{.*}} {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x8x16xf32>
+  %1 = vector.extract_strided_slice %arg0 {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32>
   return %1: vector<2x2x16xf32>
 }
 

diff  --git a/mlir/test/Dialect/Vector/vector-contract-transforms.mlir b/mlir/test/Dialect/Vector/vector-contract-transforms.mlir
index 8354677b797c..563c9f76d9b2 100644
--- a/mlir/test/Dialect/Vector/vector-contract-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-contract-transforms.mlir
@@ -338,14 +338,14 @@ func @shape_casts(%a: vector<2x2xf32>) -> (vector<4xf32>, vector<2x2xf32>) {
   // CHECK: %[[add:.*]] = addf %[[in2]], %[[in2]] : vector<4xf32>
   %r0 = addf %0, %0: vector<4xf32>
   //
-  // CHECK: %[[ss0:.*]] = vector.strided_slice %[[add]]
+  // CHECK: %[[ss0:.*]] = vector.extract_strided_slice %[[add]]
   // CHECK-SAME: {offsets = [0], sizes = [2], strides = [1]} :
   // CHECK-SAME: vector<4xf32> to vector<2xf32>
   //
   // CHECK: %[[res0:.*]] = vector.insert %[[ss0]], %[[cst22]] [0] :
   // CHECK-SAME: vector<2xf32> into vector<2x2xf32>
   //
-  // CHECK: %[[s2:.*]] = vector.strided_slice %[[add]]
+  // CHECK: %[[s2:.*]] = vector.extract_strided_slice %[[add]]
   // CHECK-SAME: {offsets = [2], sizes = [2], strides = [1]} :
   // CHECK-SAME: vector<4xf32> to vector<2xf32>
   //
@@ -377,9 +377,9 @@ func @shape_casts(%a: vector<2x2xf32>) -> (vector<4xf32>, vector<2x2xf32>) {
 //      MATRIX:  %[[b6:.*]] = vector.extract %[[B]][3] : vector<4x3xf32>
 //      MATRIX:  %[[b7:.*]] = vector.insert_strided_slice %[[b6]], %[[b5]] {offsets = [9], strides = [1]} : vector<3xf32> into vector<12xf32>
 //      MATRIX:  %[[mm1:.*]] = vector.matrix_multiply %[[a3]], %[[b7]] {lhs_columns = 4 : i32, lhs_rows = 2 : i32, rhs_columns = 3 : i32} : (vector<8xf32>, vector<12xf32>) -> vector<6xf32>
-//      MATRIX:  %[[mm2:.*]] = vector.strided_slice %[[mm1]] {offsets = [0], sizes = [3], strides = [1]} : vector<6xf32> to vector<3xf32>
+//      MATRIX:  %[[mm2:.*]] = vector.extract_strided_slice %[[mm1]] {offsets = [0], sizes = [3], strides = [1]} : vector<6xf32> to vector<3xf32>
 //      MATRIX:  %[[mm3:.*]] = vector.insert %[[mm2]], %[[vcst_1]] [0] : vector<3xf32> into vector<2x3xf32>
-//      MATRIX:  %[[mm4:.*]] = vector.strided_slice %[[mm1]] {offsets = [3], sizes = [3], strides = [1]} : vector<6xf32> to vector<3xf32>
+//      MATRIX:  %[[mm4:.*]] = vector.extract_strided_slice %[[mm1]] {offsets = [3], sizes = [3], strides = [1]} : vector<6xf32> to vector<3xf32>
 //      MATRIX:  %[[mm5:.*]] = vector.insert %[[mm4]], %[[mm3]] [1] : vector<3xf32> into vector<2x3xf32>
 //      MATRIX:  %[[mm6:.*]] = addf %[[C]], %[[mm5]] : vector<2x3xf32>
 func @matmul(%arg0: vector<2x4xf32>,

diff  --git a/mlir/test/Dialect/Vector/vector-slices-transforms.mlir b/mlir/test/Dialect/Vector/vector-slices-transforms.mlir
index 893686530a13..d00356f5f503 100644
--- a/mlir/test/Dialect/Vector/vector-slices-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-slices-transforms.mlir
@@ -1,7 +1,7 @@
 // RUN: mlir-opt %s -test-vector-slices-conversion | FileCheck %s
 
 // CHECK-LABEL: func @extract_slices(%arg0: vector<3x3xf32>)
-//       CHECK: %[[SS:.*]] = vector.strided_slice %arg0 {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]}
+//       CHECK: %[[SS:.*]] = vector.extract_strided_slice %arg0 {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]}
 //       CHECK: return %[[SS]]
 
 func @extract_slices(%arg0: vector<3x3xf32>) -> vector<2x2xf32> {
@@ -32,10 +32,10 @@ func @insert_slices(%arg0: vector<2x2xf32>,
 
 // CHECK-LABEL: func @extract_insert_slices(%arg0: vector<3x3xf32>)
 //       CHECK: %[[C:.*]] = constant dense<0.000000e+00> : vector<3x3xf32>
-//       CHECK: %[[X0:.*]] = vector.strided_slice %arg0 {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]}
-//       CHECK: %[[X1:.*]] = vector.strided_slice %arg0 {offsets = [0, 2], sizes = [2, 1], strides = [1, 1]}
-//       CHECK: %[[X2:.*]] = vector.strided_slice %arg0 {offsets = [2, 0], sizes = [1, 2], strides = [1, 1]}
-//       CHECK: %[[X3:.*]] = vector.strided_slice %arg0 {offsets = [2, 2], sizes = [1, 1], strides = [1, 1]}
+//       CHECK: %[[X0:.*]] = vector.extract_strided_slice %arg0 {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]}
+//       CHECK: %[[X1:.*]] = vector.extract_strided_slice %arg0 {offsets = [0, 2], sizes = [2, 1], strides = [1, 1]}
+//       CHECK: %[[X2:.*]] = vector.extract_strided_slice %arg0 {offsets = [2, 0], sizes = [1, 2], strides = [1, 1]}
+//       CHECK: %[[X3:.*]] = vector.extract_strided_slice %arg0 {offsets = [2, 2], sizes = [1, 1], strides = [1, 1]}
 //       CHECK: %[[X4:.*]] = vector.insert_strided_slice %[[X0]], %[[C0]] {offsets = [0, 0], strides = [1, 1]}
 //       CHECK: %[[X5:.*]] = vector.insert_strided_slice %[[X1]], %[[X4]] {offsets = [0, 2], strides = [1, 1]}
 //       CHECK: %[[X6:.*]] = vector.insert_strided_slice %[[X2]], %[[X5]] {offsets = [2, 0], strides = [1, 1]}
@@ -51,8 +51,8 @@ func @extract_insert_slices(%arg0: vector<3x3xf32>) -> vector<3x3xf32> {
 }
 
 // CHECK-LABEL: func @extract_slices_tuple_leaks(%arg0: vector<4xf32>)
-//       CHECK: %[[X0:.*]] = vector.strided_slice %arg0 {offsets = [0], sizes = [2], strides = [1]}
-//       CHECK: %[[X1:.*]] = vector.strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]}
+//       CHECK: %[[X0:.*]] = vector.extract_strided_slice %arg0 {offsets = [0], sizes = [2], strides = [1]}
+//       CHECK: %[[X1:.*]] = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]}
 //       CHECK: %[[X2:.*]] = vector.tuple %[[X0]], %[[X1]]
 //       CHECK: return %[[X2]]
 


        


More information about the Mlir-commits mailing list