blob: 267976ca221809169bfff7bdf046f7f67689392e [file] [log] [blame]
Eric Kunzee5e26762020-10-13 16:11:07 -07001
2// Copyright (c) 2020, 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)
Kevin Chengaee1fac2020-11-11 13:54:06 -080048DEF_OPERATOR(arithmetic_right_shift, ARITHMETIC_RIGHT_SHIFT, ArithmeticRightShift, ArithmeticRightShift, None)
Eric Kunzee5e26762020-10-13 16:11:07 -070049DEF_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)
52DEF_OPERATOR(logical_and, LOGICAL_AND, LogicalAnd, None, None)
53DEF_OPERATOR(logical_left_shift, LOGICAL_LEFT_SHIFT, LogicalLeftShift, None, None)
54DEF_OPERATOR(logical_right_shift, LOGICAL_RIGHT_SHIFT, LogicalRightShift, None, None)
55DEF_OPERATOR(logical_or, LOGICAL_OR, LogicalOr, None, None)
56DEF_OPERATOR(logical_xor, LOGICAL_XOR, LogicalXor, None, None)
57DEF_OPERATOR(maximum, MAXIMUM, Maximum, None, None)
58DEF_OPERATOR(minimum, MINIMUM, Minimum, None, None)
Kevin Chengaee1fac2020-11-11 13:54:06 -080059DEF_OPERATOR(mul, MUL, Mul, Mul, None)
Eric Kunzee5e26762020-10-13 16:11:07 -070060DEF_OPERATOR(pow, POW, Pow, None, None)
61DEF_OPERATOR(sub, SUB, Sub, None, None)
62DEF_OPERATOR(table, TABLE, Table, None, None)
63
64/* elementwise - unary */
65DEF_OPERATOR(abs, ABS, Abs, None, None)
66DEF_OPERATOR(bitwise_not, BITWISE_NOT, BitwiseNot, None, None)
67DEF_OPERATOR(ceil, CEIL, Ceil, None, None)
68DEF_OPERATOR(clz, CLZ, Clz, None, None)
69DEF_OPERATOR(exp, EXP, Exp, None, None)
70DEF_OPERATOR(floor, FLOOR, Floor, None, None)
71DEF_OPERATOR(log, LOG, Log, None, None)
72DEF_OPERATOR(logical_not, LOGICAL_NOT, LogicalNot, None, None)
73DEF_OPERATOR(negate, NEGATE, Negate, None, Unary)
74DEF_OPERATOR(reciprocal, RECIPROCAL, Reciprocal, None, None)
75DEF_OPERATOR(rsqrt, RSQRT, Rsqrt, None, None)
76
77/* elementwise - ternary */
78DEF_OPERATOR(select, SELECT, Select, None, None)
79
80/* logical */
81DEF_OPERATOR(equal, EQUAL, Equal, None, None)
82DEF_OPERATOR(greater, GREATER, Greater, None, None)
83DEF_OPERATOR(greater_equal, GREATER_EQUAL, GreaterEqual, None, None)
84
85/* reduction */
86DEF_OPERATOR(reduce_any, REDUCE_ANY, ReduceAny, Reduce, None)
87DEF_OPERATOR(reduce_all, REDUCE_ALL, ReduceAll, Reduce, None)
88DEF_OPERATOR(reduce_max, REDUCE_MAX, ReduceMax, Reduce, None)
89DEF_OPERATOR(reduce_min, REDUCE_MIN, ReduceMin, Reduce, None)
90DEF_OPERATOR(reduce_prod, REDUCE_PRODUCT, ReduceProduct, Reduce, None)
91DEF_OPERATOR(reduce_sum, REDUCE_SUM, ReduceSum, Reduce, None)
92
93/* memory operation */
94DEF_OPERATOR(concat, CONCAT, Concat, Axis, None)
95DEF_OPERATOR(pad, PAD, Pad, None, Pad)
96DEF_OPERATOR(reshape, RESHAPE, Reshape, Reshape, None)
97DEF_OPERATOR(reverse, REVERSE, Reverse, Reverse, None)
98DEF_OPERATOR(slice, SLICE, Slice, Slice, None)
99DEF_OPERATOR(tile, TILE, Tile, Tile, None)
100DEF_OPERATOR(transpose, TRANSPOSE, Transpose, None, None)
101
102/* gather/scatter */
103DEF_OPERATOR(gather, GATHER, Gather, Axis, None)
104
105/* image */
106DEF_OPERATOR(resize, RESIZE, Resize, Resize, None)
107
108/* quantization */
109DEF_OPERATOR(cast, CAST, Cast, None, None)
110DEF_OPERATOR(rescale, RESCALE, Rescale, Rescale, None)
111
112/* data nodes */
113DEF_OPERATOR(const, CONST, Const, None, None)
114DEF_OPERATOR(placeholder, PLACEHOLDER, Placeholder, None, None)
115DEF_OPERATOR(identity, IDENTITY, Identity, None, None)
116DEF_OPERATOR(identityn, IDENTITYN, IdentityN, None, None)
117
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)