Skip to content

Commit dd6c970

Browse files
added a test that crashes due to allocate using an undefined variable
1 parent 95e0c4a commit dd6c970

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/python/unittest/test_pass_split_host_device.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,21 @@ def test_loop_dependent_allocate():
2929
# referencing undefined variable
3030
tvm.lower(s, [A,C])
3131

32+
def test_loop_dependent_allocate2():
33+
import tvm
34+
m = tvm.convert(12)
35+
l = tvm.convert(6)
36+
A = tvm.placeholder((m, l), name='A')
37+
A1 = tvm.compute((m, l), lambda i, j: A[i, j], name='A1')
38+
A2 = tvm.compute((m, l), lambda i, j: A1[i, j] + 3, name='A2')
39+
s = tvm.create_schedule(A2.op)
40+
41+
fused_axes = s[A2].fuse(A2.op.axis[0], A2.op.axis[1])
42+
xo, xi = s[A2].split(fused_axes, 10)
43+
s[A1].compute_at(s[A2], xo)
44+
45+
print(tvm.lower(s, [A, A2]))
46+
3247
if __name__ == "__main__":
3348
test_loop_dependent_allocate()
49+
test_loop_dependent_allocate2()

0 commit comments

Comments
 (0)