stormlog.infer.trace_ranges

Name iteration ranges so a trace importer can link GPU work to iterations.

An engine wraps the CPU code that launches one iteration’s GPU work in a profiler range named stormlog.iteration/<producer_id>/<iteration_id>. CUPTI ties every kernel, copy, and memset to the CPU call that launched it, and that call sits inside the range on the same thread. A trace importer can therefore link GPU work to an iteration without comparing GPU and CPU clocks.

Functions

iteration_range(producer_id, iteration_id, *)

Mark one iteration's launches for PyTorch profiler and, optionally, NVTX.

iteration_range_name(producer_id, iteration_id)

Return the range name for one iteration of one producer.

parse_iteration_range(name)

Return the iteration a range name refers to, or None for other ranges.

stormlog.infer.trace_ranges.iteration_range(producer_id, iteration_id, *, nvtx=False)[source]

Mark one iteration’s launches for PyTorch profiler and, optionally, NVTX.

Without PyTorch the range is a no-op. record_function costs little when no profiler is active. NVTX ranges are opt-in because they are always emitted, profiler or not.

Parameters:
  • producer_id (str)

  • iteration_id (str)

  • nvtx (bool)

Return type:

Iterator[None]

stormlog.infer.trace_ranges.iteration_range_name(producer_id, iteration_id)[source]

Return the range name for one iteration of one producer.

Parameters:
  • producer_id (str)

  • iteration_id (str)

Return type:

str

stormlog.infer.trace_ranges.parse_iteration_range(name)[source]

Return the iteration a range name refers to, or None for other ranges.

Parameters:

name (str)

Return type:

EntityRef | None