Skip to content

Commit

Permalink
add a sync after flush cache when doing benchmark (#2503)
Browse files Browse the repository at this point in the history
I'm doing some benchmarks in pytorch and I find this benchmark always
record the time of flush cache kernel. I want to add a sync in each
iteration before kernel start. Pytorch calls this function here:
https://github.com/pytorch/pytorch/blob/main/torch/_inductor/runtime/benchmarking.py#L176
  • Loading branch information
jianyizh authored Oct 18, 2024
1 parent de5302d commit b4043cf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/triton/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def do_bench(fn, warmup=25, rep=100, grad_to_none=None, quantiles=None, return_m
x.grad = None
# we clear the L2 cache before each run
cache.zero_()
if USE_WALL_TIME:
di.synchronize()
# record time of `fn`
start_event[i].record()
fn()
Expand Down

0 comments on commit b4043cf

Please sign in to comment.