According to the F&A in MLIR document, the trait is so different with interface. How are they both contained in same list<Trait> ?

I am confused by the fact that when people use ODS to define a new Op, the following code is real common.

def Toy_Op<string name, list<Trait> traits = [] >:
    Op<Toy_Dialect, name, !listconcat<traits, [Toy_Interface]>>{}

I guss that it dose’nt matter if it’s a real trait type when tablegen generate Op declaraction.

ODS does not separate Traits and Interface in how you attach them to an operation. They are still quite different (they inherit from different class hierarchy in ODS, and TableGen distinguish and generate different code)

1 Like

Thank your reply ^_^. I will try to use mlir-tblgen to check what heppend.