-
-
You must be signed in to change notification settings - Fork 10.8k
BUG: random segmentation fault in np.unique
on MacOS (arm64) + numpy 2.0.1
#27037
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
Comments
It's The array is shaped FWIW, the lldb result is:
with the back 8000 trace:
Ping @Mousius this sounds like t may be up your alley with the highway issue. |
I had a look at the data, and the interesting thing about it and one thing is that it has a lot of repeated values (along dimension 0 and 2). The following seems to crash for me about half the time, so it doesn't quite seem like the right ingredient... The actual array has the property that
|
And because I find it puzzling. This crashes for me in highway (expected) and the PR that @neutrinoceros bisected to was #26821 which is x86 sort and would seem unrelated to me on first sight?! (CC @rdevulap) |
However unlikely, It's possible that my bisection took a wrong turn at some point because I marked any commit for which I couldn't reprod after 10 tries as "good", and maybe that wasn't enough. |
Well, it makes it harder that this issue is flaky. It does run successfully sometimes for me. |
Ahh, I didn't notice that one! https://github.com/numpy/numpy/pull/26821/files does indeed contain some changes that would be related to the mac/highway paths. |
This is similar to #25464 - cc @jan-wassenberg, the expert on all things VQSort.
|
The highway commit hash in 2.0.x matches with main branch. Does it mean this failure happens on the main branch too? @neutrinoceros is it possible to verify that? |
@r-devulap yes, I tested only on main. It is reproducible there. |
I think google/highway#2282 should fix this, can someone else verify? It was pretty much the same issue of the Highway |
thanks a lot @Mousius ! I just tried your branch locally and it seemed to run smoothly, but for reasons that are beyond me it looks like I cannot reprod the segfault at all today, so I don't think my validation is worth much. |
Nevermind, I just forgot that I used Python 3.10 yesterday and used my default (3.12) today. Switching back to 3.10 I can both reproduce the problem again and confirm that it goes away with your patch ! |
Thank you @Mousius for fixing :)
Sorry about the breakage. I checked why our tests did not find this, and it's because they generate random 32-bit values which are very unlikely to have many duplicates. We can also run them with 8-bit values. |
* Bump Highway to latest master Fixes numpy#27037 * Add reproducer
* Bump Highway to latest master Fixes numpy#27037 * Add reproducer
* Bump Highway to latest master Fixes numpy#27037 * Add reproducer
Describe the issue:
We noticed a regression with numpy 2.0.1 in yt's test suite yt-project/yt#4953, which bisects to gh-26821
This crash (segmentation fault) pops up in a test that use numpy's RNG (seeded), but it is still non-deterministic: it doesn't always happen, though it is frequent enough that I can reliably hit it locally if I run the test a dozen times.
As a shortcut get a MWE, I saved the random-generated data to a
.npy
file (uploaded to filetransfer.io, see link in the reprod script)I suspect the important change in gh-26821 is that Highway is now used by default on macOS+arm64
may be linked to gh-27023
Reproduce the code example:
Error message:
I don't know how to get gdb on macOS arm64
Python and NumPy Versions:
Also seen in CI with Python 3.9, FWIW
Runtime Environment:
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: