Skip to content

Commit

Permalink
[ARITH] fix zero iter bug in arith (apache#8494)
Browse files Browse the repository at this point in the history
* fix

* black
  • Loading branch information
spectrometerHBH authored Jul 18, 2021
1 parent d3db5d6 commit 1534983
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/arith/iter_affine_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,6 @@ class IterMapRewriter : public ExprMutator {
*/
Optional<IterSplitExpr> TryFuseIters(IterSumExpr expr) {
if (!is_zero(expr->base)) return NullOpt;
if (expr->args.size() == 1) return expr->args[0];
// select the iterators in order
std::vector<bool> visited(expr->args.size(), false);
std::vector<IterSplitExpr> flattened_iters, grouped_iters;
Expand Down
9 changes: 9 additions & 0 deletions tests/python/unittest/test_arith_iter_affine_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,15 @@ def test_predicate():
)
assert len(res) == 0

# zero iter
xo = tvm.tir.Var("xo", "int32"), 1
xi = tvm.tir.Var("xi", "int32"), 129
y = tvm.tir.Var("y", "int32"), 128

res = tvm.arith.detect_iter_map(
[xo[0] * 129 + xi[0], y[0]], var_dom([xo, xi, y]), xo[0] * 129 + xi[0] < 128
)


def convert_division(divisions):
if divisions is None or len(divisions) == 0:
Expand Down

0 comments on commit 1534983

Please sign in to comment.