From fceb923aad0f582ed750d67f39bf34ed67ec07d5 Mon Sep 17 00:00:00 2001 From: Alex Baden Date: Fri, 19 Jul 2024 16:31:20 -0400 Subject: [PATCH] Maintain fractional millisecond precision when recording wall time events (#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 --- python/triton/testing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/triton/testing.py b/python/triton/testing.py index 91d16dbf40..ca19b52657 100644 --- a/python/triton/testing.py +++ b/python/triton/testing.py @@ -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