Repository navigation
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/96433
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit d028a38: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Mar 9, 2023
Closed
cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
This is working but probably needs a bit of clean up before review. cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
Contributor
|
@davidberard98 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This is working but probably needs a bit of clean up before review. cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire Differential Revision: [D43999885](https://our.internmc.facebook.com/intern/diff/D43999885) [ghstack-poisoned]
This is working but probably needs a bit of clean up before review. cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire Differential Revision: [D43999885](https://our.internmc.facebook.com/intern/diff/D43999885) [ghstack-poisoned]
This is working but probably needs a bit of clean up before review. cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire Differential Revision: [D43999885](https://our.internmc.facebook.com/intern/diff/D43999885) [ghstack-poisoned]
The main change here is to do warmup within a cudagraph pool. If you imagine we are part of the way through training, all of the memory would be allocated to the CUDAGraph pool, and if we were to try to run a model again in the eager pool we would OOM. Moreover, for many models you need to reclaim the activations in the backward as you run it, otherwise you have a steep memory penalty, so keeping the inputs alive as you do warmup is not an option. The new flow is: - Warmup and return outputs - Record and run graph - Replay Graph. There are a few smaller changes that are in this PR. - Have a separate TapeContainerManager per device. This follows the same per device logic of the Caching Allocator. Also limits CUDAGraphs in the multi device scenario. TBH, i'm not sure how this would work even for the other more naive implementation. - Simplifies pool preservation by having the TapeContainer store a graph. - Also fixed one bug where we were keeping an output that was an alias of a parameter as a path_live_weakref, which would then get freed when we needed to record a new generation and it was still live. cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire Differential Revision: [D43999885](https://our.internmc.facebook.com/intern/diff/D43999885) [ghstack-poisoned]
Closed
The main change here is to do warmup within a cudagraph pool. If you imagine we are part of the way through training, all of the memory would be allocated to the CUDAGraph pool, and if we were to try to run a model again in the eager pool we would OOM. Moreover, for many models you need to reclaim the activations in the backward as you run it, otherwise you have a steep memory penalty, so keeping the inputs alive as you do warmup is not an option. The new flow is: - Warmup and return outputs - Record and run graph - Replay Graph. There are a few smaller changes that are in this PR. - Have a separate TapeContainerManager per device. This follows the same per device logic of the Caching Allocator. Also limits CUDAGraphs in the multi device scenario. TBH, i'm not sure how this would work even for the other more naive implementation. - Simplifies pool preservation by having the TapeContainer store a graph. - Also fixed one bug where we were keeping an output that was an alias of a parameter as a path_live_weakref, which would then get freed when we needed to record a new generation and it was still live. cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire Differential Revision: [D43999885](https://our.internmc.facebook.com/intern/diff/D43999885) [ghstack-poisoned]
The main change here is to do warmup within a cudagraph pool. If you imagine we are part of the way through training, all of the memory would be allocated to the CUDAGraph pool, and if we were to try to run a model again in the eager pool we would OOM. Moreover, for many models you need to reclaim the activations in the backward as you run it, otherwise you have a steep memory penalty, so keeping the inputs alive as you do warmup is not an option. The new flow is: - Warmup and return outputs - Record and run graph - Replay Graph. There are a few smaller changes that are in this PR. - Have a separate TapeContainerManager per device. This follows the same per device logic of the Caching Allocator. Also limits CUDAGraphs in the multi device scenario. TBH, i'm not sure how this would work even for the other more naive implementation. - Simplifies pool preservation by having the TapeContainer store a graph. - Also fixed one bug where we were keeping an output that was an alias of a parameter as a path_live_weakref, which would then get freed when we needed to record a new generation and it was still live. cc soumith voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire Differential Revision: [D43999885](https://our.internmc.facebook.com/intern/diff/D43999885) [ghstack-poisoned]
Contributor
Author
|
Squashed into #89146 |
eellison
added a commit
that referenced
this pull request
Mar 16, 2023
ghstack-source-id: c2aa27e Pull Request resolved: #89146 Use Storages for Cudagraph liveness ghstack-source-id: c2aa27e Pull Request resolved: #96154 Do warmup in cudagraph pool ghstack-source-id: c2aa27e Pull Request resolved: #96433 Comments for cuda graph trees Signed-off-by: Edward Z. Yang <ezyangmeta.com> ghstack-source-id: c2aa27e Pull Request resolved: #96932
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
The main change here is to do warmup within a cudagraph pool. If you imagine we are part of the way through training, all of the memory would be allocated to the CUDAGraph pool, and if we were to try to run a model again in the eager pool we would OOM. Moreover, for many models you need to reclaim the activations in the backward as you run it, otherwise you have a steep memory penalty, so keeping the inputs alive as you do warmup is not an option.
The new flow is:
There are a few smaller changes that are in this PR.
cc @soumith @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire
Differential Revision: D43999885