|
13 | 13 | #ifndef TOSA_TYPES_BASE |
14 | 14 | #define TOSA_TYPES_BASE |
15 | 15 |
|
16 | | -include "mlir/IR/AttrTypeBase.td" |
17 | 16 | include "mlir/IR/OpBase.td" |
18 | 17 |
|
19 | | -include "mlir/Dialect/Tosa/IR/TosaOpBase.td" |
20 | | - |
21 | 18 | //===----------------------------------------------------------------------===// |
22 | 19 | // Tosa Type Definitions. |
23 | 20 | //===----------------------------------------------------------------------===// |
@@ -218,66 +215,4 @@ def Tosa_Buffer : MemRefOf<[Tosa_AnyNumber]>; |
218 | 215 | def Tosa_TupleBuffer : NestedTupleOf<[Tosa_Buffer]>; |
219 | 216 | def Tosa_BufOrTuple : AnyTypeOf<[Tosa_Buffer, Tosa_TupleBuffer]>; |
220 | 217 |
|
221 | | -//===----------------------------------------------------------------------===// |
222 | | -// Tosa Type Definitions. |
223 | | -//===----------------------------------------------------------------------===// |
224 | | - |
225 | | -// The base class for Tosa dialect types. |
226 | | -class Tosa_Type<string name, string typeMnemonic, list<Trait> traits = []> |
227 | | - : TypeDef<Tosa_Dialect, name, traits> { |
228 | | - let mnemonic = typeMnemonic; |
229 | | -} |
230 | | - |
231 | | -//===----------------------------------------------------------------------===// |
232 | | -// ShapeType |
233 | | -//===----------------------------------------------------------------------===// |
234 | | -def Tosa_Shape : Tosa_Type<"shape", "shape"> { |
235 | | - let summary = "Shape with static rank and Index element type"; |
236 | | - let description = [{ |
237 | | - Syntax: |
238 | | - |
239 | | - ``` shape - type :: = `shape` `<` rank `>` |
240 | | - ``` Values with shape type represents a shape with a fixed rank and a list |
241 | | - of dimensions |
242 | | - .Rank must be zero or a positive integer |
243 | | - .Each dimension is represented by the builtin |
244 | | - Index type. |
245 | | - |
246 | | - Examples: |
247 | | - |
248 | | - ```mlir |
249 | | - // Shape with rank of four, for example, [1, 1, 8, 16]: |
250 | | - !tosa |
251 | | - .shape<4> |
252 | | - |
253 | | - // Shape with rank of one, for example, [16]: |
254 | | - !tosa |
255 | | - .shape<1> |
256 | | - |
257 | | - // Shape with rank zero, for example, [] (i.e., shape of scalar values): |
258 | | - !tosa.shape<0> |
259 | | - ``` |
260 | | - }]; |
261 | | - let parameters = (ins "int" : $rank); |
262 | | - let builders = [TypeBuilder<(ins "int" : $rank)>]; |
263 | | - let assemblyFormat = "`<` $rank `>`"; |
264 | | - |
265 | | - let genVerifyDecl = 1; |
266 | | -} |
267 | | - |
268 | | -def IsTosaShapeType : CPred<"mlir::tosa::isa_tosa_shape_type($_self)">; |
269 | | - |
270 | | -// Whether a Tosa Shape type has a rank equal to the specified rank. |
271 | | -class IsTosaShapeOfRankPred<int rank> : And<[ |
272 | | - IsTosaShapeType, |
273 | | - CPred<[{::llvm::cast<::mlir::tosa::shapeType>($_self).getRank() == }] # rank> |
274 | | -]>; |
275 | | - |
276 | | -class TosaShapeOfRank<int rank> |
277 | | - : Type<IsTosaShapeOfRankPred<rank>, "Tosa shape type of rank " #rank>; |
278 | | - |
279 | | -def Rank1TosaShape : TosaShapeOfRank<1>; |
280 | | -def Rank2TosaShape : TosaShapeOfRank<2>; |
281 | | -def Rank4TosaShape : TosaShapeOfRank<4>; |
282 | | - |
283 | 218 | #endif // TOSA_TYPES_BASE |
0 commit comments