[Mlir-commits] [mlir] [MLIR][SCF} Check loops param in existing test (PR #161490)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 1 01:20:44 PDT 2025


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

None

>From befc9598210957677ac6d0aca16dd4922094d9be 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] [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(



More information about the Mlir-commits mailing list