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

[Pass] DynamicToStatic uses InferTypeLocal #9869

Conversation

AndrewZhaoLuo
Copy link
Contributor

DynamicToStatic has the same issue as found in #9735 as it incrementally tries to make dynamic things static throughout the graph, running type inference incrementally along the way. DynamicToStatic is a bit of a slow pass for larger models so this might help.

Unsure if this will speed things up, as I'm unsure how well ConstantFolding works, but first glance it appears to be smart and I think type inference dominates runtime.

@AndrewZhaoLuo AndrewZhaoLuo changed the title [WIP] DynamicToStatic uses InferTypeLocal [WIP][Pass] DynamicToStatic uses InferTypeLocal Jan 7, 2022
@AndrewZhaoLuo AndrewZhaoLuo changed the title [WIP][Pass] DynamicToStatic uses InferTypeLocal [Pass] DynamicToStatic uses InferTypeLocal Jan 10, 2022
@AndrewZhaoLuo
Copy link
Contributor Author

@mbrookhart so using this decreases pass time from 170s--> ~105s on my computer when running on large BERT model.

https://zenodo.org/record/3733910/files/model.onnx

E.g.: https://github.com/AndrewZhaoLuo/TVM-Sandbox/blob/main/relay/dynamic_to_static_example.py

This model doesn't see any change after dynamic 2 static though, so do you have model that does change significantly?

Otherwise I think this is ready to review.

Copy link
Contributor

@mbrookhart mbrookhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndrewZhaoLuo Models that don't change much through this pass tend to be a lot slower than models that do, this is a nice speedup, thank you!

@mbrookhart mbrookhart merged commit 79c59fe into apache:main Jan 14, 2022
crazydemo pushed a commit to crazydemo/tvm that referenced this pull request Jan 27, 2022
Raghav-Chakravarthy pushed a commit to Raghav-Chakravarthy/tvm that referenced this pull request Jan 28, 2022
ylc pushed a commit to ylc/tvm that referenced this pull request Feb 16, 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

2 participants