Skip to content

Commit fd3c232

Browse files
committed
[MLIR][SCF} Check loops param in existing test
1 parent 57b1b25 commit fd3c232

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
2323
#include "mlir/IR/Dominance.h"
2424
#include "mlir/IR/OpImplementation.h"
25+
#include "mlir/Interfaces/LoopLikeInterface.h"
2526
#include "mlir/Interfaces/TilingInterface.h"
27+
#include "mlir/Support/LLVM.h"
28+
#include "llvm/Support/Casting.h"
2629
#include "llvm/Support/Debug.h"
2730

2831
#define DEBUG_TYPE "test-tiling-interface"
@@ -586,6 +589,16 @@ DiagnosedSilenceableFailure transform::TestTileUsingCustomLoopOp::apply(
586589
ArrayRef<SmallVector<OpFoldResult>> resultOffsets,
587590
ArrayRef<SmallVector<OpFoldResult>> resultSizes,
588591
ValueRange destinationTensors) -> LogicalResult {
592+
if (loops.size() != 1) {
593+
return emitOpError("loop size must be 1");
594+
}
595+
LoopLikeOpInterface loop = loops.front();
596+
scf::ForOp *forOp = dyn_cast<scf::ForOp>(&loop);
597+
if (!forOp) {
598+
return emitOpError("unexpected loop type. Expecting scf::ForOp");
599+
}
600+
rewriter.setInsertionPointToEnd(forOp->getBody());
601+
589602
SmallVector<Value> yieldValues;
590603
yieldValues.reserve(destinationTensors.size());
591604
for (auto [tiledResult, offsets, sizes, destination] : llvm::zip_equal(

0 commit comments

Comments
 (0)