Add verbose logging for OpenVINO torch.compile backend #33477
+4
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, developers using torch.compile with the OpenVINO backend lack visibility into whether the model is running on OpenVINO or falling back to native PyTorch. Even with debug logging enabled, the backend suppresses logs by overriding the log level, making debugging difficult. This PR addresses Issue #33116.
Changes
Allow User-Configured Logging: Removed logger.setLevel(logging.WARNING) in src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend.py. This ensures that the logger respects the logging level set by the user (e.g., via logging.basicConfig(level=logging.DEBUG)), allowing verbose logs to appear.
Visibility of Subgraphs: Added logger.info to print the subgraph being compiled ("OpenVINO backend is called with subgraph: ..."). This helps users identify exactly what is being offloaded to OpenVINO.
Success Confirmation: Added a log message "Subgraph successfully compiled with OpenVINO" to confirm successful compilation.
Explicit Fallback Warning: Upgraded the compilation failure log from DEBUG to WARNING. If OpenVINO fails to compile a subgraph, the user is now explicitly warned that execution is falling back to the default backend (Native PyTorch).
Verification
Verified that enabling debug logging now correctly outputs the added INFO logs showing the subgraph.
Verified that exceptions during compilation trigger a visible WARNING log indicating the fallback.
Ensured that standard execution flows remain unaffected.*
Closes #33116