Skip to content
Snippets Groups Projects
Commit 2d9bc751 authored by Wei Chen's avatar Wei Chen Committed by Tianqi Chen
Browse files

Add test to confirm that we forbid allocate statement referencing undefined variable (#1899)

parent fc341e1c
No related branches found
No related tags found
No related merge requests found
from nose.tools import raises
import tvm
@raises(Exception)
def test_loop_dependent_allocate():
N = tvm.var("N")
A = tvm.placeholder((2*N,), "float32", "A")
C = tvm.compute((N, ), lambda i: A[2*i] + A[i+1], name='C')
s = tvm.create_schedule(C.op)
AA = s.cache_read(A, "local", [C])
s[AA].compute_at(s[C], s[C].op.axis[0])
# this line should fail due to IRUseDefAnalysis sees an allocate statement
# referencing undefined variable
tvm.lower(s, [A,C])
if __name__ == "__main__":
test_loop_dependent_allocate()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment