Different constraints may share the same predicate, in this case, we
will generate duplicate ODS verification function.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Nice, could you add a test? Any measurement of how much duplicate functions were being generated?
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | ||
---|---|---|
232 | Could you add a comment here too? I know you have above, but one here saying something like "Ensure the same error message is reported" or "Avoid merging verification what would produce different error messages". Although, come to think of it: in that case, if the same predicate would fail, then the failure is in order and we would not be able to trigger the one post (as this is per op), so do we even need to check this if it cannot be observed? Or is it observable? |
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | ||
---|---|---|
232 | When predicate fails we need to report the summary of the associated Constraint. Thus a predicate fail may happen under different contexts. For example, ConstraintA is applied on OpA, ConstraintB is applied on OpB and they have the same predicate. We need to report summary of ConstraintA if the predicate fails while verifying OpA, otherwise we need to report summary of ConstraintB. So far I don't see this case, or we can give an error instead? |
mlir/include/mlir/TableGen/Predicate.h | ||
---|---|---|
17 | OOC why is APInt needed here? | |
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | ||
232 | You are correct, I was thinking of predicates on same op vs different ones. And they could indeed be different (nothing stopping one predicate from having different high level info associated with it) so needs to be retained even if we don't do so today. |
OOC why is APInt needed here?