Skip to content

Commit 4041354

Browse files
committed
[mlir] Add SingleBlockImplicitTerminator<"tensor::YieldOp"> to PadOp.
1 parent 26544b9 commit 4041354

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,13 +782,14 @@ def Tensor_CollapseShapeOp : Tensor_ReassociativeReshapeOp<"collapse_shape"> {
782782
// PadOp
783783
//===----------------------------------------------------------------------===//
784784

785-
def Tensor_PadOp : Tensor_Op<"pad", [AttrSizedOperandSegments, NoSideEffect]> {
785+
def Tensor_PadOp : Tensor_Op<"pad", [AttrSizedOperandSegments, NoSideEffect,
786+
SingleBlockImplicitTerminator<"mlir::tensor::YieldOp">]> {
786787
let summary = "tensor pad operation";
787788
let description = [{
788789
`tensor.pad` is an operation that pads the `source` tensor
789790
with given `low` and `high` padding config.
790791

791-
The PadTensor operation supports the following arguments:
792+
The PadOp operation supports the following arguments:
792793

793794
* source: the "base" tensor on which to pad.
794795
* low: A list contains the padding along the start of each

mlir/test/Dialect/Tensor/invalid.mlir

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,6 @@ func @pad_number_of_block_args(%arg0: tensor<?x4xi32>, %arg1: i32) -> tensor<?x9
343343

344344
// -----
345345

346-
func @pad_no_block(%arg0: tensor<?x4xi32>, %arg1: i32) -> tensor<?x9xi32> {
347-
// expected-error @+1 {{op region #0 ('region') failed to verify constraint: region with 1 blocks}}
348-
%0 = tensor.pad %arg0 low[1, 2] high[2, 3] {
349-
} : tensor<?x4xi32> to tensor<?x9xi32>
350-
return %0 : tensor<?x9xi32>
351-
}
352-
353-
// -----
354-
355346
func @pad_block_args(%arg0: tensor<?x4xi32>, %arg1: i32) -> tensor<?x9xi32> {
356347
// expected-error @+1 {{op expected block argument 1 to be an index}}
357348
%0 = tensor.pad %arg0 low[1, 2] high[2, 3] {

0 commit comments

Comments
 (0)