|
3 | 3 | #include <string> |
4 | 4 | #include <torch/csrc/WindowsTorchApiMacro.h> |
5 | 5 |
|
6 | | -// To enable logging please set(export) PYTORCH_JIT_LOG_LEVEL to |
7 | | -// the ordinal value of one of the following logging levels: 1 for GRAPH_DUMP, |
8 | | -// 2 for GRAPH_UPDATE, 3 for GRAPH_DEBUG. |
9 | | -// * Use GRAPH_DUMP for dumping graphs after optimization passes |
10 | | -// * Use GRAPH_UPDATE for reporting graph transformations (i.e. node deletion, |
11 | | -// constant folding, CSE) |
12 | | -// * Use GRAPH_DEBUG to provide information useful for debugging |
| 6 | +// `TorchScript` offers a simple logging facility that can enabled by setting an |
| 7 | +// environment variable `PYTORCH_JIT_LOG_LEVEL`. |
| 8 | + |
| 9 | +// Logging is enabled on a per file basis. To enable logging in |
| 10 | +// `dead_code_elimination.cpp`, `PYTORCH_JIT_LOG_LEVEL` should be |
| 11 | +// set to `dead_code_elimination.cpp` or, simply, to `dead_code_elimination` |
| 12 | +// (i.e. `PYTORCH_JIT_LOG_LEVEL=dead_code_elimination`). |
| 13 | + |
| 14 | +// Multiple files can be logged by separating each file name with a colon `:` as |
| 15 | +// in the following example, |
| 16 | +// `PYTORCH_JIT_LOG_LEVEL=dead_code_elimination:guard_elimination` |
| 17 | + |
| 18 | +// There are 3 logging levels available for your use ordered by the detail level |
| 19 | +// from lowest to highest. |
| 20 | + |
| 21 | +// * `GRAPH_DUMP` should be used for printing entire graphs after optimization |
| 22 | +// passes |
| 23 | +// * `GRAPH_UPDATE` should be used for reporting graph transformations (i.e. |
| 24 | +// node deletion, constant folding, etc) |
| 25 | +// * `GRAPH_DEBUG` should be used for providing information useful for debugging |
13 | 26 | // the internals of a particular optimization pass or analysis |
14 | 27 |
|
| 28 | +// The current logging level is `GRAPH_UPDATE` meaning that both `GRAPH_DUMP` |
| 29 | +// and `GRAPH_UPDATE` will be enabled when |
| 30 | +// one specifies a file(s) in `PYTORCH_JIT_LOG_LEVEL`. |
| 31 | + |
| 32 | +// `GRAPH_DEBUG` can be enabled by prefixing a file name with an `>` as in |
| 33 | +// `>alias_analysis`. |
| 34 | +// `>>` and `>>>` are also valid and **currently** are equivalent to |
| 35 | +// `GRAPH_DEBUG` as there is no logging level that is |
| 36 | +// higher than `GRAPH_DEBUG`. |
| 37 | + |
15 | 38 | namespace torch { |
16 | 39 | namespace jit { |
17 | 40 |
|
|
0 commit comments