I need to define my own Type (e.g. my own memref kind type). I was reading through mlir past discourse and documentation and am bit confused. In Ease of defining new types and mlir document Defining Dialect Attributes and Types - MLIR it seems C++ code approach is only solution. But then I also see tableGen approach implemented perhaps, as in TypeDef in BuiltinTypes.td. Which approach would be best for me to take. Sorry if I am vague, I can come back with any clarification if you need me to,
Use ODS (aka Tablegen) - Operation Definition Specification (ODS) - MLIR - unless you can’t express what you need with it.
Thanks Alex. The confusion I have with TableGen TypeDef approach is that very few Dialects in MLIR actually use it (e.g. neither LLVM nor Toy). Is it because it is limited or because it is new?
Thanks a lot.
It’s both new and subject to some limitations. Last time I looked at it, I couldn’t add interface implementations to the type. Modernization patches to LLVM are welcome