Skip to content

Commit

Permalink
Maintain fractional millisecond precision when recording wall time ev…
Browse files Browse the repository at this point in the history
…ents (#1658)

Use fp division instead of integer division to maintain sub-ms
precision. Without this patch, the tutorials fail w/ upstream pytorch on
small shapes because the runtime is less than 1ms and we get a divide by
zero error in processing the timing.

cc #1563
  • Loading branch information
alexbaden authored Jul 19, 2024
1 parent 2e54e2c commit fceb923
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 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() // 1_000_000
self.timestamp = time.time_ns() / 1_000_000

def elapsed_time(self, end):
return end.timestamp - self.timestamp
Expand Down

0 comments on commit fceb923

Please sign in to comment.