tilelang.tools.pass_timing¶

Pass-timing tool for TileLang compilation pipelines.

Records inclusive and self wall-clock duration for each pass using time.monotonic(). Data persists after PassContext exit for post-compilation reporting.

Enabled via TILELANG_PASS_PROFILE=1 env var or PassConfigKey.TL_PASS_PROFILE pass config.

Classes¶

PassTimingRecord

Single completed pass execution record.

TileLangPassTimingInstrument

Per-pass timing instrument for tilelang compilation pipelines.

PassTimingTool

Per-compile owner of timing callbacks and their combined report.

Functions¶

create_pass_timing_tool(pass_configs)

Create the per-compile timing tool when config or environment enables it.

Module Contents¶

class tilelang.tools.pass_timing.PassTimingRecord¶

Single completed pass execution record.

name: str¶
duration_s: float¶
depth: int¶
self_duration_s: float = 0.0¶
sequence: int = 0¶
kernel: str = ''¶
class tilelang.tools.pass_timing.TileLangPassTimingInstrument(threshold_ms=0.0)¶

Per-pass timing instrument for tilelang compilation pipelines.

This is a plain-Python wrapper that creates a TVM PassInstrument internally. Callback state is kept separate so the native instrument does not retain this wrapper.

Parameters:

threshold_ms (float) – Only show passes whose inclusive duration meets this threshold (ms). 0.0 means show all passes.

property instrument¶

The underlying TVM PassInstrument to add to PassContext.

property records: list[PassTimingRecord]¶
Return type:

list[PassTimingRecord]

property total_duration_s: float¶
Return type:

float

report(context=None)¶

Generate a formatted timing report string.

Parameters:

context (str | None)

Return type:

str

print_report(context=None)¶

Print the timing report to the logger.

Parameters:

context (str | None)

class tilelang.tools.pass_timing.PassTimingTool(threshold_ms=0.0)¶

Bases: tilelang.instrumentation.PassInstrumentationTool

Per-compile owner of timing callbacks and their combined report.

Parameters:

threshold_ms (float)

pass_instrument_priority = -100¶
threshold_ms = 0.0¶
create_pass_instrument()¶
Return type:

object

property timings: tuple[TileLangPassTimingInstrument, Ellipsis]¶
Return type:

tuple[TileLangPassTimingInstrument, Ellipsis]

property contexts: tuple[str | None, Ellipsis]¶
Return type:

tuple[str | None, Ellipsis]

property records: list[PassTimingRecord]¶
Return type:

list[PassTimingRecord]

report()¶

Generate one compile report containing one section per PassContext.

Return type:

str

print_report()¶

Print all PassContext timing sections in one logger call.

Return type:

None

finish(error)¶
Parameters:

error (BaseException | None)

Return type:

None

tilelang.tools.pass_timing.create_pass_timing_tool(pass_configs)¶

Create the per-compile timing tool when config or environment enables it.

Parameters:

pass_configs (collections.abc.Mapping[object, object] | None)

Return type:

PassTimingTool | None