Skip to content

Commit

Permalink
Fix do_bench (#1567)
Browse files Browse the repository at this point in the history
Fixes #1563

Signed-off-by: Whitney Tsang <whitney.tsang@intel.com>
  • Loading branch information
whitneywhtsang authored Jul 6, 2024
1 parent b47149a commit e721be7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/triton/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, **kwargs):
self.record()

def record(self):
self.timestamp = time.time_ns()
self.timestamp = time.time_ns() // 1_000_000

def elapsed_time(self, end):
return end.timestamp - self.timestamp
Expand Down Expand Up @@ -155,8 +155,11 @@ def do_bench(fn, warmup=25, rep=100, grad_to_none=None, quantiles=None, fast_flu
for _ in range(5):
cache.zero_()
fn()
if USE_WALL_TIME:
synchronize()
end_event.record()
synchronize()
if not USE_WALL_TIME:
synchronize()
estimate_ms = start_event.elapsed_time(end_event) / 5

# compute number of warmup and repeat
Expand Down

0 comments on commit e721be7

Please sign in to comment.