tvm_tirx.ir.transform.PrintIR

Contents

tvm_tirx.ir.transform.PrintIR#

tvm_tirx.ir.transform.PrintIR(header='')#

Log the header and module IR, returning the module unchanged.

Parameters:

header (str) – The header to be displayed along with the dump.

Returns:

fpass (Pass) – A module pass with optimization level zero.

Examples

The observation pass returns the module unchanged.

import tvm_tirx as tvm
from tvm_tirx.script import ir as I, tirx as T

@I.ir_module
class Before:
    @T.function(private=True)
    def main():
        T.evaluate(0)

@I.ir_module
class Expected:
    @T.function(private=True)
    def main():
        T.evaluate(0)

def run_pass():
    return tvm.ir.transform.PrintIR("before lowering")(Before)

tvm.ir.assert_structural_equal(run_pass(), Expected)