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

Function test_simple_module

tests/python/relax/test_tvmscript_parser.py:193–219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

191
192
193def test_simple_module():
194 @I.ir_module(s_tir=True)
195 class TestModule:
196 @T.prim_func(private=True, s_tir=True)
197 def tir_func(
198 x: T.Buffer((T.int64(128), T.int64(128)), "float32"),
199 y: T.Buffer((T.int64(128), T.int64(128)), "float32"),
200 ):
201 T.func_attr({"tirx.noalias": True})
202 for i, j in T.grid(T.int64(128), T.int64(128)):
203 with T.sblock():
204 vi, vj = T.axis.remap("SS", [i, j])
205 y[vi, vj] = x[vi, vj] + 1.0
206
207 @R.function
208 def foo(x: R.Tensor((128, 128), "float32")) -> R.Tensor((128, 128), "float32"):
209 cls = TestModule
210 gv0 = R.call_tir(cls.tir_func, x, R.Tensor((128, 128), dtype="float32"))
211 return gv0
212
213 x = relax.Var("x", R.Tensor((128, 128), "float32"))
214 bb = relax.BlockBuilder()
215 with bb.function("foo", (x,), {"global_symbol": "foo"}):
216 out = bb.emit_te(lambda x: x + 1, x, primfunc_name_hint="tir_func")
217 bb.emit_func_output(out)
218
219 _check(TestModule, bb.get())
220
221
222def test_emit_te_primfunc_attrs():

Callers

nothing calls this directly

Calls 6

functionMethod · 0.95
emit_teMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
TensorMethod · 0.80
_checkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…