-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[dynamo] Store CompilationEvents in a buffer in torch._dynamo.utils #115788
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
[dynamo] Store CompilationEvents in a buffer in torch._dynamo.utils #115788
Conversation
Motivation: for testing in dynamo, it would be nice to have an equivalent to torch._inductor.metrics. We already have log_compilation_event, but that only prints logs or dumps to a database (in fbcode); these aren't appropriate for unit tests. This change: adds torch._dynamo.metrics, and then changes convert_frame so that it calls torch._dynamo.metrics.record_compilation_metrics instead. To prevent a super large list from forming, use a deque with a max length; then if the max length is exceeded, the oldest records will be dropped. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/115788
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit a3a2b1e with merge base 87ea6fb ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…ics" Motivation: for testing in dynamo, it would be nice to have an equivalent to torch._inductor.metrics. We already have log_compilation_event, but that only prints logs or dumps to a database (in fbcode); these aren't appropriate for unit tests. This change: adds torch._dynamo.metrics, and then changes convert_frame so that it calls torch._dynamo.metrics.record_compilation_metrics instead. To prevent a super large list from forming, use a deque with a max length; then if the max length is exceeded, the oldest records will be dropped. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
…ics" Motivation: it would be nice to be able to test using the metrics in log_compilation_event; currently dumps logs (or logs to a database in fbcode) - these are hard to use in unit tests. This change: * always record the information in torch._dynamo.utils.record_compilation_metrics; here, log into a limited-size deque to prevent the list of metrics from getting too long * if config.log_compilation_metrics, then call back into the original log_compilation_event function cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
|
@yanboliang should we test compile time on this to make sure nothing regresses or do you think it should be safe? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to run benchmark against this change, though I think it's low risk.
…amo.utils" Motivation: it would be nice to be able to test using the metrics in log_compilation_event; currently dumps logs (or logs to a database in fbcode) - these are hard to use in unit tests. This change: * always record the information in torch._dynamo.utils.record_compilation_metrics; here, log into a limited-size deque to prevent the list of metrics from getting too long * if config.log_compilation_metrics, then call back into the original log_compilation_event function cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
Motivation: for testing in dynamo, it would be nice to have an equivalent to torch._inductor.metrics. We already have log_compilation_event, but that only prints logs or dumps to a database (in fbcode); these aren't appropriate for unit tests. This change: adds torch._dynamo.metrics, and then changes convert_frame so that it calls torch._dynamo.metrics.record_compilation_metrics instead. To prevent a super large list from forming, use a deque with a max length; then if the max length is exceeded, the oldest records will be dropped. ghstack-source-id: ea76a5b Pull Request resolved: #115788
…amo.utils" Motivation: it would be nice to be able to test using the metrics in log_compilation_event; currently dumps logs (or logs to a database in fbcode) - these are hard to use in unit tests. This change: * always record the information in torch._dynamo.utils.record_compilation_metrics; here, log into a limited-size deque to prevent the list of metrics from getting too long * if config.log_compilation_metrics, then call back into the original log_compilation_event function cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
Motivation: for testing in dynamo, it would be nice to have an equivalent to torch._inductor.metrics. We already have log_compilation_event, but that only prints logs or dumps to a database (in fbcode); these aren't appropriate for unit tests. This change: adds torch._dynamo.metrics, and then changes convert_frame so that it calls torch._dynamo.metrics.record_compilation_metrics instead. To prevent a super large list from forming, use a deque with a max length; then if the max length is exceeded, the oldest records will be dropped. ghstack-source-id: d124c19 Pull Request resolved: #115788
|
Compile times did not change except for when models didn't run. I'm assuming these models didn't run for some other reason, because they weren't even attempted (no logs), and the CI on the PR isn't failing. |
…amo.utils" Motivation: it would be nice to be able to test using the metrics in log_compilation_event; currently dumps logs (or logs to a database in fbcode) - these are hard to use in unit tests. This change: * always record the information in torch._dynamo.utils.record_compilation_metrics; here, log into a limited-size deque to prevent the list of metrics from getting too long * if config.log_compilation_metrics, then call back into the original log_compilation_event function cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: Motivation: it would be nice to be able to test using the metrics in log_compilation_event; currently dumps logs (or logs to a database in fbcode) - these are hard to use in unit tests. This change: * always record the information in torch._dynamo.utils.record_compilation_metrics; here, log into a limited-size deque to prevent the list of metrics from getting too long * if config.log_compilation_metrics, then call back into the original log_compilation_event function X-link: pytorch/pytorch#115788 Approved by: https://github.com/yanboliang Reviewed By: jeanschmidt Differential Revision: D52298053 Pulled By: davidberard98 fbshipit-source-id: ef291255d6148c0479f3000b4fb21a4ed72cadcb
…ytorch#115788) Motivation: it would be nice to be able to test using the metrics in log_compilation_event; currently dumps logs (or logs to a database in fbcode) - these are hard to use in unit tests. This change: * always record the information in torch._dynamo.utils.record_compilation_metrics; here, log into a limited-size deque to prevent the list of metrics from getting too long * if config.log_compilation_metrics, then call back into the original log_compilation_event function Pull Request resolved: pytorch#115788 Approved by: https://github.com/yanboliang
Stack from ghstack (oldest at bottom):
Motivation: it would be nice to be able to test using the metrics in log_compilation_event; currently dumps logs (or logs to a database in fbcode) - these are hard to use in unit tests.
This change:
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov @kadeng