Repository navigation
ENH: Implement per-module state for lapack_lite to avoid global static states - #31928
Conversation
|
Please ensure everything passes locally before making a PR. Running CI isn't free; and the maintainers get a notification for each commit regardless of whether it's a draft. Also; AI disclosure |
|
Sorry I should have provided context from the start, I did compile and ran tests locally and they passed but since this PR tries to adopt to limited api I was afraid that it might fail on other systems. This PR is related to #31913. |
|
Ah actually the CI failure isn't your fault; see #31932 |
|
Out of curiosity, why is this needed? I don't think per-module state is needed for limited API support. Or are you also working on subinterpreter support? |
|
That would be my "fault".Yes, the goal of the internship is both tasks, as a modernization of the internal NumPy code base,and to see if these types of changes affect performance. |
Yes it's not "requirement" for limited api but since CPython is moving towards subinterpreters, @mattip and I discussed to start this effort with moving to per-module state. |
I ran the benchmarks ( |
|
My basic (untested) intuition about performance is that looking things up in the module state will almost certainly be slower than looking things up from a static global. But in this case it's only an exception that will almost never be used so it shouldn't make a huge difference |
902a8e8 to
070942a
Compare
|
This looks good and happy if you just move forward, thanks. But, maybe for for Matti to decide: Now that I see this, it seems to me that this whole module can probably be just deleted? The one confusing thing might be the |
|
The module is useful when there is no BLAS at all. |
|
Thanks @prathamhole14 |
That's the thing, though! lapack-lite is of course used, but it is used via |
|
That said, I guess technically |
|
Ahh, so the code is used but the module is not. Maybe we should deprecate the import and rename the module to |
|
Yeah, agreed. Since it is in principle public, let's just make sure to tag a deprecation warning on for now... Let me open an issue, it's a nice small one. |
|
Thanks! I’ll put a PR for it. |
PR summary
Related to: #31930 and #32451
AI Disclosure
Only for some research and improving comments.