Log fx graph cache bypass reasons (#134792)

Summary: Lets track when we bypass and why

Test Plan: unit tests

Differential Revision: D61994739

Pull Request resolved: https://github.com/pytorch/pytorch/pull/134792
Approved by: https://github.com/jamesjwu
This commit is contained in:
Oguz Ulgen
2024-09-01 19:02:09 +00:00
committed by PyTorch MergeBot
parent 1595e755af
commit 2dadc2c8fc
2 changed files with 7 additions and 0 deletions

View File

@ -60,6 +60,7 @@ from torch._inductor.codegen.rocm.compile_command import (
rocm_compile_command,
rocm_compiler,
)
from torch._utils_internal import log_cache_bypass
T = TypeVar("T")
@ -1359,6 +1360,8 @@ class FxGraphCache:
cache_state = "bypass"
log.info("Bypassing FX Graph Cache because '%s'", e)
cache_info["cache_bypass_reason"] = str(e)
if remote:
log_cache_bypass("bypass_fx_graph", str(e))
cache_event_time = time_ns()
if not compiled_graph:
compiled_graph = compile_fx_fn(

View File

@ -132,6 +132,10 @@ def log_trace_structured_event(*args, **kwargs) -> None:
pass
def log_cache_bypass(*args, **kwargs) -> None:
pass
def log_torchscript_usage(api: str, **kwargs):
_ = api
return