-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][transform] Guard parametric loop tiling pass from no option #118254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “FP Bundles” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-scf Author: Kai Sasaki (Lewuathe) Changes
Full diff: https://github.com/llvm/llvm-project/pull/118254.diff 2 Files Affected:
diff --git a/mlir/test/Transforms/invalid-outer-loop-size.mlir b/mlir/test/Transforms/invalid-outer-loop-size.mlir
new file mode 100644
index 00000000000000..42e5848b9704ed
--- /dev/null
+++ b/mlir/test/Transforms/invalid-outer-loop-size.mlir
@@ -0,0 +1,19 @@
+// RUN: mlir-opt -test-extract-fixed-outer-loops %s | FileCheck %s
+
+// COMMON-LABEL: @no_crash
+func.func @no_crash(%arg0: memref<?x?xf32>) {
+ // CHECK: %[[c2:.*]] = arith.constant 2 : index
+ %c2 = arith.constant 2 : index
+ // CHECK: %[[c44:.*]] = arith.constant 44 : index
+ %c44 = arith.constant 44 : index
+ // CHECK: %[[c1:.*]] = arith.constant 1 : index
+ %c1 = arith.constant 1 : index
+ // CHECK: scf.for %[[i:.*]] = %[[c2]] to %[[c44]] step %[[c1]]
+ scf.for %i = %c2 to %c44 step %c1 {
+ // CHECK: scf.for %[[j:.*]] = %[[c1]] to %[[c44]] step %[[c2]]
+ scf.for %j = %c1 to %c44 step %c2 {
+ memref.load %arg0[%i, %j]: memref<?x?xf32>
+ }
+ }
+ return
+}
diff --git a/mlir/test/lib/Dialect/SCF/TestLoopParametricTiling.cpp b/mlir/test/lib/Dialect/SCF/TestLoopParametricTiling.cpp
index 1f33a04b0668a9..f90371a27e7393 100644
--- a/mlir/test/lib/Dialect/SCF/TestLoopParametricTiling.cpp
+++ b/mlir/test/lib/Dialect/SCF/TestLoopParametricTiling.cpp
@@ -40,6 +40,9 @@ class SimpleParametricLoopTilingPass
}
void runOnOperation() override {
+ // If no outer loop iteration is given, ignore the pass.
+ if (sizes.empty())
+ return;
getOperation()->walk([this](scf::ForOp op) {
// Ignore nested loops.
if (op->getParentRegion()->getParentOfType<scf::ForOp>())
|
Co-authored-by: Mehdi Amini <[email protected]>
✅ With the latest revision this PR passed the C/C++ code formatter. |
Local branch amd-gfx 5f484c1 Merged main:68bcba6d7a1c into amd-gfx:fe02a5576f8e Remote branch main caf8942 [mlir][transform] Guard parametric loop tiling pass from no option (llvm#118254)
test-extract-fixed-outer-loops
pass always crash without anytest-outer-loop-sizes
option. We need to keep the pass from crash by checking the option existence.Fix #61716, #116360