-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[PyTorch] Use plain old function pointer for RecordFunctionCallback #48629
Conversation
Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) [ghstack-poisoned]
Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) ghstack-source-id: 117508738 Pull Request resolved: #48629
💊 CI failures summary and remediationsAs of commit 74229e0 (more details on the Dr. CI page):
🕵️ 15 new failures recognized by patternsThe following CI failures do not appear to be due to upstream breakages: pytorch_linux_bionic_py3_8_gcc9_coverage_build (1/15)Step: "Build" (full log | diagnosis details | 🔁 rerun)
|
…nCallback" Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) [ghstack-poisoned]
Pull Request resolved: #48629 Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. ghstack-source-id: 117893077 Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D25135415/)!
if (rfcb.end()) { | ||
rfcb.end()(rf, ctx.get()); | ||
} |
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.
Is there a need to cache the return value from rfcb.end()
to prevent a race condition where the value may change in between or will that not happen by construction?
It would be good to know benchmarking results of before and after. |
Overall looks good to me. I assume that the loss of convenience (when testing) and the reliance on global/statics is something that is acceptable to everyone for the reduction in object size. I've left some comments on https://www.internalfb.com/diff/D25135415 for one of the fb-specific tests. Is there a benchmark result for pre/post this change? |
…nCallback" Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) [ghstack-poisoned]
Pull Request resolved: #48629 Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. ghstack-source-id: 118145423 Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D25135415/)!
@kimishpatel The benchmark results are in the test plan in the FB specific diff. |
…nCallback" Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) [ghstack-poisoned]
Pull Request resolved: #48629 Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. ghstack-source-id: 118226115 Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D25135415/)!
…nCallback" Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) [ghstack-poisoned]
Pull Request resolved: #48629 Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. ghstack-source-id: 118568240 Differential Revision: [D25135415](https://our.internmc.facebook.com/intern/diff/D25135415/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D25135415/)!
Unlanding. This appears to have broken numerous builds. Note that the Github CI also shows numerous failures. Example snippet:
|
This pull request has been reverted by 25bc906. |
This pull request has been merged in 7e23ee1. |
@swolchok why this change was landed when it clearly introduced 15 new build failures? |
I've been trying to land it for a while, and I'm fairly sure I saw a clean CI run previously. Must have come in during rebasing. In particular, I would expect internal tests to have caught test_misc.cpp breaks and I'm confused that they didn't. |
Looks like the test_misc changes in particular may have failed because of a difference between C++14 and C++17. |
…reapply) (#49408) Summary: Pull Request resolved: #49408 Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. ghstack-source-id: 118665808 Test Plan: Wait for GitHub CI since we had C++14-specific issues with this one in previous PR #48629 Reviewed By: malfet Differential Revision: D25563207 fbshipit-source-id: 6a2831205917d465f8248ca37429ba2428d5626d
…reapply) (pytorch#49408) Summary: Pull Request resolved: pytorch#49408 Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback. ghstack-source-id: 118665808 Test Plan: Wait for GitHub CI since we had C++14-specific issues with this one in previous PR pytorch#48629 Reviewed By: malfet Differential Revision: D25563207 fbshipit-source-id: 6a2831205917d465f8248ca37429ba2428d5626d
Stack from ghstack:
Nearly every non-test callsite doesn't need to capture any variables anyway, and this saves 48 bytes per callback.
Differential Revision: D25135415