[Mlir-commits] [mlir] [MLIR][SCF] Update TestTileUsingCustomLoopOp to check `loops` param (PR #161490)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 1 05:21:36 PDT 2025


https://github.com/sebvince updated https://github.com/llvm/llvm-project/pull/161490

>From fd3c232372f26e0bc5acfd0332999cd9ff5f89c8 Mon Sep 17 00:00:00 2001
From: Seb Vince <sebvince at amd.com>
Date: Wed, 1 Oct 2025 08:18:12 +0000
Subject: [PATCH 1/2] [MLIR][SCF} Check loops param in existing test

---
 .../TestTilingInterfaceTransformOps.cpp             | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp b/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp
index 326fec3ee5cf0..95dbbe8feda0e 100644
--- a/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp
+++ b/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp
@@ -22,7 +22,10 @@
 #include "mlir/Dialect/Utils/StructuredOpsUtils.h"
 #include "mlir/IR/Dominance.h"
 #include "mlir/IR/OpImplementation.h"
+#include "mlir/Interfaces/LoopLikeInterface.h"
 #include "mlir/Interfaces/TilingInterface.h"
+#include "mlir/Support/LLVM.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "test-tiling-interface"
@@ -586,6 +589,16 @@ DiagnosedSilenceableFailure transform::TestTileUsingCustomLoopOp::apply(
           ArrayRef<SmallVector<OpFoldResult>> resultOffsets,
           ArrayRef<SmallVector<OpFoldResult>> resultSizes,
           ValueRange destinationTensors) -> LogicalResult {
+    if (loops.size() != 1) {
+      return emitOpError("loop size must be 1");
+    }
+    LoopLikeOpInterface loop = loops.front();
+    scf::ForOp *forOp = dyn_cast<scf::ForOp>(&loop);
+    if (!forOp) {
+      return emitOpError("unexpected loop type. Expecting scf::ForOp");
+    }
+    rewriter.setInsertionPointToEnd(forOp->getBody());
+
     SmallVector<Value> yieldValues;
     yieldValues.reserve(destinationTensors.size());
     for (auto [tiledResult, offsets, sizes, destination] : llvm::zip_equal(

>From 6498f4f2ac64b7253b5d27d304af0308c15c5015 Mon Sep 17 00:00:00 2001
From: sebvince <115461989+sebvince at users.noreply.github.com>
Date: Wed, 1 Oct 2025 14:21:29 +0200
Subject: [PATCH 2/2] Update
 mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp

Co-authored-by: Mehdi Amini <joker.eph at gmail.com>
---
 .../TilingInterface/TestTilingInterfaceTransformOps.cpp        | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp b/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp
index 95dbbe8feda0e..6872c27810713 100644
--- a/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp
+++ b/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp
@@ -594,9 +594,8 @@ DiagnosedSilenceableFailure transform::TestTileUsingCustomLoopOp::apply(
     }
     LoopLikeOpInterface loop = loops.front();
     scf::ForOp *forOp = dyn_cast<scf::ForOp>(&loop);
-    if (!forOp) {
+    if (!forOp)
       return emitOpError("unexpected loop type. Expecting scf::ForOp");
-    }
     rewriter.setInsertionPointToEnd(forOp->getBody());
 
     SmallVector<Value> yieldValues;



More information about the Mlir-commits mailing list