[Mlir-commits] [mlir] 0588215 - [mlir][Linalg] NFC - Add isOutputTensor to LinalgInterfaces.td
Nicolas Vasilache
llvmlistbot at llvm.org
Thu Mar 4 04:33:48 PST 2021
Author: Nicolas Vasilache
Date: 2021-03-04T12:33:21Z
New Revision: 05882157db9e240d1f73fe89b6f19e2388177ad1
URL: https://github.com/llvm/llvm-project/commit/05882157db9e240d1f73fe89b6f19e2388177ad1
DIFF: https://github.com/llvm/llvm-project/commit/05882157db9e240d1f73fe89b6f19e2388177ad1.diff
LOG: [mlir][Linalg] NFC - Add isOutputTensor to LinalgInterfaces.td
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
index 84b1bcb8bad4..d84d52d858ad 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
@@ -677,6 +677,22 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
return false;
}]
>,
+ InterfaceMethod<
+ /*desc=*/[{
+ Return true if `opOperand` is an output tensor.
+ }],
+ /*retTy=*/"bool",
+ /*methodName=*/"isOutputTensor",
+ /*args=*/(ins "OpOperand *":$opOperand),
+ /*methodBody=*/"",
+ /*defaultImplementation=*/[{
+ if (!opOperand->get().getType().template isa<RankedTensorType>())
+ return false;
+ if (opOperand->getOperandNumber() >= $_op.getNumInputs())
+ return true;
+ return false;
+ }]
+ >,
InterfaceMethod<
/*desc=*/[{
Return true if `opOperand` is an init tensor. This is true when it is
@@ -687,9 +703,7 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
/*args=*/(ins "OpOperand *":$opOperand),
/*methodBody=*/"",
/*defaultImplementation=*/[{
- if (!opOperand->get().getType().template isa<RankedTensorType>())
- return false;
- if (opOperand->getOperandNumber() < $_op.getNumInputs())
+ if (!$_op.isOutputTensor(opOperand))
return false;
return payloadUsesValueFromOpOperand(opOperand);
}]
More information about the Mlir-commits
mailing list