test_pass_inline.py 621 Bytes
Newer Older
tqchen committed
1 2 3 4 5
import tvm

def test_inline():
    m = tvm.Var('m')
    A = tvm.placeholder((m,), name='A')
6 7
    T = tvm.compute((m,), lambda i,: A[i] + 10, name='T')
    stmt = tvm.make.Evaluate(T[10] + 11 * T[100])
tqchen committed
8
    stmt = tvm.ir_pass.Inline(
9
        stmt, T.op, [x.var for x in T.op.axis], T.op.body)
tqchen committed
10 11 12
    print(stmt)
    assert(tvm.ir_pass.VerifySSA(stmt))

13 14 15 16
    try:
        # pass in int array(wrong argument type)
        # must raise an error
        stmt = tvm.ir_pass.Inline(
17
            T.op, [1,2,3], T.op.body, stmt)
18 19 20 21 22 23
        assert False
    except tvm.TVMError:
        pass



tqchen committed
24 25
if __name__ == "__main__":
    test_inline()