Skip to content

API: Shrink MultiIterObject and make NPY_MAXARGS a runtime macro#25271

Merged
ngoldbaum merged 1 commit intonumpy:mainfrom
seberg:NPY_MARGS-variable
Nov 29, 2023
Merged

API: Shrink MultiIterObject and make NPY_MAXARGS a runtime macro#25271
ngoldbaum merged 1 commit intonumpy:mainfrom
seberg:NPY_MARGS-variable

Conversation

@seberg
Copy link
Member

@seberg seberg commented Nov 29, 2023

Cython is OK with increased sizes, but doesn't like shrinking an object size. We should fix this (providing a size to compare with in the pyd maybe). But just not including the end of the object here publically is totally fine...

This makes NPY_MAXARGS also a runtime constant, since the presumably only user (numexpr) should be better off with that anyway. Yes, they need to change the code to hard-code the maximum, but they also need the NumPy cap from us anyway.

This is needed, because Cython breaks for sklearn which uses numpy.broadcast AKA PyArrayMultiIterObject.


@ngoldbaum this is an unfortuante quick followup on the MAXDIMS bump, as it breaks sklearn compiling (and maybe some others).

Cython is OK with increased sizes, but doesn't like shrinking an
object size.  We should fix this (providing a size to compare with
in the `pyd` maybe).  But just not including the end of the object
here publically is totally fine...

This makes `NPY_MAXARGS` also a *runtime* constant, since the
presumably only user (`numexpr`) should be better off with that
anyway.  Yes, they need to change the code to hard-code the maximum,
but they also need the NumPy cap from us anyway.

This is needed, because Cython breaks for sklearn which uses
`numpy.broadcast` AKA `PyArrayMultiIterObject`.
@seberg seberg force-pushed the NPY_MARGS-variable branch from 055cf57 to f60da51 Compare November 29, 2023 13:50
* to be runtime dependent.
*/
#if defined(NPY_INTERNAL_BUILD) && NPY_INTERNAL_BUILD
PyArrayIterObject *iters[64]; /* 64 is NPY_MAXARGS */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compat header is included later, so it could use these types in principle...

@seberg
Copy link
Member Author

seberg commented Nov 29, 2023

The sklearn issue and numexpr issue since I truly think there is a decent chance that numexpr is the only project that even notices.

@ngoldbaum
Copy link
Member

The cygwin tests failed initially so I re-triggered them and it seems to have been a flake. I'll merge this once that test run passes.

@ngoldbaum
Copy link
Member

Ah no, looks like a real failure. Multiarray doesn't import and then the diagnostic check finds:

Dependency checks
	cygblas-0.dll => not found
	cygblas-0.dll => not found
	cyglapack-0.dll => not found
	cyglapack-0.dll => not found

I know nothing about cygwin so don't know if this is related to this change...

@seberg
Copy link
Member Author

seberg commented Nov 29, 2023

Not sure, was also hoping it was just fluking out, but if it is fluking, it is fluking on all PRs right now.

@ngoldbaum
Copy link
Member

OK, must have been some upstream change in a github action or cygwin. Since CI is failing on other PRs in the same way let's merge this to unblock scikit-learn's testing against numpy dev.

@ngoldbaum ngoldbaum merged commit 7f8dc13 into numpy:main Nov 29, 2023
@seberg seberg deleted the NPY_MARGS-variable branch November 29, 2023 15:40
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.

2 participants