tvm_tirx.tirx.transform.AnnotateEntryFunc#
- tvm_tirx.tirx.transform.AnnotateEntryFunc()#
Infer and mark an unambiguous TIRx entry function.
Sets
tirx.is_entry_funcwhen the module contains only one function and it is TIRx, or when exactly one function is externally exposed and it is a TIRx function.- Returns:
fpass (tvm_tirx.ir.transform.Pass) – The result pass
Examples
import tvm_tirx as tvm from tvm_tirx.script import ir as I, tirx as T from tvm_tirx.tirx import transform as tr @I.ir_module class Before: @T.function(private=True) def main(): pass @I.ir_module class Expected: @T.function(private=True) def main(): T.func_attr({"tirx.is_entry_func": True}) def run_pass(): return tr.AnnotateEntryFunc()(Before) tvm.ir.assert_structural_equal(run_pass(), Expected)