Skip to content

Conversation

felipemello1
Copy link
Contributor

@felipemello1 felipemello1 commented Oct 9, 2025

t = Tracer()
t.start() # t0
# do_something()
t.step("t1")
# do_something()
t.stop() # t2

When measuring time with tracer, we have to capture the last time t2-t1. I was manually calling t.step("end") internally, during t.stop(), as a way to get this last step between t2-t1. This is used to compute total_time, but it should not be logged as an additional step. To drop it, i would just drop last. The logic was brittle, since when doing it cuda, we create threads that run async and dont return results in the order they are sent. This PR addresses it by dropping the "sort + drop last" logic. Instead, we create an unique name for this step, pop it from the list, and return it as a number apart.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 9, 2025
@felipemello1 felipemello1 merged commit 5012ccc into meta-pytorch:main Oct 9, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants