triton.testing.do_bench

triton.testing.do_bench(fn, warmup=25, rep=100, grad_to_none=None, percentiles=[0.5, 0.2, 0.8], record_clocks=False)

Benchmark the runtime of the provided function. By default, return the median runtime of fn along with the 20-th and 80-th performance percentile.

Parameters
  • fn (Callable) – Function to benchmark

  • warmup (int) – Warmup time (in ms)

  • rep (int) – Repetition time (in ms)

  • grad_to_none (torch.tensor, optional) – Reset the gradient of the provided tensor to None

  • percentiles (list[float]) – Performance percentile to return in addition to the median.