Skip to content

Commit d0d4caa

Browse files
CoTinkervinay-deshmukh
authored andcommitted
[mlir][linalg] Remove redundant implicit terminator trait(NFC) (llvm#166298)
This PR removes duplicated `SingleBlockImplicitTerminator<"YieldOp">` since `LinalgStructuredBase_Op` already defines it. and clean up formatting for other OpDefs.
1 parent f34ea66 commit d0d4caa

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@ def TensorOrMemref :
235235

236236
def MapOp : LinalgStructuredBase_Op<"map", [
237237
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>,
238-
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmBlockArgumentNames"]>,
239-
SingleBlockImplicitTerminator<"YieldOp">]> {
238+
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmBlockArgumentNames"]>]> {
240239
let summary = "Elementwise operations";
241240
let description = [{
242241
Models elementwise operations on tensors in terms of arithmetic operations
@@ -318,8 +317,7 @@ def MapOp : LinalgStructuredBase_Op<"map", [
318317
def ReduceOp : LinalgStructuredBase_Op<"reduce", [
319318
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>,
320319
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmBlockArgumentNames"]>,
321-
SameVariadicOperandSize,
322-
SingleBlockImplicitTerminator<"YieldOp">]> {
320+
SameVariadicOperandSize]> {
323321
let summary = "Reduce operator";
324322
let description = [{
325323
Executes `combiner` on the `dimensions` of `inputs` and returns the
@@ -400,8 +398,7 @@ def ReduceOp : LinalgStructuredBase_Op<"reduce", [
400398
//===----------------------------------------------------------------------===//
401399

402400
def TransposeOp : LinalgStructuredBase_Op<"transpose", [
403-
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>,
404-
SingleBlockImplicitTerminator<"YieldOp">]> {
401+
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>]> {
405402
let summary = "Transpose operator";
406403
let description = [{
407404
Permutes the dimensions of `input` according to the given `permutation`.
@@ -477,8 +474,7 @@ def TransposeOp : LinalgStructuredBase_Op<"transpose", [
477474
//===----------------------------------------------------------------------===//
478475

479476
def BroadcastOp : LinalgStructuredBase_Op<"broadcast", [
480-
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>,
481-
SingleBlockImplicitTerminator<"YieldOp">]> {
477+
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>]> {
482478
let summary = "Static broadcast operator";
483479
let description = [{
484480
Broadcast the input into the given shape by adding `dimensions`.
@@ -547,8 +543,9 @@ def BroadcastOp : LinalgStructuredBase_Op<"broadcast", [
547543
//===----------------------------------------------------------------------===//
548544
// Op definition for ElementwiseOp
549545
//===----------------------------------------------------------------------===//
546+
550547
def ElementwiseOp : LinalgStructuredBase_Op<"elementwise", [
551-
AttrSizedOperandSegments]> {
548+
AttrSizedOperandSegments]> {
552549
let summary = [{ Performs element-wise operation }];
553550
let description = [{
554551
The attribute `kind` describes arithmetic operation to perform. The
@@ -684,7 +681,6 @@ def ElementwiseOp : LinalgStructuredBase_Op<"elementwise", [
684681
def MatmulOp : LinalgStructuredBase_Op<"matmul", [
685682
AttrSizedOperandSegments,
686683
LinalgContractionOpInterface]> {
687-
688684
let summary = [{
689685
Performs a matrix multiplication of two 2D inputs without broadcast or transpose.
690686
}];
@@ -816,8 +812,8 @@ def MatmulOp : LinalgStructuredBase_Op<"matmul", [
816812
//===----------------------------------------------------------------------===//
817813

818814
def ContractOp : LinalgStructuredBase_Op<"contract", [
819-
AttrSizedOperandSegments,
820-
LinalgContractionOpInterface]> {
815+
AttrSizedOperandSegments,
816+
LinalgContractionOpInterface]> {
821817
let summary = [{
822818
Perform a contraction on two inputs, accumulating into the third.
823819
}];
@@ -954,9 +950,9 @@ def ContractOp : LinalgStructuredBase_Op<"contract", [
954950
// Op definition for BatchMatmulOp
955951
//===----------------------------------------------------------------------===//
956952

957-
def BatchMatmulOp : LinalgStructuredBase_Op<"batch_matmul", !listconcat([AttrSizedOperandSegments],
958-
/*extraInterfaces=*/[LinalgContractionOpInterface])> {
959-
953+
def BatchMatmulOp : LinalgStructuredBase_Op<"batch_matmul", [
954+
AttrSizedOperandSegments,
955+
LinalgContractionOpInterface]> {
960956
let summary = [{Performs a batched matrix multiplication of two 3D inputs.}];
961957
let description = [{Numeric casting is performed on the operands to the inner multiply, promoting
962958
them to the same data type as the accumulator/output.
@@ -1087,7 +1083,6 @@ def BatchMatmulOp : LinalgStructuredBase_Op<"batch_matmul", !listconcat([AttrSiz
10871083
def BatchReduceMatmulOp : LinalgStructuredBase_Op<"batch_reduce_matmul", [
10881084
AttrSizedOperandSegments,
10891085
LinalgContractionOpInterface]> {
1090-
10911086
let summary = [{Performs a batch-reduce matrix multiplication on two inputs.
10921087
The partial multiplication results are reduced into a 2D output.}];
10931088
let description = [{

0 commit comments

Comments
 (0)