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

Function test_inline_prim_func

tests/python/relax/test_analysis_well_formed.py:406–439  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

404
405
406def test_inline_prim_func():
407 # Error: inline prim_func is disallowed in Relax IR
408 x = rx.Var("x", R.Tensor([], "int32"))
409 y = rx.Var("y", R.Tensor([], "int32"))
410 new_func = rx.Function(
411 [],
412 rx.SeqExpr(
413 [
414 rx.BindingBlock(
415 [
416 rx.VarBinding(
417 var=x,
418 value=tirx.PrimFunc([], tirx.Evaluate(0)),
419 ),
420 rx.VarBinding(
421 var=y,
422 value=rx.Call(
423 op=tvm.ir.Op.get("relax.call_tir"),
424 args=[
425 rx.GlobalVar("GlobalVar0"),
426 rx.Tuple([x, tirx.PrimFunc([], tirx.Evaluate(0))]),
427 rx.ShapeExpr([]),
428 ],
429 ),
430 ),
431 ]
432 )
433 ],
434 y,
435 ),
436 R.Tensor(ndim=0, dtype="int32"),
437 ).with_attr("global_symbol", "foo")
438 new_mod = tvm.IRModule.from_expr(new_func)
439 assert not rx.analysis.check_well_formed(new_mod, check_struct_info=False)
440
441
442def test_ANF():

Callers

nothing calls this directly

Calls 5

TensorMethod · 0.80
FunctionMethod · 0.80
from_exprMethod · 0.80
with_attrMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…