Skip to content

Commit 2fe9dd3

Browse files
Jerry-GeTai78641lhutton1
committed
[mlir][tosa] Add additional input output dtype verifiers for the following operators
- CastOp - ConcatOp - MatMulOp - PadOp - SliceOp - TileOp - ReshapeOp - TransposeOp - GatherOp - ScatterOp - MaxPool2dOp - ReverseOp - SelectOp For ConcatOp specifically, this commit also enhances the verifier by checking 4 another conditions: - The input list is not empty - The axis value is within range of the input shapes - All inputs have the same rank - All non concatenate axis dims have the same value Change-Id: I1e8a1017f21f617443bc40bae42189915048c750 Co-authored-by: Tai Ly <[email protected]> Co-authored-by: Luke Hutton <[email protected]> Signed-off-by: Jerry Ge <[email protected]>
1 parent fb25216 commit 2fe9dd3

File tree

3 files changed

+373
-13
lines changed

3 files changed

+373
-13
lines changed

mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ def Tosa_MatMulOp : Tosa_InferShapedTypeOp<"matmul"> {
282282
];
283283

284284
let builders = [Tosa_MatMulOpQuantInfoBuilder];
285+
let hasVerifier = 1;
285286
}
286287

287288
//===----------------------------------------------------------------------===//
@@ -316,6 +317,7 @@ def Tosa_MaxPool2dOp : Tosa_InferShapedTypeOp<"max_pool2d"> {
316317
];
317318

318319
let hasCanonicalizer = 1;
320+
let hasVerifier = 1;
319321
}
320322

321323
//===----------------------------------------------------------------------===//
@@ -1421,6 +1423,7 @@ def Tosa_SelectOp : Tosa_ElementwiseOp<"select"> {
14211423

14221424
let hasCanonicalizeMethod = 1;
14231425
let hasFolder = 1;
1426+
let hasVerifier = 1;
14241427

14251428
let assemblyFormat = [{
14261429
operands attr-dict `:` `(` type($input1) `,` type($input2) `,` type($input3)
@@ -1796,6 +1799,7 @@ def Tosa_ConcatOp : Tosa_InferTensorTypeOp<"concat"> {
17961799

17971800
let hasCanonicalizer = 1;
17981801
let hasFolder = 1;
1802+
let hasVerifier = 1;
17991803

18001804
let extraClassDeclaration = [{
18011805
/// Returns true when two result types are compatible for this op;
@@ -2052,6 +2056,8 @@ def Tosa_GatherOp : Tosa_InferShapedTypeOp<"gather"> {
20522056
Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
20532057
Extension<[Tosa_EXT_FP8E4M3, Tosa_EXT_FP8E5M2, Tosa_EXT_BF16]>,
20542058
];
2059+
2060+
let hasVerifier = 1;
20552061
}
20562062

20572063
//===----------------------------------------------------------------------===//
@@ -2079,6 +2085,8 @@ def Tosa_ScatterOp : Tosa_InferShapedTypeOp<"scatter"> {
20792085
Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
20802086
Extension<[Tosa_EXT_FP8E4M3, Tosa_EXT_FP8E5M2, Tosa_EXT_BF16]>,
20812087
];
2088+
2089+
let hasVerifier = 1;
20822090
}
20832091

20842092
//===----------------------------------------------------------------------===//
@@ -2175,6 +2183,7 @@ def Tosa_CastOp: Tosa_Op<"cast", [Pure,
21752183
let assemblyFormat = "operands attr-dict `:` functional-type(operands, results)";
21762184

21772185
let hasFolder = 1;
2186+
let hasVerifier = 1;
21782187
}
21792188

21802189
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)