[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
This commit is contained in:
Vincent Zhao 2020-07-26 20:10:07 +05:30 committed by Uday Bondhugula
parent d35e2c101d
commit d135744c34
2 changed files with 17 additions and 3 deletions

View File

@ -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();
}

View File

@ -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@+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
}