-
-
Notifications
You must be signed in to change notification settings - Fork 11k
BUG: maximum, minimum no longer emit warnings on NAN #12236
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
} | ||
/* npy_half_isnan will never set floatstatus_invalid, so do not clear */ |
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.
when do we set floatstatus_invalid? is that set at the C level?
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.
Yes, the non-SSE code sets it in a > b
comparisons. which is why I need to clear it in the float-type loops at line 1849, and the complex-type loops at line 2763,
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.
Well, set at the FPU level, not at the C level.
Can't we just reorder the comparisons to do the nan checks first, rather than messing with the FPU flags?
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.
trying, let's see what CI finds
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 turns out simd code also sets it, in a way that it is impossible to avoid the clear after the loop finishes.
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.
Rearranging the order still sets the flag since only one value is checked. It seems cheaper to me to clear the flag than to check both values. In changeset 46452b3 I added back the call to clear the flags, now tests are passing.
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.
I don't think instruction ordering is safe with modern compilers, at least without some work to make the order stick.
Thanks Matti. |
Fixes #12038.
Starting with the sse code in simd.inc.src in PR #3419, then completed in PRs #9020, #11043, #11595, we adopted behaviour that warned when encountering a NAN on
np.maximum
,np.minimum
, as well as ensuring we return a NAN value. This PR reverts emitting a warning, while preserving the tests to show we always propogate the NAN value to the output.