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

Amir Bishara llvmlistbot at llvm.org
Thu Aug 7 08:16:24 PDT 2025


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

>From ae50df95638b4da9e043c55c21677c76f5c211ef 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 ba73cfbbed845..9f1e88a040f5f 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
@@ -474,7 +474,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