move rebuild buckets from end of first iteration to beginning of second iteration#44326
move rebuild buckets from end of first iteration to beginning of second iteration#44326zhaojuanmao wants to merge 5 commits intogh/zhaojuanmao/51/basefrom
Conversation
…nd iteration Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration Differential Revision: [D23583017](https://our.internmc.facebook.com/intern/diff/D23583017/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23583017/)! [ghstack-poisoned]
…nd iteration Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration Differential Revision: [D23583017](https://our.internmc.facebook.com/intern/diff/D23583017/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23583017/)! ghstack-source-id: 111611582 Pull Request resolved: #44326
💊 CI failures summary and remediationsAs of commit 4ea2a11 (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
…ing of second iteration" Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration Differential Revision: [D23583017](https://our.internmc.facebook.com/intern/diff/D23583017/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23583017/)! [ghstack-poisoned]
…nd iteration Pull Request resolved: #44326 Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration ghstack-source-id: 111630708 Differential Revision: [D23583017](https://our.internmc.facebook.com/intern/diff/D23583017/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23583017/)!
…ing of second iteration" Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration Differential Revision: [D23583017](https://our.internmc.facebook.com/intern/diff/D23583017/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23583017/)! [ghstack-poisoned]
…ing of second iteration" Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration Differential Revision: [D23583017](https://our.internmc.facebook.com/intern/diff/D23583017/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23583017/)! [ghstack-poisoned]
…nd iteration Pull Request resolved: #44326 Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration ghstack-source-id: 111790710 Differential Revision: [D23583017](https://our.internmc.facebook.com/intern/diff/D23583017/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23583017/)!
Codecov Report
@@ Coverage Diff @@
## gh/zhaojuanmao/51/base #44326 +/- ##
==========================================================
+ Coverage 68.00% 68.04% +0.04%
==========================================================
Files 384 382 -2
Lines 49599 49468 -131
==========================================================
- Hits 33728 33661 -67
+ Misses 15871 15807 -64
Continue to review full report at Codecov.
|
mrshenli
left a comment
There was a problem hiding this comment.
Would I be correct if assume the motivation is to rebuild buckets after the backward pass, to avoid increasing peak memory consumption?
|
|
||
| def forward(self, *inputs, **kwargs): | ||
| # Calling _rebuild_buckets before forward compuation, | ||
| # It may allocate new buckets before deallocating old buckets |
There was a problem hiding this comment.
It may allocate new buckets before deallocating old buckets
Why? at this point, looks like old buckets are no longer necessary. Is it possible to first delete old buckets and then allocate new buckets?
There was a problem hiding this comment.
grad points to old buckets, we can not simply delete old buckets as users may not want to delete the grads
|
yes, memory usage is low after backward pass and before forward computation, rebuildBuckets right before forward computation can save peak memory usage if we point grad to bucket_views later on |
…ing of second iteration" Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration Differential Revision: [D23583017](https://our.internmc.facebook.com/intern/diff/D23583017/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23583017/)! [ghstack-poisoned]
…nd iteration Pull Request resolved: #44326 Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration ghstack-source-id: 112011490 Differential Revision: [D23583017](https://our.internmc.facebook.com/intern/diff/D23583017/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23583017/)!
|
This pull request has been merged in f5d231d. |
…nd iteration (#44326) Summary: Pull Request resolved: #44326 Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration ghstack-source-id: 112011490 Test Plan: unit tests Reviewed By: mrshenli Differential Revision: D23583017 fbshipit-source-id: ef67f79437a820d9b5699b651803622418499a83
Stack from ghstack:
Part of relanding PR #41954, this refactoring is to move rebuild_buckets call from end of first iteration to beginning of second iteration
Differential Revision: D23583017
NOTE FOR REVIEWERS: This PR has internal Facebook specific changes or comments, please review them on Phabricator!