mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Add compile_id: Optional[CompileID] to torch._logging._internal.trace_structured_artifact (#160440)
Context:
When writing a custom `torch.compile` backend, I quite frequently (ab)use `trace_structured_artifact` because I'm too lazy to customize tlparse (ref: 6d8b13c867).
I recently notice some of the artifacts I want to store are generated where CompileID cannot be correlated and `tlparse` html says
> Sometimes, logs are made without a compile id. This makes it difficult to correlate related logs. This stack trie shows all places where log entries occurred without compile context; to fix, look an appropriate place in the stack where compile id should have been specified.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160440
Approved by: https://github.com/ezyang
This commit is contained in:
parent
199e9abb6a
commit
e497620260
|
|
@ -1289,6 +1289,7 @@ def trace_structured_artifact(
|
||||||
name: str, # this will go in metadata
|
name: str, # this will go in metadata
|
||||||
encoding: str,
|
encoding: str,
|
||||||
payload_fn: Callable[[], Optional[Union[str, object]]] = lambda: None,
|
payload_fn: Callable[[], Optional[Union[str, object]]] = lambda: None,
|
||||||
|
compile_id: Optional[CompileId] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
trace_structured(
|
trace_structured(
|
||||||
"artifact",
|
"artifact",
|
||||||
|
|
@ -1297,6 +1298,7 @@ def trace_structured_artifact(
|
||||||
"encoding": encoding,
|
"encoding": encoding,
|
||||||
},
|
},
|
||||||
payload_fn=payload_fn,
|
payload_fn=payload_fn,
|
||||||
|
compile_id=compile_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user