[Mlir-commits] [mlir] d135744 - [MLIR][Affine] Add test for non-hyperrectangular loop tiling

Uday Bondhugula llvmlistbot at llvm.org
Sun Jul 26 07:48:03 PDT 2020


Author: Vincent Zhao
Date: 2020-07-26T20:17:23+05:30
New Revision: d135744c34dc7a6315f1d2d65a969a2791a97534

URL: https://github.com/llvm/llvm-project/commit/d135744c34dc7a6315f1d2d65a969a2791a97534
DIFF: https://github.com/llvm/llvm-project/commit/d135744c34dc7a6315f1d2d65a969a2791a97534.diff

LOG: [MLIR][Affine] Add test for non-hyperrectangular loop tiling

This diff provides a concrete test case for the error that will be raised when the iteration space is non hyper-rectangular.

The corresponding emission method for this error message has been changed as well.

Differential Revision: https://reviews.llvm.org/D84531

Added: 
    mlir/test/Dialect/Affine/loop-tiling-unsupported.mlir

Modified: 
    mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
index ddb00bdd8f0e..d9b2b6ac3043 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
@@ -218,9 +218,8 @@ mlir::tilePerfectlyNested(MutableArrayRef<AffineForOp> input,
   FlatAffineConstraints cst;
   getIndexSet(input, &cst);
   if (!cst.isHyperRectangular(0, width)) {
-    llvm::dbgs() << "tiled code generation unimplemented for the "
-                    "non-hyperrectangular case, op:"
-                 << *rootAffineForOp << "\n";
+    rootAffineForOp.emitError("tiled code generation unimplemented for the "
+                              "non-hyperrectangular case");
     return failure();
   }
 

diff  --git a/mlir/test/Dialect/Affine/loop-tiling-unsupported.mlir b/mlir/test/Dialect/Affine/loop-tiling-unsupported.mlir
new file mode 100644
index 000000000000..cb558848b21c
--- /dev/null
+++ b/mlir/test/Dialect/Affine/loop-tiling-unsupported.mlir
@@ -0,0 +1,15 @@
+// RUN: mlir-opt %s -affine-loop-tile="tile-size=32" -split-input-file -verify-diagnostics
+
+// -----
+
+#ub = affine_map<(d0)[s0] -> (d0, s0)>
+func @non_hyperrect_loop() {
+  %N = constant 128 : index
+  // expected-error at +1 {{tiled code generation unimplemented for the non-hyperrectangular case}}
+  affine.for %i = 0 to %N {
+    affine.for %j = 0 to min #ub(%i)[%N] {
+      affine.yield
+    }
+  }
+  return
+}


        


More information about the Mlir-commits mailing list