-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[Inductor][CPP] Fix layout for local buf in outer loop fusion #160857
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/160857
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit d62fb9f with merge base a4fc051 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| # Local Buffer is a view of global buffer | ||
| local_buffer_stride: list[int] = [] | ||
| stride = global_buffer_layout.stride[-1] | ||
| local_buffer_size = get_call_ranges(scheduler_node)[ |
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.
is this case scheduler_node also a view of global_buffer?
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.
In this case global_buffer is scheduler_node.node.
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.
then why can't use global_buffer_layout.size[size_offset:] directly?
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.
Because global_buffer_layout is the tensor layout while size_offset is the loop depth. The dimension of global_buffer_layout may not be the same as loop number, e.g, there are merged dims.
In this case, global_buffer_layout size is [5, 1, 32, 32] but the callrange is [5, 1024]. If use global_buffer_layout.size[size_offset:] to create local_buffer_layout we get the size [32] but we need [1024].
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.
LGTM
| continue | ||
| # Local Buffer is a view of global buffer | ||
| local_buffer_stride: list[int] = [] | ||
| stride = global_buffer_layout.stride[-1] |
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.
Will this work for a size = [] tensor?
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.
global_buffer is an instance of ir.ComputedBuffer. We haven't encountered a size = [] tensor yet. Is there a possible case for this? @leslie-fang-intel Could you please help on this question ?
|
@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 |
…h#160857) Fixes pytorch#159154 Pull Request resolved: pytorch#160857 Approved by: https://github.com/leslie-fang-intel, https://github.com/jansel
Fixes #159154
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben