[Mlir-commits] [mlir] [mlir] Add `res()` method to `linalg::ContractionOpInterface` (PR #76539)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Dec 31 22:48:02 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Jerry Wu (pzread)

<details>
<summary>Changes</summary>

In addition to `lhs()` and `rhs()` to return left and right operands, add `res()` to return the result value.

---
Full diff: https://github.com/llvm/llvm-project/pull/76539.diff


1 Files Affected:

- (modified) mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td (+8) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
index fbf3f19cde0e9b..033cd25a99c025 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
@@ -54,6 +54,14 @@ def LinalgContractionOpInterface : OpInterface<"ContractionOpInterface"> {
       return $_op.getOperation()->getOperand(1);
     }]>,
     InterfaceMethod<
+    /*desc=*/"Returns the result value.",
+    /*retTy=*/"OpResult",
+    /*methodName=*/"res",
+    /*args=*/(ins),
+    /*methodBody=*/[{
+      return $_op.getOperation()->getResult(1);
+    }]>,
+    InterfaceMethod<
     /*desc=*/[{
       Returns whether the given op has indexing maps that correspond to a
       row-major matmul operation.

``````````

</details>


https://github.com/llvm/llvm-project/pull/76539


More information about the Mlir-commits mailing list