This is an archive of the discontinued LLVM Phabricator instance.

[mlir][NFC] reifyResultShapes: Add extra error checking
ClosedPublic

Authored by springerm on Mar 10 2023, 2:14 AM.

Details

Summary

This change adds a new helper function mlir::reifyResultShapes that calls the corresponding interface method and also checks the result produced by the implementation when running in debug mode. Bugs due to incorrect interface implementations can be difficult to debug.

This helper function also reduces the amount of code needed at call sites: the cast to ReifyRankedShapedTypeOpInterface is done in the helper function.

Depends On: D145702

Diff Detail

Event Timeline

springerm created this revision.Mar 10 2023, 2:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2023, 2:14 AM
springerm requested review of this revision.Mar 10 2023, 2:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2023, 2:14 AM
nicolasvasilache accepted this revision.Mar 10 2023, 2:24 AM
This revision is now accepted and ready to land.Mar 10 2023, 2:24 AM
mlir/lib/Interfaces/InferTypeOpInterface.cpp
46

is this ever used in verification ?

assertion failures in verifiers lead to very hard to debug bugs ..

springerm added inline comments.Mar 10 2023, 2:30 AM
mlir/lib/Interfaces/InferTypeOpInterface.cpp
46

It's not used during verification, I checked all call sites of reifyResultShapes.

This revision was landed with ongoing or failed builds.Mar 10 2023, 2:38 AM
This revision was automatically updated to reflect the committed changes.