triton.testing.do_bench

triton.testing.do_bench(fn, warmup=25, rep=100, grad_to_none=None, quantiles=None, return_mode='mean')

对提供的函数进行运行时基准测试。默认情况下,返回fn的中位运行时间以及第20和第80性能百分位数。

Parameters:
  • fn (Callable) – 要进行基准测试的函数

  • warmup (int) – 预热时间(单位:毫秒)

  • rep (int) – 重复时间(单位为毫秒)

  • grad_to_none (torch.tensor, optional) - 将提供的张量的梯度重置为None

  • quantiles (list[float], optional) – 除中位数外还需返回的性能百分位数。

  • return_mode (str) – 要返回的统计度量。可选值为"min"、"max"、"mean"、"median"或"all"。默认为"mean"。