Merged
Conversation
Contributor
|
…s even smaller than the other one in forward pass (FusedMatmul which is replaced by a new node after gradient graph is built)
…pengwa/add_aggresive_recompute
Contributor
Author
Find those stashed activations that are used by backward operators. Put all those activations as candidates; For each candidate, https://github.com/microsoft/onnxruntime/blob/f3369a8bf87190552ad551a6de56df01cccf7a62/orttraining/orttraining/core/optimizer/memory_optimizer/memory_insight.cc#L272C9-L272C30 will check whether it is recomputable, and how the subgraph looks like,.
No, that's the long term goal to have all those feature ready, to help dynamically choose a good plan for users. |
…pengwa/add_aggresive_recompute
askhade
reviewed
Dec 5, 2023
askhade
reviewed
Dec 5, 2023
orttraining/orttraining/python/training/ortmodule/_training_manager.py
Outdated
Show resolved
Hide resolved
zhijxu-MS
reviewed
Dec 8, 2023
orttraining/orttraining/core/optimizer/memory_optimizer/recompute_analysis.cc
Outdated
Show resolved
Hide resolved
…pengwa/add_aggresive_recompute
zhijxu-MS
previously approved these changes
Dec 8, 2023
zhijxu-MS
approved these changes
Dec 11, 2023
askhade
approved these changes
Dec 11, 2023
Contributor
Author
|
Thank you @askhade, @zhijxu-MS !! |
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.
Allow layer-wise recompute
Early, we need users/developers to specify the subgraphs to recompute, now we introduced a more user-friendly way to enable recompute for all detected stashed activation recomputation subgraphs. This scarifies getting the best configs while makes it easier to support user requirements when they switches from PyTorch per-layer gradient checkpoint to ORTModule.
ORTMODULE_MEMORY_OPT_LEVELis introduced to control the usage, by default, it is 0, e.g.USER_SPECIFIED, all subgraphs definedinORTMODULE_MEMORY_OPT_CONFIGwill be recomputed. So this is compatible to existing recompute usage in ORTModule integrated models.Using
ORTMODULE_MEMORY_OPT_LEVEL=1, we will enable all recompute plans detected, so those configs inORTMODULE_MEMORY_OPT_CONFIGwill not be respected any more.Add Unit Tests using 3 layer blooms.
https://github.com/microsoft/onnxruntime/blob/pengwa/add_aggresive_recompute/docs/Memory_Optimizer.md