Skip to content

Conversation

sebvince
Copy link
Contributor

@sebvince sebvince commented Oct 1, 2025

No description provided.

@sebvince sebvince changed the title [MLIR][SCF} Check loops param in existing test [MLIR][SCF] Update TestTileUsingCustomLoopOp to check loops param Oct 1, 2025
@sebvince sebvince force-pushed the scf_custom_loop_params_test branch from befc959 to fd3c232 Compare October 1, 2025 08:44
@sebvince sebvince marked this pull request as ready for review October 1, 2025 09:03
@llvmbot llvmbot added the mlir label Oct 1, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 1, 2025

@llvm/pr-subscribers-mlir

Author: None (sebvince)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/161490.diff

1 Files Affected:

  • (modified) mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp (+13)
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(

if (!forOp) {
return emitOpError("unexpected loop type. Expecting scf::ForOp");
}
rewriter.setInsertionPointToEnd(forOp->getBody());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this changing nothing to the rest of the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test needs the insertionPoint to be set at the end of getBody of the loop. Previously, it was implicitly set in generateLoopHeaderFn.

…ansformOps.cpp

Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants