Use aggregate-parameter builder for ops having autogen type-deduction builder
authorLei Zhang <antiagainst@google.com>
Fri, 15 Nov 2019 15:33:21 +0000 (07:33 -0800)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Fri, 15 Nov 2019 15:33:54 +0000 (07:33 -0800)
commit88843ae37cf3c65bb0e2debe171ae23cd5ad108d
tree9e050cca5227d977672ae4572a309699c11fb0d0
parent264a4635c8e4be829c21f6c6992d145e81272093
Use aggregate-parameter builder for ops having autogen type-deduction builder

Thus far DRR always invokes the separate-parameter builder (i.e., requiring
a separate parameter for each result-type/operand/attribute) for creating
ops, no matter whether we can auto-generate a builder with type-deduction
ability or not.

This CL changes the path for ops that we can auto-generate type-deduction
builders, i.e., with SameOperandsAndResultType/FirstAttrDerivedResultType
traits. Now they are going through a aggregate-parameter builder (i.e.,
requiring one parameter for all result-types/operands/attributes).
attributes.)

It is expected this approach will be more friendly for future shape inference
function autogen and calling those autogen'd shape inference function without
excessive packing and repacking operand/attribute lists.
Also, it would enable better support for creating ops with optional attributes
because we are not required to provide an Attribute() as placeholder for
an optional attribute anymore.

PiperOrigin-RevId: 280654800
mlir/g3doc/DeclarativeRewrites.md
mlir/test/mlir-tblgen/op-attribute.td
mlir/test/mlir-tblgen/op-result.td
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
mlir/tools/mlir-tblgen/RewriterGen.cpp