10000 MAINT: Further fixups to uint alignment checks by charris · Pull Request #12706 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Further fixups to uint alignment checks #12706

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

Merged
merged 1 commit into from
Jan 10, 2019

Conversation

charris
Copy link
Member
@charris charris commented Jan 9, 2019

Backport of #12677.

A few more fixes following on #12626, based on testing on a ppc64be system.

First, on this system some einsum tests failed due typo in that PR: ; should have been &&. This wasn't caught by x64 unit tests, so I've added a test that should cover those code paths.

Second, I figured out that some of the fix in #12626 wasn't quite right: I had misunderstood what the NPY_ITER_ALIGNED flag is supposed to do. My understanding now is that is a request to guarantee that the nditer buffers are "true" aligned. (uint alignment is only an internal numpy thing which users shouldn't know about), which nditer it does by forcing a buffer/cast if that flag is requested, since all new buffers are true aligned. With that understanding, it now seems that the NPY_OP_ITFLAG_ALIGNED flag is not needed: Its only use was as a precalculated computation of the aligned parameter of PyArray_GetDTypeTransferFunction, but that is more safely computed on the spot, based on both uint and true alignment of the op. So I've removed all uses of NPY_OP_ITFLAG_ALIGNED.

This latter change was indirectly discovered from staring at the code while trying to bug-hunt failed alignment asserts on ppc64be. But those turned out to be irrelevant glibc problems from #10491. At least it got me to read a lot of code over more thoroughly: I also made sure that the ufunc code doesn't need alignment fixes.

@charris charris added this to the 1.16.0 release milestone Jan 9, 2019
@charris charris closed this Jan 10, 2019
@charris charris reopened this Jan 10, 2019
@charris charris merged commit 2f945eb into numpy:maintenance/1.16.x Jan 10, 2019
@charris charris deleted the backport-12677 branch January 10, 2019 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0