[Mlir-commits] [mlir] [mlir][ODS] Allow inferring operand types from multiple variables (PR #127517)

Markus Böck llvmlistbot at llvm.org
Tue Feb 18 05:09:30 PST 2025


================
@@ -556,20 +556,30 @@ class AllShapesMatch<list<string> names> :
 class AllTypesMatch<list<string> names> :
     AllMatchSameOperatorTrait<names, "$_self.getType()", "type">;
 
-// A type constraint that denotes `transform(lhs.getType()) == rhs.getType()`.
+// A type constraint that denotes `transform(unpack(lhs.getTypes())) == rhs.getType()`.
 // An optional comparator function may be provided that changes the above form
-// into: `comparator(transform(lhs.getType()), rhs.getType())`.
-class TypesMatchWith<string summary, string lhsArg, string rhsArg,
-                     string transform, string comparator = "std::equal_to<>()">
+// into: `comparator(transform(unpack(lhs.getTypes())), rhs.getType())`.
+class InferTypesFrom<string summary, list<string> lhsArg, string rhsArg,
+                     string transform, 
+                     string comparator = "std::equal_to<>()">
----------------
zero9178 wrote:

`unpack` seems to be a bit confusing to me, I would keep it as `transform(lhs)` or maybe `transform(types(lhs))`. 
Could we also document the requirements of the `transform` string? E.g. that the types of arguments in `lhs` are expected to be referenced as `$argN`

https://github.com/llvm/llvm-project/pull/127517


More information about the Mlir-commits mailing list