CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 24.7k
[inductor] support linear+binary foldinig for freezing path #138807
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/138807
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 57b01ba with merge base b379a28 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
test/inductor/test_binary_folding.py
Outdated
for use_bias, pytorch_op in itertools.product(linear_bias, ops): | ||
# add | ||
test_linear_fusion( | ||
use_bias, | ||
pytorch_op, | ||
False, | ||
add_tensor=torch.rand( | ||
4, | ||
32, | ||
).to(self.device), | ||
expect_success=False, | ||
) | ||
|
||
# broadcasting add | ||
test_linear_fusion( | ||
use_bias, | ||
pytorch_op, | ||
False, | ||
add_tensor=torch.rand( | ||
4, | ||
1, | ||
).to(self.device), | ||
expect_success=False, | ||
) |
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 note in the code on why you are expecting fusion failures.
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.
Added, thanks for your comments!
@@ -44,7 +44,7 @@ | |||
torch.nn.GELU(approximate="tanh"): 10, | |||
torch.nn.ReLU6(): 3, | |||
torch.nn.SiLU(): 3, | |||
torch.nn.Hardsigmoid(): 5, | |||
# torch.nn.Hardsigmoid(): 5, |
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.
why comment it out?
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.
Hardsigmoid will be decomposed into add, clamp_min, clamp_max, div. With this pr, scalar add will be folded with conv/linear, which will change the behavior of the following fusion. I haven't figured out how to fix this issue yet, do you have any ideas?
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.
I currently only support the float type scalar case to avoid this problem.
ghstack-source-id: 6839b91 Pull Request resolved: pytorch#138807
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.
a small nit, others LGTM.
Co-authored-by: Jiong Gong <jiong.gong@intel.com>
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.
Failing tests?
Sorry, this was introduced by the last rebase. I have fixed it. Can you review it again? Thanks! |
@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 |
…138807) Pull Request resolved: pytorch#138807 Approved by: https://github.com/jgong5, https://github.com/jansel Co-authored-by: Jiong Gong <jiong.gong@intel.com>
…138807) Pull Request resolved: pytorch#138807 Approved by: https://github.com/jgong5, https://github.com/jansel Co-authored-by: Jiong Gong <jiong.gong@intel.com>
…138807) Pull Request resolved: pytorch#138807 Approved by: https://github.com/jgong5, https://github.com/jansel Co-authored-by: Jiong Gong <jiong.gong@intel.com>
Stack from ghstack (oldest at bottom):
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang @aakhundov