Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mattip
Copy link
Member

@mattip mattip commented Nov 18, 2025

Fixes #30162 which seems to be a regression in Accelerate. It started happening when we moved to a newer macOS image in CI (not an M4 machine) and was independently reported by @neutrinoceros on macOS 15.7.1 with an M2 machine.

Continuation of #30102. Set the default blas_supports_fpe=false when compiling with Accelerate to "ignore all FPE in calls to BLAS". #30102 added a check when importing NumPy to see if a simple matmul triggers an FPE. If so, then blas_supports_fpe is set to false. But since the check is flaky it does not reliably set the value to false and we see FPE warnings.

Downstream packagers like conda that allow switching out the blas support from Accelerate to OpenBLAS to MKL and others will have to develop a patch to deal with the flaky Accelerate library and FPEs. The available handles are:

  • at compile time they could choose to always set blas_supports_fpe=false and never see the warnings, at the cost of not knowing when overflow/underflow/divide-by-zero occurs
  • at runtime, they could call numpy._core._multiarray_umath._blas_supports_fpe(False) when Accelerate is swapped in, to work around the flaky FPE false-positives.

@neutrinoceros
Copy link
Contributor

Just want to report I've been running my reproducer from #30162 in a loop for 40min and never hit the exception. I think I can safely conclude that the fix is confirmed. Thanks Matti !

@charris charris merged commit a79233c into numpy:main Nov 19, 2025
75 checks passed
@charris
Copy link
Member

charris commented Nov 19, 2025

Thanks Matti. I would have stuck a const on variable, but I don't think it worth worrying about.

@matthew-brett
Copy link
Contributor

Do the Apple developer team know about this bug? (Sorry if I missed the report).

@mattip
Copy link
Member Author

mattip commented Nov 19, 2025

I did ping @Developer-Ecosystem-Engineering in the issue but will do so again here

@seberg
Copy link
Member

seberg commented Nov 19, 2025

@mattip I think we need to remove that silly warning that I added if this is flaky? I mean, just deleting is fine, it was maybe a bad idea to begin with.

@mattip
Copy link
Member Author

mattip commented Nov 19, 2025

I think the warning is fine. Let's see if we get reports of it triggering.

@Developer-Ecosystem-Engineering
Copy link
Contributor

I did ping @Developer-Ecosystem-Engineering in the issue but will do so again here

Hi Matt,

We saw it =) No update at the moment but it's in the queue.

cakedev0 pushed a commit to cakedev0/numpy that referenced this pull request Dec 5, 2025
IndifferentArea pushed a commit to IndifferentArea/numpy that referenced this pull request Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TST: a flaky test on macOS arm64 (RuntimeWarning: invalid value encountered in matmul)

6 participants