[fx] add rules to linearize computation graphs for searching.#1461
Merged
super-dainiu merged 22 commits intohpcaitech:mainfrom Aug 17, 2022
super-dainiu:feature/linear_ckpt
Merged
[fx] add rules to linearize computation graphs for searching.#1461super-dainiu merged 22 commits intohpcaitech:mainfrom super-dainiu:feature/linear_ckpt
super-dainiu merged 22 commits intohpcaitech:mainfrom
super-dainiu:feature/linear_ckpt
Conversation
…on checkpointing usages
…on checkpointing usages
…on checkpointing usages
* [fx] activation checkpointing using Chen strategies. * [fx] add test for ckpt_solver_chen * [fx] add vanilla activation checkpoint search with test on resnet and densenet * [fx] add a namespace code for solver_chen. * [fx] fix the false interpretation of algorithm 3 in https://arxiv.org/abs/1604.06174. * [fx] fix lowercase naming conventions. * [fx] simplify test for ckpt.
* [fx] modify the calculation of node_size in MetaInfoProp for activation checkpointing usages * [fx] modify the calculation of node_size in MetaInfoProp for activation checkpointing usages * [fx] modify the calculation of node_size in MetaInfoProp for activation checkpointing usages * [fx] merge development into main (#1) * [fx] activation checkpointing using Chen strategies. * [fx] add test for ckpt_solver_chen * [fx] add vanilla activation checkpoint search with test on resnet and densenet * [fx] add a namespace code for solver_chen. * [fx] fix the false interpretation of algorithm 3 in https://arxiv.org/abs/1604.06174. * [fx] fix lowercase naming conventions. * [fx] simplify test for ckpt. * [fx] fix test and algorithm bugs in activation checkpointing. * [fx] polish ckpt_test. * [fx] add rules to linearize computation graphs for searching.
…ColossalAI into feature/linear_ckpt
Cypher30
reviewed
Aug 16, 2022
Contributor
Cypher30
left a comment
There was a problem hiding this comment.
Okay, I see all the changes, currently I don't spot any mistakes, I will modify the codegen to check if we need to use use_reentrant=False when call checkpoint functions.
Contributor
Author
|
Hey, anyone to review this?? |
Cypher30
approved these changes
Aug 17, 2022
Contributor
Cypher30
left a comment
There was a problem hiding this comment.
Okay, let's check the if CI could pass
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?
Since in most existing frameworks of activation checkpoints, the forward graph is assumed to be linearized, I developed a small tool function to detect all potential checkpoint nodes. In this way,
chen_greedy()will operate in a linearized manner, without checkpointing something within the skip connection blocks. I also removedchen_sqrtn()because it is a bit outdated.And hopefully, with the new checkpoint function in Colossal-AI (#1460), we can now do linearized searches on arbitrary computation graphs, such as
resnet18()