Skip to content
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

[Opt] Improve strength reduction optimization for "pow" #1170

Merged
merged 3 commits into from
Jun 7, 2020

Conversation

xumingkuan
Copy link
Collaborator

@xumingkuan xumingkuan commented Jun 7, 2020

Related issue = #1141 #944

Related PR = #1065

WANT_LGTM = any

[Click here for the format server]

Copy link
Member

@k-ye k-ye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! My only concern is the floating comparisons here. IMHO except for 0.5, we probably should do the value cast the other way around, i.e.

  • int -> int
  • float -> if super close to an int, return an int

Maybe the cast result needs to be std::optional<int> or something?

@xumingkuan
Copy link
Collaborator Author

I think for any int32 x, x == (float64)x. Or shall we optimize (say) a ** (2 + eps) to a * a when fast_math=True?

@k-ye
Copy link
Member

k-ye commented Jun 7, 2020

I think for any int32 x, x == (float64)x.

I see, glad to learn about this..

Or shall we optimize (say) a ** (2 + eps) to a * a when fast_math=True?

I'll leave this up to you :)

@xumingkuan xumingkuan merged commit a79e8ce into taichi-dev:master Jun 7, 2020
@xumingkuan xumingkuan deleted the alg4 branch June 10, 2020 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants