This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Move trait to InferTypeOpInterface
ClosedPublic

Authored by jpienaar on Nov 18 2021, 4:39 PM.

Details

Summary

Step towards removing the hardcoded behavior of this trait (from ODS to Python bindings) and to instead use common interface.

Diff Detail

Event Timeline

jpienaar created this revision.Nov 18 2021, 4:39 PM
jpienaar requested review of this revision.Nov 18 2021, 4:39 PM
rriddle added inline comments.Nov 18 2021, 4:42 PM
mlir/include/mlir/Interfaces/InferTypeOpInterface.td
182

Is this implying that SameOperandsAndResultType shouldn't be a trait, and should instead imply a specific implementation of InferTypeOpInterface?

mlir/test/Dialect/SPIRV/IR/bit-ops.mlir
28–32

typo: verificaiton

Also, Can you expand this TODO? It isn't obvious what the ideal state is.

62

Same here and elsewhere.

jpienaar added inline comments.Nov 19 2021, 8:43 AM
mlir/include/mlir/Interfaces/InferTypeOpInterface.td
182

Yes, and most places we can simply remove it. Now I will probably still keep it as a trait as folks are indexing of it. Most cases won't need it, and then this trait would just implement the methods required for InferTypeOpInterface.

jpienaar updated this revision to Diff 388520.Nov 19 2021, 8:53 AM
jpienaar marked 2 inline comments as done.

Fix typos and make TODOs more explicit

jpienaar added inline comments.Nov 19 2021, 8:59 AM
mlir/include/mlir/Interfaces/InferTypeOpInterface.td
182

(to expand: it'll become an OpTraitList ODS side, C++ we'll still have it as a trait but the op will also have the infer type interface and most special casing can be removed)

rriddle accepted this revision.Nov 19 2021, 11:19 AM

LG, directing more thing towards InferTypeOpInterface seems good in general.

This revision is now accepted and ready to land.Nov 19 2021, 11:19 AM

Please fix flang as well, looks like it's broken by this.

jpienaar updated this revision to Diff 388646.Nov 19 2021, 3:20 PM

Updating flang and standalone example

Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2021, 3:20 PM
Herald added a subscriber: mgorny. · View Herald Transcript
This revision was automatically updated to reflect the committed changes.