Skip to content

Added basic logging for torch.compile #29443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

def cached_model_name(model_hash_str, device, args, cache_root, reversed = False):
if model_hash_str is None:
Expand Down Expand Up @@ -138,4 +137,6 @@ def openvino_compile(gm: GraphModule, *args, model_hash_str: str = None, options
config["CACHE_DIR"] = cache_root

compiled = core.compile_model(om, device, config)
logger.debug(f"OpenVINO graph compile successful on device {device}")

return compiled
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)


DEFAULT_OPENVINO_PYTHON_CONFIG = MappingProxyType(
Expand Down Expand Up @@ -128,8 +127,9 @@ def __call__(self, *args):

try:
result = openvino_execute(self.gm, *args, executor_parameters=self.executor_parameters, partition_id=self.partition_id, options=self.options)
except Exception:
logger.debug("OpenVINO execution failed. Falling back to native PyTorch execution.")
logger.debug("OpenVINO graph execution successful")
except Exception as e:
logger.debug(f"OpenVINO execution failed with {e}. Falling back to native PyTorch execution.")
self.perm_fallback = True
return self.gm(*args)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)


class PatternNode:
Expand Down Expand Up @@ -133,6 +132,7 @@ def capture_nncf_patterns(self, graph_module: GraphModule):
self.supported_ops.enable_by_name(pattern_op)

def make_partitions(self, graph_module: GraphModule, options) -> GraphModule:
logger.debug(f"Graph module before partitioning {graph_module}")
allow_single_node_partition = _is_testing(options)
self.capture_gptq_patterns(graph_module)
self.capture_nncf_patterns(graph_module)
Expand All @@ -141,5 +141,6 @@ def make_partitions(self, graph_module: GraphModule, options) -> GraphModule:
partitions = partitioner.propose_partitions()
self.add_get_attr_inputs(partitions)
fused_graph_module = partitioner.fuse_partitions(partitions)
logger.debug(f"Graph module after partitioning {fused_graph_module}")

return fused_graph_module
Loading