[autoparallel] modify construct chain in auto activation checkpoint solver rotor#2254
Merged
super-dainiu merged 53 commits intohpcaitech:debug/ckpt-autoparallelfrom Jan 2, 2023
Conversation
Merge ColossalAI
Daily merge
6 tasks
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.
What's New?
In this PR, I modify the
_extract_node_infoin_construct_chainofCheckpointSolverRotor, so that it could correctly compute the memory peak of forward phase.The new forward peak is calculated with
xbar. When we iterate over the list oftorch.fx.Node, we first updatexbarwith buffer memory (e.g. running mean and running var in batch normalization) andcalculate_fwd_out()function that computes the true output, i.e. the output used by users of the node. Then we update memory peak static withmax(fwd_mem_peak, xbar + n.meta['fwd_mem_tmp'] + cls._extract_unused_output(n)), wherecis._extract_unused_output()is thecis._extract_ftmp()in the past, but I modify it to focus on a singletorch.fx.Nodeother than the last one in the list oftorch.fx.Node, so that it could be aware of the discarded output of everytorch.fx.Nodeinside the linearized 'node'.