-
Notifications
You must be signed in to change notification settings - Fork 608
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 missing expansion patterns for math.powf
#14614
Conversation
Following the same approach as for other math ops. This will prevent the powf operation to be scalaried on CPU.
@@ -30,6 +30,7 @@ class PolynomialApproximationPass | |||
RewritePatternSet mathPatterns(&getContext()); | |||
populateExpandTanPattern(mathPatterns); | |||
populateExpandExp2FPattern(mathPatterns); | |||
populateExpandPowFPattern(mathPatterns); |
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.
It's not clear to me what qualifies the expansions to be here or in the if-else statement below... but this should be similar to Exp2
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.
IIUC, it should be inside if-then-else if you are worried the approximation is not precise enough. As far as I know, if exp2 is precise enough then this shouldn't cause a huge issue.
Looks good, but waiting for benchmark runs |
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.
@@ -30,6 +30,7 @@ class PolynomialApproximationPass | |||
RewritePatternSet mathPatterns(&getContext()); | |||
populateExpandTanPattern(mathPatterns); | |||
populateExpandExp2FPattern(mathPatterns); | |||
populateExpandPowFPattern(mathPatterns); |
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.
IIUC, it should be inside if-then-else if you are worried the approximation is not precise enough. As far as I know, if exp2 is precise enough then this shouldn't cause a huge issue.
Following the same approach as for other math ops. This will prevent the powf operation to be scalarized on CPU. Fixes iree-org#13547
Following the same approach as for other math ops. This will prevent the powf operation to be scalarized on CPU.
Fixes #13547