Skip to content

Commit

Permalink
[mlir] Add SingleBlockImplicitTerminator<"tensor::YieldOp"> to PadOp.
Browse files Browse the repository at this point in the history
  • Loading branch information
pifon2a committed Jan 22, 2022
1 parent 26544b9 commit 4041354
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
5 changes: 3 additions & 2 deletions mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions mlir/test/Dialect/Tensor/invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down

0 comments on commit 4041354

Please sign in to comment.