Commit Graph

16 Commits

Author SHA1 Message Date
spectrometerHBH
5ee46afc05 perf hint logging in inductor (#102250)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102250
Approved by: https://github.com/Skylion007, https://github.com/shunting314, https://github.com/jansel
2023-05-27 03:43:30 +00:00
Edward Z. Yang
e7a6818e97 Register top level logger for torch (#102090)
This enables use of artifact logging in modules that aren't under
the modules that were specified here.

Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102090
Approved by: https://github.com/Skylion007, https://github.com/mlazos
2023-05-23 21:24:21 +00:00
Aaron Gokaslan
dfe484a3b3 [BE]: Bugfix functorch and some generic typing improvements (#101337)
Fixes some typing bugs found with newer versions of mypy

Pull Request resolved: https://github.com/pytorch/pytorch/pull/101337
Approved by: https://github.com/ezyang
2023-05-14 14:20:56 +00:00
lezcano
f6c2859ee3 Print the path to the code with TORCH_LOGS=output_code (#99038)
This is quite useful to play around with the code once it's been generated.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99038
Approved by: https://github.com/mlazos
2023-05-13 16:20:57 +00:00
Michael Lazos
f73973d789 Expose function to retrieve list of registered loggers (#100776)
Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100776
Approved by: https://github.com/ezyang
2023-05-06 04:22:28 +00:00
Michael Lazos
850556ed6e Add "all" option to logging (#100664)
Adds the long-promised "all" option to logging.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100664
Approved by: https://github.com/lezcano
2023-05-06 01:11:18 +00:00
Michael Lazos
c525440ba3 Logging documentation updates (#100595)
Updated the logging.rst with info about the env var.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100595
Approved by: https://github.com/msaroufim, https://github.com/lezcano
2023-05-04 21:54:02 +00:00
Bert Maher
e0bf51d3bf [dynamo] Add ddp_graphs artifact (#100021)
I want to be able to decouple DDP graph printing from the rest of
dynamo DEBUG-level logging, since frequently these logs are particularly
enlightening.

Differential Revision: [D45290919](https://our.internmc.facebook.com/intern/diff/D45290919/)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100021
Approved by: https://github.com/wconstab, https://github.com/mlazos
2023-04-27 03:53:23 +00:00
Kurt Mohler
1e8cf6ad7f Add documentation for torch._logging.set_logs (#99219)
Part of #98871

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99219
Approved by: https://github.com/mlazos, https://github.com/lezcano
2023-04-24 08:06:57 +00:00
Michael Lazos
a6a90eaf28 Remove unnecessary check when logging artifacts (#99260)
Removes a check which would sometimes allow `off_by_default` artifacts to be logged if logged at a higher level.

This change will only allow artifact messages to be displayed if the artifact is enabled, regardless of level.

closes #99144
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99260
Approved by: https://github.com/lezcano
2023-04-17 20:47:25 +00:00
Michael Lazos
3a400a5adc Enable passing a dict of module names: log level to set_logs python api (#98989)
Adds "module" kwarg to set_logs to allow a user to pass a dict of module qualified names to log level to the API.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98989
Approved by: https://github.com/ezyang
2023-04-13 09:42:32 +00:00
Michael Lazos
f55e72c0f6 Add option to log recomps (#98564)
Adds an option to TORCH_LOGS to log recompilations

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98564
Approved by: https://github.com/ezyang, https://github.com/voznesenskym
2023-04-07 17:30:27 +00:00
Michael Lazos
c37ab85d96 Improve TORCH_LOGS settings error msg (#97264)
Lists registered loggable entities if an invalid settings string is passed via TORCH_LOGS
[before](https://gist.github.com/mlazos/91fcbc3d577f874bcb3daea44f8b41f2)
[after](https://gist.github.com/mlazos/815ea9e76aca665602228f960e0eb0d6)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97264
Approved by: https://github.com/ezyang, https://github.com/jansel
2023-03-22 13:26:53 +00:00
Horace He
e49b4d3827 Changed logging in aotautograd a little (#97289)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97289
Approved by: https://github.com/mlazos
2023-03-22 09:33:30 +00:00
Edward Z. Yang
ec3894ec0a Fix typo in settings regex logging (#97245)
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97245
Approved by: https://github.com/jansel, https://github.com/mlazos
2023-03-21 19:02:04 +00:00
Michael Lazos
a1c46e5f8f component-level configurable logging for dynamo, inductor, aot (#94858)
Summary:

Adds NNC-like logging that is configured through an env var `TORCH_COMPILE_LOGS`
Examples:
`TORCH_LOGS="dynamo,guards" python script.py` - prints dynamo logs at level INFO with guards of all functions that are compiled

`TORCH_LOGS="+dynamo,guards,graph" python script.py` - prints dynamo logs at level DEBUG with guards and graphs (in tabular) format of all graphs that are compiled

[More examples with full output](https://gist.github.com/mlazos/b17f474457308ce15e88c91721ac1cce)

Implementation:
The implementation parses the log settings from the environment, finds any components (aot, dynamo, inductor) or other loggable objects (guards, graph, etc.) and generates a log_state object. This object contains all of the enabled artifacts, and a qualified log name -> level mapping. _init_logs then adds handlers to the highest level logs (the registered logs), and sets any artifact loggers to level DEBUG if the artifact is enabled.

Note: set_logs is an alternative for manipulating the log_state, but if the environment contains TORCH_LOGS, the environment settings will be prioritized.

Adding a new log:
To add a new log, a dev should add their log name to torch._logging._registrations (there are examples there already).

Adding a new artifact:
To add a new artifact, a dev should add their artifact name to torch._logging._registrations as well.
Additionally, wherever the artifact is logged, `torch._logging.getArtifactLogger(__name__, <artifact_name>)` should be used instead of the standard logging implementation.

[design doc](https://docs.google.com/document/d/1ZRfTWKa8eaPq1AxaiHrq4ASTPouzzlPiuquSBEJYwS8/edit#)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94858
Approved by: https://github.com/ezyang
2023-03-18 04:17:31 +00:00