[Mlir-commits] [mlir] 4041354 - [mlir] Add SingleBlockImplicitTerminator<"tensor::YieldOp"> to PadOp.

Alexander Belyaev llvmlistbot at llvm.org
Sat Jan 22 02:47:19 PST 2022


Author: Alexander Belyaev
Date: 2022-01-22T11:46:27+01:00
New Revision: 4041354b4c12fb4329853b67f61b8617252188d6

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

LOG: [mlir] Add SingleBlockImplicitTerminator<"tensor::YieldOp"> to PadOp.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
    mlir/test/Dialect/Tensor/invalid.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
index 05cb41d791d35..882ea33b9c03b 100644
--- a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
+++ b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
@@ -782,13 +782,14 @@ def Tensor_CollapseShapeOp : Tensor_ReassociativeReshapeOp<"collapse_shape"> {
 // PadOp
 //===----------------------------------------------------------------------===//
 
-def Tensor_PadOp : Tensor_Op<"pad", [AttrSizedOperandSegments, NoSideEffect]> {
+def Tensor_PadOp : Tensor_Op<"pad", [AttrSizedOperandSegments, NoSideEffect,
+    SingleBlockImplicitTerminator<"mlir::tensor::YieldOp">]> {
   let summary = "tensor pad operation";
   let description = [{
     `tensor.pad` is an operation that pads the `source` tensor
     with given `low` and `high` padding config.
 
-    The PadTensor operation supports the following arguments:
+    The PadOp operation supports the following arguments:
 
     * source: the "base" tensor on which to pad.
     * low: A list contains the padding along the start of each

diff  --git a/mlir/test/Dialect/Tensor/invalid.mlir b/mlir/test/Dialect/Tensor/invalid.mlir
index cec4718595a45..7dbf662fd6fe3 100644
--- a/mlir/test/Dialect/Tensor/invalid.mlir
+++ b/mlir/test/Dialect/Tensor/invalid.mlir
@@ -343,15 +343,6 @@ func @pad_number_of_block_args(%arg0: tensor<?x4xi32>, %arg1: i32) -> tensor<?x9
 
 // -----
 
-func @pad_no_block(%arg0: tensor<?x4xi32>, %arg1: i32) -> tensor<?x9xi32> {
-  // expected-error @+1 {{op region #0 ('region') failed to verify constraint: region with 1 blocks}}
-  %0 = tensor.pad %arg0 low[1, 2] high[2, 3] {
-  } : tensor<?x4xi32> to tensor<?x9xi32>
-  return %0 : tensor<?x9xi32>
-}
-
-// -----
-
 func @pad_block_args(%arg0: tensor<?x4xi32>, %arg1: i32) -> tensor<?x9xi32> {
   // expected-error @+1 {{op expected block argument 1 to be an index}}
   %0 = tensor.pad %arg0 low[1, 2] high[2, 3] {


        


More information about the Mlir-commits mailing list