Skip to content

[mlir] Add res() method to linalg::ContractionOpInterface #76539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 4, 2024

Conversation

pzread
Copy link
Member

@pzread pzread commented Dec 28, 2023

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

@pzread pzread force-pushed the add-helper-to-contraction branch from 8a14830 to 524cf6b Compare January 1, 2024 06:47
@pzread pzread marked this pull request as ready for review January 1, 2024 06:47
@llvmbot
Copy link
Member

llvmbot commented Jan 1, 2024

@llvm/pr-subscribers-mlir-linalg

@llvm/pr-subscribers-mlir

Author: Jerry Wu (pzread)

Changes

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 --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.

Copy link
Collaborator

@joker-eph joker-eph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be dead code, can you add tests for this?

@pzread pzread force-pushed the add-helper-to-contraction branch from 61ea483 to c2c5589 Compare January 3, 2024 19:03
@pzread
Copy link
Member Author

pzread commented Jan 3, 2024

This will be dead code, can you add tests for this?

Added the unit test

@pzread pzread requested a review from joker-eph January 3, 2024 19:04
@pzread pzread force-pushed the add-helper-to-contraction branch from c2c5589 to c101027 Compare January 4, 2024 00:57
@pzread pzread merged commit 53edf12 into llvm:main Jan 4, 2024
@pzread pzread deleted the add-helper-to-contraction branch January 4, 2024 03:34
hctim added a commit that referenced this pull request Jan 4, 2024
…#76539)"

This reverts commit 53edf12.

Reason: Broke the sanitizer buildbots with a memory leak. More
information available on
53edf12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants