Skip to content

Commit

Permalink
Add structured logging for fx graph cache hash (#127156)
Browse files Browse the repository at this point in the history
Summary:

Add structured logging for fx graph cache hash so that we can debug MAST jobs easily.

Test Plan: ad hoc testing

Differential Revision: D57791537
  • Loading branch information
oulgen authored and facebook-github-bot committed May 25, 2024
1 parent 29a1f62 commit 51ea2b5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions torch/_inductor/codecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,11 +691,19 @@ def compiled_fx_graph_hash(
# The prefix distinguishes among the other kinds of objects we
# cache in this module.
key = "f" + FxGraphCachePickler.get_hash(details)
log.debug(
"FX graph cache hash details for key %s:\n%s",
key,
details.debug_str(),
debug_str = details.debug_str()
log.debug(f"FX graph cache hash details for key {key}:\n{debug_str}")
torch._logging.trace_structured(
"artifact",
metadata_fn=lambda: {
"name": "fx_graph_cache_hash",
"encoding": "json",
},
payload_fn=lambda: json.dumps(
{"key": key, "components": debug_str.split("\n")}
),
)

return key


Expand Down

0 comments on commit 51ea2b5

Please sign in to comment.