|
| 1 | +<!-- Autogenerated by mlir-tblgen; don't manually edit --> |
| 2 | + |
| 3 | +### `toy.add` (toy::AddOp) |
| 4 | + |
| 5 | +_Element-wise addition operation_ |
| 6 | + |
| 7 | +The "add" operation performs element-wise addition between two tensors. |
| 8 | +The shapes of the tensor operands are expected to match. |
| 9 | + |
| 10 | +#### Operands: |
| 11 | + |
| 12 | +| Operand | Description | |
| 13 | +| :-----: | ----------- | |
| 14 | +| `lhs` | tensor of 64-bit float values | |
| 15 | +| `rhs` | tensor of 64-bit float values | |
| 16 | + |
| 17 | +#### Results: |
| 18 | + |
| 19 | +| Result | Description | |
| 20 | +| :----: | ----------- | |
| 21 | +| «unnamed» | tensor of 64-bit float values | |
| 22 | + |
| 23 | + |
| 24 | +### `toy.constant` (toy::ConstantOp) |
| 25 | + |
| 26 | +_Constant_ |
| 27 | + |
| 28 | +Constant operation turns a literal into an SSA value. The data is attached |
| 29 | +to the operation as an attribute. For example: |
| 30 | + |
| 31 | +```mlir |
| 32 | + %0 = toy.constant dense<[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]> |
| 33 | + : tensor<2x3xf64> |
| 34 | +``` |
| 35 | + |
| 36 | +Traits: `AlwaysSpeculatableImplTrait` |
| 37 | + |
| 38 | +Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)` |
| 39 | + |
| 40 | +Effects: `MemoryEffects::Effect{}` |
| 41 | + |
| 42 | +#### Attributes: |
| 43 | + |
| 44 | +<table> |
| 45 | +<tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr> |
| 46 | +<tr><td><code>value</code></td><td>::mlir::DenseElementsAttr</td><td>64-bit float elements attribute</td></tr> |
| 47 | +</table> |
| 48 | + |
| 49 | +#### Results: |
| 50 | + |
| 51 | +| Result | Description | |
| 52 | +| :----: | ----------- | |
| 53 | +| «unnamed» | tensor of 64-bit float values | |
| 54 | + |
| 55 | + |
| 56 | +### `toy.func` (toy::FuncOp) |
| 57 | + |
| 58 | +_User defined function operation_ |
| 59 | + |
| 60 | +The "toy.func" operation represents a user defined function. These are |
| 61 | +callable SSA-region operations that contain toy computations. |
| 62 | + |
| 63 | +Example: |
| 64 | + |
| 65 | +```mlir |
| 66 | +toy.func @main() { |
| 67 | + %0 = toy.constant dense<5.500000e+00> : tensor<f64> |
| 68 | + %1 = toy.reshape(%0 : tensor<f64>) to tensor<2x2xf64> |
| 69 | + toy.print %1 : tensor<2x2xf64> |
| 70 | + toy.return |
| 71 | +} |
| 72 | +``` |
| 73 | + |
| 74 | +Traits: `IsolatedFromAbove` |
| 75 | + |
| 76 | +Interfaces: `ArgAndResultAttrsOpInterface`, `CallableOpInterface`, `FunctionOpInterface`, `Symbol` |
| 77 | + |
| 78 | +#### Attributes: |
| 79 | + |
| 80 | +<table> |
| 81 | +<tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr> |
| 82 | +<tr><td><code>sym_name</code></td><td>::mlir::StringAttr</td><td>string attribute</td></tr> |
| 83 | +<tr><td><code>function_type</code></td><td>::mlir::TypeAttr</td><td>type attribute of function type</td></tr> |
| 84 | +<tr><td><code>arg_attrs</code></td><td>::mlir::ArrayAttr</td><td>Array of dictionary attributes</td></tr> |
| 85 | +<tr><td><code>res_attrs</code></td><td>::mlir::ArrayAttr</td><td>Array of dictionary attributes</td></tr> |
| 86 | +</table> |
| 87 | + |
| 88 | + |
| 89 | +### `toy.generic_call` (toy::GenericCallOp) |
| 90 | + |
| 91 | +_Generic call operation_ |
| 92 | + |
| 93 | +Syntax: |
| 94 | + |
| 95 | +``` |
| 96 | +operation ::= `toy.generic_call` $callee `(` $inputs `)` attr-dict `:` functional-type($inputs, results) |
| 97 | +``` |
| 98 | + |
| 99 | +Generic calls represent calls to a user defined function that needs to |
| 100 | +be specialized for the shape of its arguments. The callee name is attached |
| 101 | +as a symbol reference via an attribute. The arguments list must match the |
| 102 | +arguments expected by the callee. For example: |
| 103 | + |
| 104 | +```mlir |
| 105 | + %4 = toy.generic_call @my_func(%1, %3) |
| 106 | + : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> |
| 107 | +``` |
| 108 | + |
| 109 | +This is only valid if a function named "my_func" exists and takes two |
| 110 | +arguments. |
| 111 | + |
| 112 | +#### Attributes: |
| 113 | + |
| 114 | +<table> |
| 115 | +<tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr> |
| 116 | +<tr><td><code>callee</code></td><td>::mlir::FlatSymbolRefAttr</td><td>flat symbol reference attribute</td></tr> |
| 117 | +</table> |
| 118 | + |
| 119 | +#### Operands: |
| 120 | + |
| 121 | +| Operand | Description | |
| 122 | +| :-----: | ----------- | |
| 123 | +| `inputs` | variadic of tensor of 64-bit float values | |
| 124 | + |
| 125 | +#### Results: |
| 126 | + |
| 127 | +| Result | Description | |
| 128 | +| :----: | ----------- | |
| 129 | +| «unnamed» | tensor of 64-bit float values | |
| 130 | + |
| 131 | + |
| 132 | +### `toy.mul` (toy::MulOp) |
| 133 | + |
| 134 | +_Element-wise multiplication operation_ |
| 135 | + |
| 136 | +The "mul" operation performs element-wise multiplication between two |
| 137 | +tensors. The shapes of the tensor operands are expected to match. |
| 138 | + |
| 139 | +#### Operands: |
| 140 | + |
| 141 | +| Operand | Description | |
| 142 | +| :-----: | ----------- | |
| 143 | +| `lhs` | tensor of 64-bit float values | |
| 144 | +| `rhs` | tensor of 64-bit float values | |
| 145 | + |
| 146 | +#### Results: |
| 147 | + |
| 148 | +| Result | Description | |
| 149 | +| :----: | ----------- | |
| 150 | +| «unnamed» | tensor of 64-bit float values | |
| 151 | + |
| 152 | + |
| 153 | +### `toy.print` (toy::PrintOp) |
| 154 | + |
| 155 | +_Print operation_ |
| 156 | + |
| 157 | +Syntax: |
| 158 | + |
| 159 | +``` |
| 160 | +operation ::= `toy.print` $input attr-dict `:` type($input) |
| 161 | +``` |
| 162 | + |
| 163 | +The "print" builtin operation prints a given input tensor, and produces |
| 164 | +no results. |
| 165 | + |
| 166 | +#### Operands: |
| 167 | + |
| 168 | +| Operand | Description | |
| 169 | +| :-----: | ----------- | |
| 170 | +| `input` | tensor of 64-bit float values | |
| 171 | + |
| 172 | + |
| 173 | +### `toy.reshape` (toy::ReshapeOp) |
| 174 | + |
| 175 | +_Tensor reshape operation_ |
| 176 | + |
| 177 | +Syntax: |
| 178 | + |
| 179 | +``` |
| 180 | +operation ::= `toy.reshape` `(` $input `:` type($input) `)` attr-dict `to` type(results) |
| 181 | +``` |
| 182 | + |
| 183 | +Reshape operation is transforming its input tensor into a new tensor with |
| 184 | +the same number of elements but different shapes. For example: |
| 185 | + |
| 186 | +```mlir |
| 187 | + %0 = toy.reshape (%arg1 : tensor<10xf64>) to tensor<5x2xf64> |
| 188 | +``` |
| 189 | + |
| 190 | +#### Operands: |
| 191 | + |
| 192 | +| Operand | Description | |
| 193 | +| :-----: | ----------- | |
| 194 | +| `input` | tensor of 64-bit float values | |
| 195 | + |
| 196 | +#### Results: |
| 197 | + |
| 198 | +| Result | Description | |
| 199 | +| :----: | ----------- | |
| 200 | +| «unnamed» | statically shaped tensor of 64-bit float values | |
| 201 | + |
| 202 | + |
| 203 | +### `toy.return` (toy::ReturnOp) |
| 204 | + |
| 205 | +_Return operation_ |
| 206 | + |
| 207 | +Syntax: |
| 208 | + |
| 209 | +``` |
| 210 | +operation ::= `toy.return` ($input^ `:` type($input))? attr-dict |
| 211 | +``` |
| 212 | + |
| 213 | +The "return" operation represents a return operation within a function. |
| 214 | +The operation takes an optional tensor operand and produces no results. |
| 215 | +The operand type must match the signature of the function that contains |
| 216 | +the operation. For example: |
| 217 | + |
| 218 | +```mlir |
| 219 | + toy.func @foo() -> tensor<2xf64> { |
| 220 | + ... |
| 221 | + toy.return %0 : tensor<2xf64> |
| 222 | + } |
| 223 | +``` |
| 224 | + |
| 225 | +Traits: `AlwaysSpeculatableImplTrait`, `HasParent<FuncOp>`, `Terminator` |
| 226 | + |
| 227 | +Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)` |
| 228 | + |
| 229 | +Effects: `MemoryEffects::Effect{}` |
| 230 | + |
| 231 | +#### Operands: |
| 232 | + |
| 233 | +| Operand | Description | |
| 234 | +| :-----: | ----------- | |
| 235 | +| `input` | variadic of tensor of 64-bit float values | |
| 236 | + |
| 237 | + |
| 238 | +### `toy.transpose` (toy::TransposeOp) |
| 239 | + |
| 240 | +_Transpose operation_ |
| 241 | + |
| 242 | +Syntax: |
| 243 | + |
| 244 | +``` |
| 245 | +operation ::= `toy.transpose` `(` $input `:` type($input) `)` attr-dict `to` type(results) |
| 246 | +``` |
| 247 | + |
| 248 | +#### Operands: |
| 249 | + |
| 250 | +| Operand | Description | |
| 251 | +| :-----: | ----------- | |
| 252 | +| `input` | tensor of 64-bit float values | |
| 253 | + |
| 254 | +#### Results: |
| 255 | + |
| 256 | +| Result | Description | |
| 257 | +| :----: | ----------- | |
| 258 | +| «unnamed» | tensor of 64-bit float values | |
| 259 | + |
0 commit comments