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

BUG: SciPy is seeing incorrect warnings on MacOS M1 (M2?) array * scalar #23996

Closed
seberg opened this issue Jun 19, 2023 · 6 comments · Fixed by #24054
Closed

BUG: SciPy is seeing incorrect warnings on MacOS M1 (M2?) array * scalar #23996

seberg opened this issue Jun 19, 2023 · 6 comments · Fixed by #24054

Comments

@seberg
Copy link
Member

seberg commented Jun 19, 2023

CC @tylerjereddy. See scipy/scipy#18697, it seems MacOSX on arm optimizes the multiply in a way that leads to loading uninitialized values/zeros probably, so that 0 * inf triggers a warning.

I am not sure we should worry too much about it, since clang on MacOS X for arm doesn't properly support -ftrapping-math IIRC, which tends to make things difficult, but it is incorrect. The SciPy test should not show a warning in the specific multiplication.

@tylerjereddy
Copy link
Contributor

Let me know if you want me to test anything specific.

@seberg
Copy link
Member Author

seberg commented Jun 19, 2023

Thanks, no need... This is a trivial repro that works on my machine:

np.arange(1, 12.) * np.inf

@seberg
Copy link
Member Author

seberg commented Jun 20, 2023

Ping @Developer-Ecosystem-Engineering since maybe you can have a look at this and there is an easy fix.

tylerjereddy added a commit to tylerjereddy/scipy that referenced this issue Jun 24, 2023
* deals with the second part of scipygh-18732

* I was able to reproduce locally, but this one was even
flakier--analysis of patch success below, and possibly
related to subtle low-level MacOS ARM issues upstream
in numpy/numpy#23996 (NumPy
`1.25.0`)

* before this patch, 4 trials of this command
with `pytest-repeat`:
`CC=clang CXX=clang++ FC=gfortran-12 python dev.py test -t scipy/signal/tests/test_signaltools.py::TestDecimate::test_complex_iir_dlti -- --count=20000`
`81 failed, 19919 passed in 43.68s`
`81 failed, 19919 passed in 43.79s`
`20000 passed in 33.24s`
`43 failed, 19957 passed in 35.17s`

* after this patch, 6 trials of the same command:
`20000 passed in 30.44s`
`20000 passed in 33.08s`
`20000 passed in 33.46s`
`20000 passed in 33.45s`
`20000 passed in 33.56s`
`20000 passed in 33.30s`

[skip circle]
@tylerjereddy
Copy link
Contributor

See also:
scipy/scipy#18737
scipy/scipy#18738

Flaky behavior, sometimes < 80 failures in 20,000 trials of the same calculation, so reproducing is a bit tricky.

clang version:

Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

tylerjereddy added a commit to tylerjereddy/scipy that referenced this issue Jun 25, 2023
* deals with the second part of scipygh-18732

* I was able to reproduce locally, but this one was even
flakier--analysis of patch success below, and possibly
related to subtle low-level MacOS ARM issues upstream
in numpy/numpy#23996 (NumPy
`1.25.0`)

* before this patch, 4 trials of this command
with `pytest-repeat`:
`CC=clang CXX=clang++ FC=gfortran-12 python dev.py test -t scipy/signal/tests/test_signaltools.py::TestDecimate::test_complex_iir_dlti -- --count=20000`
`81 failed, 19919 passed in 43.68s`
`81 failed, 19919 passed in 43.79s`
`20000 passed in 33.24s`
`43 failed, 19957 passed in 35.17s`

* after this patch, 6 trials of the same command:
`20000 passed in 30.44s`
`20000 passed in 33.08s`
`20000 passed in 33.46s`
`20000 passed in 33.45s`
`20000 passed in 33.56s`
`20000 passed in 33.30s`

[skip circle]
@Developer-Ecosystem-Engineering
Copy link
Contributor

We understand the issue, please stand by

@Developer-Ecosystem-Engineering
Copy link
Contributor

Please see #24054 for a proposed fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants