Skip to content
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

[ARITH] fix zero iter bug in arith #8494

Merged
merged 2 commits into from
Jul 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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