[Mlir-commits] [mlir] [mlir][linalg]-Fix wrong assertion in the getMatchingYieldValue inter… (PR #89590)

Amir Bishara llvmlistbot at llvm.org
Mon Apr 22 03:33:59 PDT 2024


https://github.com/amirBish created https://github.com/llvm/llvm-project/pull/89590

…face

In order to have a consistent implementation for getMatchingYieldValue for linalg generic with buffer/tensor semantics, we should assert the opOperand index based on the numDpsInits and not numOfResults which may be zero in the buffer semantics.

>From 76d2834d10039309a78a606077c430359df816c1 Mon Sep 17 00:00:00 2001
From: Amir Bishara <amir.bishara at mobileye.com>
Date: Mon, 22 Apr 2024 13:15:53 +0300
Subject: [PATCH] [mlir][linalg]-Fix wrong assertion in the
 getMatchingYieldValue interface

In order to have a consistent implementation for getMatchingYieldValue
for linalg generic with buffer/tensor semantics, we should assert the
opOperand index based on the numDpsInits and not numOfResults which may
be zero in the buffer semantics.
---
 mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
index fbf3f19cde0e9b..d20925da778e0a 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
@@ -486,7 +486,7 @@ def LinalgStructuredInterface
         int64_t resultIndex =
             opOperand->getOperandNumber() - $_op.getNumDpsInputs();
         assert(resultIndex >= 0 &&
-               resultIndex < this->getOperation()->getNumResults());
+               resultIndex < $_op.getNumDpsInits());
         Operation *yieldOp = getBlock()->getTerminator();
         return &yieldOp->getOpOperand(resultIndex);
       }]



More information about the Mlir-commits mailing list