Skip to content

Commit caf8942

Browse files
Lewuathejoker-eph
andauthored
[mlir][transform] Guard parametric loop tiling pass from no option (#118254)
`test-extract-fixed-outer-loops` pass always crash without any `test-outer-loop-sizes` option. We need to keep the pass from crash by checking the option existence. Fix #61716, #116360 --------- Co-authored-by: Mehdi Amini <[email protected]>
1 parent 03aae4f commit caf8942

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: not mlir-opt -test-extract-fixed-outer-loops %s 2>&1 | FileCheck %s
2+
3+
func.func @no_crash(%arg0: memref<?x?xf32>) {
4+
// CHECK: error: missing `test-outer-loop-sizes` pass-option for outer loop sizes
5+
return
6+
}

mlir/test/lib/Dialect/SCF/TestLoopParametricTiling.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ class SimpleParametricLoopTilingPass
4040
}
4141

4242
void runOnOperation() override {
43+
if (sizes.empty()) {
44+
emitError(
45+
UnknownLoc::get(&getContext()),
46+
"missing `test-outer-loop-sizes` pass-option for outer loop sizes");
47+
signalPassFailure();
48+
return;
49+
}
4350
getOperation()->walk([this](scf::ForOp op) {
4451
// Ignore nested loops.
4552
if (op->getParentRegion()->getParentOfType<scf::ForOp>())

0 commit comments

Comments
 (0)