Repository navigation
Conversation
|
sorry, there have been too many PRs lately, so I’m scaling back how many I review carefully. PRs that take more time to review compared of fixing the problem myself will not be reviewed. I wouldn’t review this PR until the diff is much smaller than 72 lines. We’re fixing a single special case, and I don’t see a reason for such a large diff. The test should be minimal too. AI tends to overtest by checking the same thing repeatedly. Also it tends to change more things than needed. If you’re using AI, try Ponytail, ste and cpp skills, or Unslop to reduce boilerplate. |
Understood, I'll take another look and see if something can be done to reduce the diff. |
|
thanks for the feedback. i got the diff down to 13 changed lines. the fix uses one mask to identify the cases where i cut the regression coverage down to four checks in the existing power test. the power tests passed on SSE2 and AVX2. |
DiamonDinoia
left a comment
There was a problem hiding this comment.
This starts to make sense. Now we can try to integrate in the original algorithm by simplifying things.
| const auto zero = batch_type(0.); | ||
| const auto one = batch_type(1.); | ||
| const auto unit_result = exponent == zero || base == one || (base == -one && isinf(exponent)); | ||
| const auto self = select(unit_result, one, base); |
There was a problem hiding this comment.
Keep using base and exponent instead of self/other since you are touching this code. I think is more clear.
| const auto self = select(unit_result, one, base); | ||
| const auto other = select(unit_result, zero, exponent); | ||
| auto negself = self < zero; | ||
| auto iszeropowpos = self == zero && other >= zero; |
There was a problem hiding this comment.
Is it possible to simplify the control flow? We are now checking things equal zero here for example.
| const auto other = select(unit_result, zero, exponent); | ||
| auto negself = self < zero; | ||
| auto iszeropowpos = self == zero && other >= zero; | ||
| auto adj_self = select(iszeropowpos, batch_type(1), abs(self)); |
There was a problem hiding this comment.
Since there is a one variable above we should keep using it.
|
thanks, i kept |
|
This make sense. Could you do a pass by adding comment such as Could you check the performance of the code? If we have regressions compared to the old code? If so, instead of select is it better to have a plain if with |
|
thanks, i added the three identities above the mask. the two i benchmarked ordinary |
Fix real
powto return1for a zero exponent, a base of1, or a base of-1with an infinite exponent. Handle those lanes before multiplying the exponent by the logarithm.Added four regression checks to the existing power test for
floatanddouble. The real and complex power tests passed on SSE2 and AVX2 with FMA.Fixes #1458.