-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Relay] Rewrite division by constant to multiply #13182
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
|
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.
Generated by tvm-bot |
AndrewZhaoLuo
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.
LGTM, some comments though.
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/3316738778 Details |
|
@tvm-bot re-run |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/3316749317 Details |
|
@tvm-bot merge |
Convert division by a scalar constant into multiplication by the inverse of the constant. Multiplication is faster than division and also allow for more optimization opportunities. Only applies to float32 and float64.
* [Relay] Rewrite division by constant to multiply Convert division by a scalar constant into multiplication by the inverse of the constant. Multiplication is faster than division and also allow for more optimization opportunities. Only applies to float32 and float64. * formatting * handle division by zero * handle float16
* [Relay] Rewrite division by constant to multiply Convert division by a scalar constant into multiplication by the inverse of the constant. Multiplication is faster than division and also allow for more optimization opportunities. Only applies to float32 and float64. * formatting * handle division by zero * handle float16
|
@tkonolige you forgot to judge the operand of divide is "a scalar constant". @AndrewZhaoLuo |
|
Oops sorry about that. Fixes it by moving to using standard relay semantics so we have to think less of the two cases. |
Convert division by a scalar constant into multiplication by the inverse of the constant. Multiplication is faster than division and also allow for more optimization opportunities. Only applies to float32 and float64.
I wrote this as a separate pass. Is there a better way to do it?
@AndrewZhaoLuo