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
Bus error on SPARC for test_recfunctions.TestRecFunctions:test_find_duplicates #4314
Comments
hm the test creates a void dtype with element size 2, but void dtypes have alignment 1 set which triggers the crash in @seberg new mapiter_trivial_get function |
can be reproduced on x86 with: --- a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
+++ b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
@@ -1438,6 +1438,8 @@ mapiter_trivial_@name@(PyArrayObject *self, PyArrayObject *ind,
#if @isget@
#if @elsize@
+ assert(npy_is_aligned(result_ptr, sizeof(@copytype@)));
+ assert(npy_is_aligned(self_ptr, sizeof(@copytype@)));
*(@copytype@ *)result_ptr = *(@copytype@ *)self_ptr;
#else
copyswap(result_ptr, self_ptr, 0, self); |
Oh, I was not aware that this could be problematic, so we need extra checks in both of those inner loop functions. |
it should be enough to check if the data is aligned to itemsize which you are using here instead of checking the dtype alignment |
@juliantaylor, maybe we should just update the nditer aligned flag to do this as well, or is there any downside to that? Or in fact, maybe it already does... The trivial loop doesn't use nditer/npyiter, but checking alignment for the other by hand is somewhat annoying. |
@seberg Has this been fixed? I think we need it for 1.9. |
we could add back a special case in _IsAligned for void and string arrays, they require the highest alignment required by the platform, which would 16 on spark (or 32 for clongdouble?) and probably 4 or 8 on all others |
or we just bump the alignment required for strings and void types in the descriptions, or is there any reason it is set to 1? |
hm seems to required for memoryviews so putting it in _IsAligned is probably better |
Requires 16 bytes alignment from string and flexible dtypes, as processing functions might access them on the itemsize which can be larger than 1 byte (e.g. 8 bytes strings) 16 byte the largest alignment required for all numpy copy loops. Closes numpygh-4314
I see you had a look at it @juliantaylor, thanks. I don't quite understand all the alignment stuff, but if the current alignment makes sense, how about just changing our aligned functions a little, and have an |
such a function would be useful, though we don't need it anywhere |
I am getting a bus error on Debian SPARC during testing of the recarray functions.
On standard Debian squeeze system (
uname -a
):Running:
gives:
The text was updated successfully, but these errors were encountered: