MLIR supports operations with resizable operand lists, but this property must
be indicated during the construction of such operations. It can be done
programmatically by calling a function on OperationState. Introduce an
ODS-internal trait ResizableOperandList to indicate such operations are use
it when generating the bodies of various build functions as well as the
parse function when the declarative assembly format is used.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
How do we refer to resizable operands? E.g., OpE has resizeable operands, how do you refer to them in a pattern?
Or is the expectation that the last operand is always variadic and that is the resizable one?
The same way you usually do. It's up to your op how its operands are split into groups and how those groups are referred to. Being able to resize the list doesn't necessarily mean append operands. In most cases, I'd expect there is a variadic group. But I can also see an op with one optional operand. The use case I have has 3 variadic groups and 2 of them are modified.
Can we handle this with a traits on the op itself instead?
This implementation does not seem to be robust with respect to custom builders, and I suspect that with a trait we could just change the generic create method to query this traits and set the right flag.