-
Notifications
You must be signed in to change notification settings - Fork 26.3k
enable concat linear with mkldnn linear by flag #139048
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/139048
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit db8300d with merge base 034b105 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
jgong5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please update the PR description on changes?
| KeywordArg("reshape_2"), | ||
| ), | ||
| pass_number=1, | ||
| pass_number=2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously mkldnn_linear pass is 0 and _recover_linear is based on mkldnn_linear so it should be 1.
Now we set mkldnn_linear pass to 1 (since concat linear is 0), then the recover_linear pass number should be 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the note in the code too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for advice, added this note in code.
|
@pytorchbot merge |
Merge failedReason: Approvers from one of the following sets are needed:
|
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Enable concat linear for CPU mkldnn path. Previously, we have a concat linear in freezing passes but it not worked on CPU. This is because `concat_linear` pattern happened after `mkldnn_weight_prepack`. And `concat_linear` only handle `addmm/mm` etc. ``` addmm -> mkldnn linear addmm -> mkldnn linear -> cannot concat # only worked when disable mkldnn addmm -> addmm -> concat linear ``` Now we changed `mkldnn linear` related pass numbers larger than `concat_linear` pass numbers. ``` addmm -> concat linear -> mkldnn linear addmm -> ``` So it can work fine with mkldnn linear now. Also, since concat linear not always have benefits. We add 1 flag `config.cpp.enable_concat_linear` and set default value to False. User can enable this by their need. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper blzheng wenzhe-nrv jiayisunx ipiszy yf225 chenyang78 kadeng muchulee8 ColinPeppler amjames desertfire chauhang aakhundov [ghstack-poisoned]
|
Successfully rebased |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Enable concat linear for CPU mkldnn path. Previously, we have a concat linear in freezing passes but it not worked on CPU. This is because `concat_linear` pattern happened after `mkldnn_weight_prepack`. And `concat_linear` only handle `addmm/mm` etc. ``` addmm -> mkldnn linear addmm -> mkldnn linear -> cannot concat # only worked when disable mkldnn addmm -> addmm -> concat linear ``` Now we changed `mkldnn linear` related pass numbers larger than `concat_linear` pass numbers. ``` addmm -> concat linear -> mkldnn linear addmm -> ``` So it can work fine with mkldnn linear now. Also, since concat linear not always have benefits. We add 1 flag `config.cpp.enable_concat_linear` and set default value to False. User can enable this by their need. Pull Request resolved: pytorch#139048 Approved by: https://github.com/jgong5, https://github.com/jansel
Enable concat linear for CPU mkldnn path. Previously, we have a concat linear in freezing passes but it not worked on CPU. This is because `concat_linear` pattern happened after `mkldnn_weight_prepack`. And `concat_linear` only handle `addmm/mm` etc. ``` addmm -> mkldnn linear addmm -> mkldnn linear -> cannot concat # only worked when disable mkldnn addmm -> addmm -> concat linear ``` Now we changed `mkldnn linear` related pass numbers larger than `concat_linear` pass numbers. ``` addmm -> concat linear -> mkldnn linear addmm -> ``` So it can work fine with mkldnn linear now. Also, since concat linear not always have benefits. We add 1 flag `config.cpp.enable_concat_linear` and set default value to False. User can enable this by their need. Pull Request resolved: pytorch#139048 Approved by: https://github.com/jgong5, https://github.com/jansel
Enable concat linear for CPU mkldnn path. Previously, we have a concat linear in freezing passes but it not worked on CPU. This is because `concat_linear` pattern happened after `mkldnn_weight_prepack`. And `concat_linear` only handle `addmm/mm` etc. ``` addmm -> mkldnn linear addmm -> mkldnn linear -> cannot concat # only worked when disable mkldnn addmm -> addmm -> concat linear ``` Now we changed `mkldnn linear` related pass numbers larger than `concat_linear` pass numbers. ``` addmm -> concat linear -> mkldnn linear addmm -> ``` So it can work fine with mkldnn linear now. Also, since concat linear not always have benefits. We add 1 flag `config.cpp.enable_concat_linear` and set default value to False. User can enable this by their need. Pull Request resolved: pytorch#139048 Approved by: https://github.com/jgong5, https://github.com/jansel
Enable concat linear for CPU mkldnn path.
Previously, we have a concat linear in freezing passes but it not worked on CPU.
This is because
concat_linearpattern happened aftermkldnn_weight_prepack. Andconcat_linearonly handleaddmm/mmetc.Now we changed
mkldnn linearrelated pass numbers larger thanconcat_linearpass numbers.So it can work fine with mkldnn linear now.
Also, since concat linear not always have benefits. We add 1 flag
config.cpp.enable_concat_linearand set default value to False. User can enable this by their need.Stack from ghstack (oldest at bottom):
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang @aakhundov