blob: 0329dd29cfa801b5aaa9fad3038f8954803cf2ad [file] [log] [blame]
Eric Kunze2364dcd2021-04-26 11:06:57 -07001
2// Copyright (c) 2020-2021, ARM Limited.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16/*
17 Syntax:
18 DEF_OPERATOR(MLIR_NAME, SCHEMA_NAME, REF_IMPL_NAME, OPTIONS, QUANT_INFO)
19
20 Description:
21 MLIR_NAME: the symbolic string of this op, must match tosa_ops.td
22 SCHEMA_NAME: corresponding operator name, must match "enum Op" in serialization/tosa.fbs
23 REF_IMPL_NAME: name used internally in tosa reference implementation
24 OPTIONS: compile time constant options of this op, corresponding to operator_option.def
25 QUANT_INFO: quantization infomation of this op, corresponding to quant_info.def
26*/
27
28
29/* tensor operators */
30DEF_OPERATOR(argmax, ARGMAX, ArgMax, Axis, None)
31DEF_OPERATOR(avg_pool2d, AVG_POOL2D, AvgPool2d, Pool2d, Unary)
32DEF_OPERATOR(conv2d, CONV2D, Conv2d, Conv2d, Conv)
33DEF_OPERATOR(conv3d, CONV3D, Conv3d, None, None)
34DEF_OPERATOR(depthwise_conv2d, DEPTHWISE_CONV2D, DepthwiseConv2d, Conv2d, Conv)
35DEF_OPERATOR(fully_connected, FULLY_CONNECTED, FullyConnected, None, Conv)
36DEF_OPERATOR(matmul, MATMUL, MatMul, None, MatMul)
37DEF_OPERATOR(max_pool2d, MAX_POOL2D, MaxPool2d, Pool2d, None)
38DEF_OPERATOR(transpose_conv2d, TRANSPOSE_CONV2D, TransposeConv2d, TransposeConv2d, Conv)
39
40/* activation */
41DEF_OPERATOR(clamp, CLAMP, Clamp, Clamp, None)
42DEF_OPERATOR(reluN, RELUN, ReluN, ReluN, None)
43DEF_OPERATOR(sigmoid, SIGMOID, Sigmoid, None, None)
44DEF_OPERATOR(tanh, TANH, Tanh, None, None)
45
46/* elementwise - binary */
47DEF_OPERATOR(add, ADD, Add, None, None)
48DEF_OPERATOR(arithmetic_right_shift, ARITHMETIC_RIGHT_SHIFT, ArithmeticRightShift, ArithmeticRightShift, None)
49DEF_OPERATOR(bitwise_and, BITWISE_AND, BitwiseAnd, None, None)
50DEF_OPERATOR(bitwise_or, BITWISE_OR, BitwiseOr, None, None)
51DEF_OPERATOR(bitwise_xor, BITWISE_XOR, BitwiseXor, None, None)
Kevin Chenga8b4eaf2021-05-10 13:14:00 -070052DEF_OPERATOR(div, DIV, Div, None, None)
Eric Kunze2364dcd2021-04-26 11:06:57 -070053DEF_OPERATOR(logical_and, LOGICAL_AND, LogicalAnd, None, None)
54DEF_OPERATOR(logical_left_shift, LOGICAL_LEFT_SHIFT, LogicalLeftShift, None, None)
55DEF_OPERATOR(logical_right_shift, LOGICAL_RIGHT_SHIFT, LogicalRightShift, None, None)
56DEF_OPERATOR(logical_or, LOGICAL_OR, LogicalOr, None, None)
57DEF_OPERATOR(logical_xor, LOGICAL_XOR, LogicalXor, None, None)
58DEF_OPERATOR(maximum, MAXIMUM, Maximum, None, None)
59DEF_OPERATOR(minimum, MINIMUM, Minimum, None, None)
60DEF_OPERATOR(mul, MUL, Mul, Mul, None)
61DEF_OPERATOR(pow, POW, Pow, None, None)
62DEF_OPERATOR(sub, SUB, Sub, None, None)
63DEF_OPERATOR(table, TABLE, Table, None, None)
64
65/* elementwise - unary */
66DEF_OPERATOR(abs, ABS, Abs, None, None)
67DEF_OPERATOR(bitwise_not, BITWISE_NOT, BitwiseNot, None, None)
68DEF_OPERATOR(ceil, CEIL, Ceil, None, None)
69DEF_OPERATOR(clz, CLZ, Clz, None, None)
70DEF_OPERATOR(exp, EXP, Exp, None, None)
71DEF_OPERATOR(floor, FLOOR, Floor, None, None)
72DEF_OPERATOR(log, LOG, Log, None, None)
73DEF_OPERATOR(logical_not, LOGICAL_NOT, LogicalNot, None, None)
74DEF_OPERATOR(negate, NEGATE, Negate, None, Unary)
75DEF_OPERATOR(reciprocal, RECIPROCAL, Reciprocal, None, None)
76DEF_OPERATOR(rsqrt, RSQRT, Rsqrt, None, None)
77
78/* elementwise - ternary */
79DEF_OPERATOR(select, SELECT, Select, None, None)
80
81/* logical */
82DEF_OPERATOR(equal, EQUAL, Equal, None, None)
83DEF_OPERATOR(greater, GREATER, Greater, None, None)
84DEF_OPERATOR(greater_equal, GREATER_EQUAL, GreaterEqual, None, None)
85
86/* reduction */
87DEF_OPERATOR(reduce_any, REDUCE_ANY, ReduceAny, Reduce, None)
88DEF_OPERATOR(reduce_all, REDUCE_ALL, ReduceAll, Reduce, None)
89DEF_OPERATOR(reduce_max, REDUCE_MAX, ReduceMax, Reduce, None)
90DEF_OPERATOR(reduce_min, REDUCE_MIN, ReduceMin, Reduce, None)
91DEF_OPERATOR(reduce_prod, REDUCE_PRODUCT, ReduceProduct, Reduce, None)
92DEF_OPERATOR(reduce_sum, REDUCE_SUM, ReduceSum, Reduce, None)
93
94/* memory operation */
95DEF_OPERATOR(concat, CONCAT, Concat, Axis, None)
96DEF_OPERATOR(pad, PAD, Pad, None, Pad)
97DEF_OPERATOR(reshape, RESHAPE, Reshape, Reshape, None)
98DEF_OPERATOR(reverse, REVERSE, Reverse, Reverse, None)
99DEF_OPERATOR(slice, SLICE, Slice, Slice, None)
100DEF_OPERATOR(tile, TILE, Tile, Tile, None)
101DEF_OPERATOR(transpose, TRANSPOSE, Transpose, None, None)
102
103/* gather/scatter */
104DEF_OPERATOR(gather, GATHER, Gather, None, None)
105DEF_OPERATOR(scatter, SCATTER, Scatter, None, None)
106
107/* image */
108DEF_OPERATOR(resize, RESIZE, Resize, Resize, None)
109
110/* quantization */
111DEF_OPERATOR(cast, CAST, Cast, None, None)
112DEF_OPERATOR(rescale, RESCALE, Rescale, Rescale, None)
113
114/* data nodes */
115DEF_OPERATOR(const, CONST, Const, None, None)
Eric Kunze2364dcd2021-04-26 11:06:57 -0700116DEF_OPERATOR(identity, IDENTITY, Identity, None, None)
Eric Kunze2364dcd2021-04-26 11:06:57 -0700117
118/* custom operations */
119DEF_OPERATOR(custom, CUSTOM, Custom, None, None)
120
121/* control flow operators */
122DEF_OPERATOR(cond_if, COND_IF, CondIf, CondIf, None)
123DEF_OPERATOR(while_loop, WHILE_LOOP, WhileLoop, WhileLoop, None)