[mlir][linalg] Add a FillOpInterface.

Add a FillOpInterface similar to the contraction and convolution op interfaces. The FillOpInterface is a preparation step to replace linalg.fill by its OpDSL version linalg.fill_tensor. The interface implements the `value()`, `output()`, and `result()` methods that by default are not available on linalg.fill_tensor.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D120725
This commit is contained in:
gysit
2022-03-08 15:33:47 +00:00
parent 95c0f2d115
commit f4ae02afe7
8 changed files with 189 additions and 0 deletions

View File

@@ -686,6 +686,7 @@ class OpInterfaceDef:
ContractionOpInterface = OpInterfaceDef("LinalgContractionOpInterface")
ConvolutionOpInterface = OpInterfaceDef("LinalgConvolutionOpInterface")
FillOpInterface = OpInterfaceDef("LinalgFillOpInterface")
class OpMetadataDef(YAMLObject):

View File

@@ -671,6 +671,7 @@ def fill_tensor(value=ScalarDef(T1), O=TensorDef(U, output=True)):
accesses only and is thus rank polymorphic. Numeric casting is performed on
the value operand, promoting it to the same data type as the output.
"""
implements(FillOpInterface)
O[None] = TypeFn.cast_signed(U, value)