Generate builder for ops that use InferTypeOpInterface trait in ODS
authorJacques Pienaar <jpienaar@google.com>
Fri, 6 Dec 2019 18:52:38 +0000 (10:52 -0800)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Fri, 6 Dec 2019 18:53:06 +0000 (10:53 -0800)
commit398f04aa49109fd5d1eff2c1946a2956dc6b29c6
tree20c0b758574c11999f3d0c670fe5d0dc7a765b97
parente216a72ab8587c443e4c5c06aabc71c36712ce7e
Generate builder for ops that use InferTypeOpInterface trait in ODS

For ops with infer type op interface defined, generate version that calls the inferal method on build. This is intermediate step to removing special casing of SameOperandsAndResultType & FirstAttrDereivedResultType. After that would be generating the inference code, with the initial focus on shaped container types. In between I plan to refactor these a bit to reuse generated paths. The intention would not be to add the type inference trait in multiple places, but rather to take advantage of the current modelling in ODS where possible to emit it instead.

Switch the `inferReturnTypes` method to be static.

Skipping ops with regions here as I don't like the Region vs unique_ptr<Region> difference at the moment, and I want the infer return type trait to be useful for verification too. So instead, just skip it for now to avoid churn.

PiperOrigin-RevId: 284217913
mlir/include/mlir/Analysis/InferTypeOpInterface.td
mlir/test/lib/TestDialect/TestPatterns.cpp
mlir/test/mlir-tblgen/return-types.mlir
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp