-
Notifications
You must be signed in to change notification settings - Fork 97
Add Conv-Affine(Mul+Add) and hardswish fusion #2472
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
Add Conv-Affine(Mul+Add) and hardswish fusion #2472
Conversation
|
We should have a mechanism to enable or disable a rule if the opset does not support the fused operators. But we can manually select the list of rules to apply for now. We should probably opset information in the rule itself. I'll let @gramalingam comment on that. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2472 +/- ##
==========================================
+ Coverage 70.37% 70.62% +0.24%
==========================================
Files 218 222 +4
Lines 26428 26620 +192
Branches 2646 2660 +14
==========================================
+ Hits 18600 18801 +201
+ Misses 6922 6899 -23
- Partials 906 920 +14 ☔ View full report in Codecov by Sentry. |
|
@xadupre CI passed, can you review this PR again? |
|
No need to update from main - otherwise we will have to re-trigger CI. Thanks |
|
@justinchuby any other suggestions? |
|
Sorry for the delay. I was waiting for @gramalingam to take a look. @Stonesjtu We recently refactored the rules and found a new place for them. Could you rebase your PR, move the rules to https://github.com/microsoft/onnxscript/tree/main/onnxscript/rewriter/rules/common, and expose them in https://github.com/microsoft/onnxscript/blob/main/onnxscript/rewriter/rules/common/__init__.py? Thanks! |
9a28a08 to
e8836d9
Compare
|
@justinchuby Done. I think the test files should also be moved out from the source code dir to |
|
The tests are ok. See: https://github.com/microsoft/onnxscript/wiki/Coding-style#tests |
|
MHA attention fusion tests are failing, should be irrelevant to this PR. |
| affine_conv_fusion_rule, | ||
| conv_affine_fusion_rule, | ||
| ) | ||
| from onnxscript.rewriter.rules.common._fuse_hardswish import fuse_hardswish_rules |
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.
Sorry I missed this: Could you expose the individual rules? I will merge this first - feel free to submit a follow up PR @Stonesjtu
Close #2468
May not be generic enough, but works for us in
paddleOCRv4model.Another question is hardswish is introduced in opset-v14, will onnxscript handles older opset version or rewrite rules take care of this?