-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: crash from inside highway running the numpy tests with asan on MacOS with Clang15 #27023
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
I can reliably reproduce this although admittedly this is a weird setup so if anyone wants me to do things to help debug I'm happy to do so. |
Doesn't look like a SegFault, Highway has decided that VQSort isn't available: Looks like there's logic added due to crashes in certain compilers, sanitizers and target combinations: Can you try wrapping these with |
Not sure if I added the macros correctly, but if I do it like so: diff --git a/numpy/_core/src/npysort/highway_qsort.dispatch.cpp b/numpy/_core/src/npysort/highway_qsort.dispatch.cpp
index 38adfc6de8..6c1ebfc577 100644
--- a/numpy/_core/src/npysort/highway_qsort.dispatch.cpp
+++ b/numpy/_core/src/npysort/highway_qsort.dispatch.cpp
@@ -2,11 +2,16 @@
#define VQSORT_ONLY_STATIC 1
#include "hwy/contrib/sort/vqsort-inl.h"
+#if VQSORT_ENABLED
#define DISPATCH_VQSORT(TYPE) \
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(TYPE *arr, intptr_t size) \
{ \
hwy::HWY_NAMESPACE::VQSortStatic(arr, size, hwy::SortAscending()); \
-} \
+}
+#else
+#define DISPATCH_VQSORT(TYPE) \
+template<> void NPY_CPU_DISPATCH_CURFX(QSort)(TYPE *arr, intptr_t size) {}
+#endif
namespace np { namespace highway { namespace qsort_simd {
@@ -16,5 +21,5 @@ namespace np { namespace highway { namespace qsort_simd {
DISPATCH_VQSORT(uint64_t)
DISPATCH_VQSORT(double)
DISPATCH_VQSORT(float)
-
} } } // np::highway::qsort_simd
+
diff --git a/numpy/_core/src/npysort/highway_qsort_16bit.dispatch.cpp b/numpy/_core/src/npysort/highway_qsort_16bit.dispatch.cpp
index 35b6cc58c7..07ff576299 100644
--- a/numpy/_core/src/npysort/highway_qsort_16bit.dispatch.cpp
+++ b/numpy/_core/src/npysort/highway_qsort_16bit.dispatch.cpp
@@ -5,7 +5,6 @@
#include "quicksort.hpp"
namespace np { namespace highway { namespace qsort_simd {
-
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(Half *arr, intptr_t size)
{
#if HWY_HAVE_FLOAT16
@@ -16,11 +15,15 @@ template<> void NPY_CPU_DISPATCH_CURFX(QSort)(Half *arr, intptr_t size)
}
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(uint16_t *arr, intptr_t size)
{
+#if VQSORT_ENABLED
hwy::HWY_NAMESPACE::VQSortStatic(arr, size, hwy::SortAscending());
+#endif
}
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(int16_t *arr, intptr_t size)
{
+#if VQSORT_ENABLED
hwy::HWY_NAMESPACE::VQSortStatic(arr, size, hwy::SortAscending());
+#endif
}
-
} } } // np::highway::qsort_simd
+ Then I avoid the crash in the tests, but I also see a test failure in |
This means that if
Then in the dispatch logic, it'll get a |
If I do that
|
Argh, the symbol is still defined outside of dynamic dispatch, and I don't know a nice way of not doing that so I've done a workaround in #27050. Does that work for you @ngoldbaum ? |
Fixed by #27050 |
If I build NumPy with Clang 15 from homebrew on MacOS:
And then run the tests like so:
I get a segfault coming from the internals of highway:
The text was updated successfully, but these errors were encountered: