MCPcopy Index your code
hub / github.com/apache/tvm / test_use_def

Function test_use_def

tests/python/relax/test_analysis.py:46–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44
45
46def test_use_def():
47 m = tirx.Var("m", "int64")
48 n = tirx.Var("n", "int64")
49 x = rx.Var("x", R.Tensor([m, n], "float16"))
50 y = rx.Var("y", R.Tensor([n], "float16"))
51 ib = rx.BlockBuilder()
52 with ib.function("func", [x, y]):
53 with ib.dataflow():
54 lv0 = ib.emit(rx.op.add(x, y))
55 lv1 = ib.emit(rx.op.multiply(lv0, y))
56 gv0 = ib.emit_output(lv1)
57 ib.emit_func_output(gv0)
58 dfb = ib.get()["func"].body.blocks[0]
59 udc = udchain(dfb)
60 assert set(udc[x]) == {lv0}
61 assert set(udc[y]) == {lv0, lv1}
62 assert set(udc[lv0]) == {lv1}
63 assert set(udc[lv1]) == {gv0}
64 assert set(udc[gv0]) == set()
65
66
67@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 10

functionMethod · 0.95
dataflowMethod · 0.95
emitMethod · 0.95
emit_outputMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
udchainFunction · 0.90
TensorMethod · 0.80
addMethod · 0.45
multiplyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…