This is an archive of the discontinued LLVM Phabricator instance.

Let MLIR ODS also support generating build() functions without result type parameters when the op contains regions.
ClosedPublic

Authored by phisiart on Oct 19 2022, 1:16 AM.

Diff Detail

Event Timeline

phisiart created this revision.Oct 19 2022, 1:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2022, 1:16 AM
phisiart requested review of this revision.Oct 19 2022, 1:16 AM
jpienaar added inline comments.Oct 19 2022, 4:19 PM
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
1586

This TODO refers to the region not being passed in in 1520 (well and also no testing for ops with regions with inference). This was being conservative due to lack of evaluation. Change to pass in regions and I think we can remove the conservative checks here. Ideally we had a test that exercised inference with regions too.

phisiart updated this revision to Diff 469352.Oct 20 2022, 2:01 PM

Pass odsState.regions to inferReturnTypes() and update relevant test (op-result.td).

phisiart marked an inline comment as done.Oct 20 2022, 2:05 PM
phisiart added inline comments.
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
1586

Now we pass odsState.regions to inferReturnTypes().

Q: Could you expand on what "conservative checks" mean? I'm having some trouble understanding what checks to remove.

Q: op-result.td is updated to reflect the change. Would that be enough test coverage? If not, could you provide some guidance on where to add additional test cases?

Thanks!

jpienaar accepted this revision.Oct 20 2022, 7:50 PM
jpienaar added inline comments.
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
1586

Sure, the check is the one you removed below. I call it conservative as there isn't much technical reason behind the exclusion except I didn't have have a good end to end usage which showed if API was good.

Ideally we'd like an execution test with an op, but nothing much was missing that I can think of that a test would show beyond this. So sufficient.

This revision is now accepted and ready to land.Oct 20 2022, 7:50 PM
phisiart marked an inline comment as done.Oct 21 2022, 12:44 AM

I don't have commit access. Could you submit this patch for me? Thanks!