[PyTorch] Use plain old function pointer for RecordFunctionCallback#48629
[PyTorch] Use plain old function pointer for RecordFunctionCallback#48629swolchok wants to merge 5 commits intogh/swolchok/25/basefrom
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:
|
…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.
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