-
-
You must be signed in to change notification settings -
BUG: Refactor complex floor_divide to avoid osx-arm64 opt warnings #17712
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
This sounds like a clang bug that should also be reported upstream. |
The test failure looks real. |
There is a similar issue for float32 / float64 power computation: gh-18555. |
757e3a4
to
8951e12
Compare
That does sound reasonable. Seems like this didn't pass CI though, rebased to get a fresh signal. |
#18571 is an alternative to this as the tests don't pass with this PR |
This does still fail:
The alternative in gh-18571 is easier to verify, and currently passing. So maybe we should prefer that. Anyone have an opinion? |
The alternative in #18571 was merged. Closing, please reopen or resubmit if there is more to do here. |
When building
numpy
on the new Apple Silicon osx-arm64 platform using clang11 (see https://conda-forge.org/blog/posts/2020-10-29-macos-arm64/ for details), numpy fails tests because of extra divide-by-zero warnings when performing floor division with complex number arrays, even though the computations themselves work just fine.I tracked this to the code in
@TYPE@_floor_divide
for complex types, where it appears that the optimizer on arm64 ends up dispatching both branches at the same time. Even though the second branch is discarded because it is not the code path, the divide-by-zero leaves behind a "ghost" floating point exception, and the tests fail.Replacing the code with the same routine that is used for scalar complex floor division in
scalarmath.c
(usingnpy_divmod
) does not suffer from this problem. It is also reasonable, I believe, for scalar and array methods to use the same algorithm.