Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fx] modify the calculation of node_size in MetaInfoProp for activation checkpointing usages #1425

Merged
merged 4 commits into from
Aug 10, 2022

Conversation

super-dainiu
Copy link
Contributor

I believe this change won't affect usage of node.meta['tensor_meta'], but I have adopted the expressions in https://github.com/pytorch/pytorch/blob/f9533560ccb2d789bc78caa360d021f72f5ebc7b/torch/fx/passes/graph_manipulation.py#L82 so as to compute the memory consumptions for activation and model parameters separately. This will make it easy for us to retrieve the activation memory cost directly and correctly.

for node in graph.nodes:
    node_size = getattr(node, 'node_size')    # node_size is a NamedTuple(output_size, param_size)
    print(node_size.output_size)    # will get the memory cost of activation in bytes format
    print(node_size.param_size)     # will get the memory cost of activation in bytes format

@YuliangLiu0306 YuliangLiu0306 merged commit f20cb4e into hpcaitech:main Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants