tvm_tirx.ir.transform.instrument.PassTimingInstrument

tvm_tirx.ir.transform.instrument.PassTimingInstrument#

class tvm_tirx.ir.transform.instrument.PassTimingInstrument#

Bases: PassInstrument

Measure time spent in passes without changing their IR.

Install in PassContext(instruments=[PassTimingInstrument()]) and call render() inside that context to read the accumulated profile.

static render()#

Retrieve the rendered pass timing profile.

Returns:

string (string) – The rendered string result of time profiles

Examples

timing_inst = PassTimingInstrument()
with tvm_tirx.ir.transform.PassContext(instruments=[timing_inst]):
    mod = tvm_tirx.tirx.transform.StmtSimplify()(mod)
    # before exiting the context, get profile results.
    profiles = timing_inst.render()