mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Log compile ids to pt2_remote_cache and pt2_compile_events (#137431)
Log the current compilation id for all relevant samples for these two tables, so we can have a 1:1 analog with dynamo_compile. Differential Revision: [D63900826](https://our.internmc.facebook.com/intern/diff/D63900826/) Pull Request resolved: https://github.com/pytorch/pytorch/pull/137431 Approved by: https://github.com/oulgen
This commit is contained in:
parent
758dbac308
commit
3bf6594d13
2 changed files with 23 additions and 4 deletions
|
|
@ -905,13 +905,20 @@ class ChromiumEventLogger:
|
|||
:param time_ns Timestamp in nanoseconds
|
||||
:param metadata: Any extra metadata associated with this event
|
||||
"""
|
||||
|
||||
# Add compile id to metadata
|
||||
if metadata is None:
|
||||
metadata = {}
|
||||
compile_id = str(torch._guards.CompileContext.current_compile_id())
|
||||
metadata["compile_id"] = compile_id
|
||||
|
||||
event = self._log_timed_event(
|
||||
event_name,
|
||||
time_ns,
|
||||
"B",
|
||||
metadata,
|
||||
)
|
||||
log_chromium_event_internal(event, self.get_stack(), self.id_)
|
||||
log_chromium_event_internal(event, self.get_stack(), compile_id, self.id_)
|
||||
self.get_stack().append(event_name)
|
||||
|
||||
def reset(self) -> None:
|
||||
|
|
@ -935,6 +942,12 @@ class ChromiumEventLogger:
|
|||
:param time_ns: Timestamp in nanoseconds
|
||||
:param metadata: Any extra metadata associated with this event
|
||||
"""
|
||||
# Add compile id to metadata
|
||||
if metadata is None:
|
||||
metadata = {}
|
||||
compile_id = str(torch._guards.CompileContext.current_compile_id())
|
||||
metadata["compile_id"] = compile_id
|
||||
|
||||
# These stack health checks currently never happen,
|
||||
# but they're written this way to future proof any weird event
|
||||
# overlaps in the future.
|
||||
|
|
@ -961,7 +974,7 @@ class ChromiumEventLogger:
|
|||
)
|
||||
stack.pop()
|
||||
|
||||
log_chromium_event_internal(event, stack, self.id_, start_time_ns)
|
||||
log_chromium_event_internal(event, stack, compile_id, self.id_, start_time_ns)
|
||||
# Finally pop the actual event off the stack
|
||||
stack.pop()
|
||||
|
||||
|
|
@ -1006,6 +1019,10 @@ class ChromiumEventLogger:
|
|||
:param Optional[Dict[str, Any]] metadata: Any extra metadata associated with this event
|
||||
:param str cname optional color for the arrow in the trace
|
||||
"""
|
||||
if metadata is None:
|
||||
metadata = {}
|
||||
compile_id = str(torch._guards.CompileContext.current_compile_id())
|
||||
metadata["compile_id"] = compile_id
|
||||
event = {
|
||||
"name": event_name,
|
||||
"ts": time_ns / 1000,
|
||||
|
|
@ -1024,7 +1041,7 @@ class ChromiumEventLogger:
|
|||
expect_trace_id=True,
|
||||
)
|
||||
# Log an instant event with the same start and end time
|
||||
log_chromium_event_internal(event, self.get_stack(), self.id_)
|
||||
log_chromium_event_internal(event, self.get_stack(), compile_id, self.id_)
|
||||
|
||||
|
||||
CHROMIUM_EVENT_LOG: Optional[ChromiumEventLogger] = None
|
||||
|
|
|
|||
|
|
@ -356,5 +356,7 @@ def maybe_upload_prof_stats_to_manifold(profile_path: str) -> Optional[str]:
|
|||
return None
|
||||
|
||||
|
||||
def log_chromium_event_internal(event, stack, logger_uuid, start_timestamp=None):
|
||||
def log_chromium_event_internal(
|
||||
event, stack, compile_id, logger_uuid, start_timestamp=None
|
||||
):
|
||||
return None
|
||||
|
|
|
|||
Loading…
Reference in a new issue