Update troubleshooting.rst (#105018)
Update with `TORCH_LOGS` information
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105018
Approved by: https://github.com/mlazos
diff --git a/docs/source/compile/troubleshooting.rst b/docs/source/compile/troubleshooting.rst
index bd13f13..486c3c7 100644
--- a/docs/source/compile/troubleshooting.rst
+++ b/docs/source/compile/troubleshooting.rst
@@ -28,11 +28,11 @@
- Usage
* - Info logging
- View summarized steps of compilation
- - ``torch._logging.set_logs(dynamo = logging.INFO)``
+ - ``torch._logging.set_logs(dynamo = logging.INFO)`` or ``TORCH_LOGS="dynamo"``
* - Debug logging
- View detailed steps of compilation (print every instruction traced)
- ``torch._logging.set_logs(dynamo = logging.DEBUG)`` and
- ``torch._dynamo.config.verbose = True``
+ ``torch._dynamo.config.verbose = True``, or ``TORCH_LOGS="+dynamo" TORCHDYNAMO_VERBOSE=1``
* - Minifier for any backend
- Find smallest subgraph which reproduces errors for any backend
- set environment variable ``TORCHDYNAMO_REPRO_AFTER="dynamo"``
@@ -71,6 +71,9 @@
- set the environment variable TORCH_COMPILE_DEBUG=1 or
``torch._inductor.config.trace.enabled = True``
+In addition to info and debug logging, you can use `torch._logging <https://pytorch.org/docs/main/logging.html>`__
+for more fine-grained logging.
+
Diagnosing Runtime Errors
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -83,7 +86,7 @@
the stack and will provide full stack traces.
You may use info logging
-(``torch._logging.set_logs(dynamo = logging.INFO)``) and look for
+(``torch._logging.set_logs(dynamo = logging.INFO)`` or ``TORCH_LOGS="dynamo"``) and look for
``Step #: ...`` outputs in order to determine in which component the
error has occurred. Logs are made at the beginning and end of each step,
so the step that an error should correspond to is the most recent logged
@@ -735,4 +738,5 @@
- A log (set ``torch._dynamo.config.log_file`` to a valid file name to
dump the logs to a file and
``torch._logging.set_logs(dynamo = logging.DEBUG)`` and
- ``torch._dynamo.config.verbose = True``)
+ ``torch._dynamo.config.verbose = True``), or
+ ``TORCH_LOGS="+dynamo" TORCHDYNAMO_VERBOSE=1``