tilelang.utils.pass_timing¶

Per-pass timing instrumentation 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.

Attributes¶

Classes¶

PassTimingRecord

Single completed pass execution record.

TileLangPassTimingInstrument

Per-pass timing instrument for tilelang compilation pipelines.

Functions¶

build_pass_instruments(base_instruments, threshold_ms)

Build instruments with timing first so later after-pass callbacks are excluded.

report_pass_timing_on_exit(timing_instrument, context)

Emit a timing report after PassContext exits, including on failure.

Module Contents¶

tilelang.utils.pass_timing.logger¶
class tilelang.utils.pass_timing.PassTimingRecord¶

Single completed pass execution record.

name: str¶
duration_s: float¶
depth: int¶
self_duration_s: float = 0.0¶
sequence: int = 0¶
class tilelang.utils.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)

tilelang.utils.pass_timing.build_pass_instruments(base_instruments, threshold_ms)¶

Build instruments with timing first so later after-pass callbacks are excluded.

Parameters:
  • base_instruments (collections.abc.Sequence[object])

  • threshold_ms (float | None)

Return type:

tuple[list[object], TileLangPassTimingInstrument | None]

tilelang.utils.pass_timing.report_pass_timing_on_exit(timing_instrument, context)¶

Emit a timing report after PassContext exits, including on failure.

Parameters:
Return type:

collections.abc.Iterator[None]