-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[Inductor][CPP] Extract common functions to be reused in other CPP Template #141554
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
[Inductor][CPP] Extract common functions to be reused in other CPP Template #141554
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/141554
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 978d68d with merge base f3d16ec ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
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 add function doc for the newly added functions.
Thanks for the comment. Adding the type hint and doc for these new added functions. |
| Union[ir.Buffer, ir.ReinterpretView], | ||
| ]: | ||
| """ | ||
| Helper function to pre-process out template epilogues for code generation. |
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.
Some comments:
- It is more beneficial to explain why we need this function and give a high-level summary of what it does.
- After clarify what it does, you will see it is cleaner to move the building of epilogues out of the function to perhaps a dedicated function.
- Then, you can consider to give a better name to this function according to the function doc.
| Helper function to pre-process out template epilogues for code generation. | |
| The dimension and the indexing could be different between the GEMM output, i.e. `template_buffer`, which is | |
| 2D with MxN) and the output from the template after epilogues, i.e. `Y`. In the GEMM template code, | |
| we are not aware of the dimension and the indexing of the epilogues and always work on 2D tiles according to | |
| the indexing of the GEMM output. | |
| In this function, we return a 2D buffer (`Y_2d`) according to GEMM output (reinterpreted from `Y` if needed) and | |
| build a reindexer that converts the indexing of `Y` into `Y_2d`. |
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 the comment. Refactor the implementation by removing epilogues and rename this function to gen_2d_view_of_epilogue_buf.
|
@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 |
…mplate (pytorch#141554) **Summary** Extract common internal functions from GEMM Template into public function, so these functions can be reused by the subsequent group GEMM template. Pull Request resolved: pytorch#141554 Approved by: https://github.com/jgong5
…mplate ghstack-source-id: 06a63d9 Pull Request resolved: pytorch#141554
Stack from ghstack (oldest at bottom):
Summary
Extract common internal functions from GEMM Template into public function, so these functions can be reused by the subsequent group GEMM template.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang @aakhundov