Skip to content
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: 1 addition & 0 deletions src/arith/iter_affine_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ class IterMapRewriter : public ExprMutator {
ErrorLogger(this) << "IterMapExpr or subclasses should only result from calls in "
<< "IterMapRewriter using DirectMutate. "
<< "Indirect return occurred in " << input_expr;
return input_expr;
}
return expr;
}
Expand Down
20 changes: 20 additions & 0 deletions tests/python/unittest/test_arith_iter_affine_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,5 +1292,25 @@ def test_normalize_to_iter_sum():
)


def test_detect_iter_map_with_bufferload_recursion():
n = tvm.tir.Var("n", "int32")
m = tvm.tir.Var("m", "int32")
divisor = tvm.tir.Var("divisor", "int32")

i = tvm.tir.Var("i", "int32")
j = tvm.tir.Var("j", "int32")

buffer = tvm.tir.decl_buffer((n,), "int32", name="seqlen")

indices = [(buffer[i] + j) // divisor]
iter_vars = {
i: tvm.ir.Range(tvm.tir.const(0, "int32"), n),
j: tvm.ir.Range(tvm.tir.const(0, "int32"), m),
}

result = tvm.arith.detect_iter_map(indices, iter_vars)
assert len(result.indices) == 0


if __name__ == "__main__":
tvm.testing.main()