-
Notifications
You must be signed in to change notification settings - Fork 89
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
Move size information out of Numba type #1343
Comments
I know we talked about this somewhere (Gitter?). In light of all the things that have to get done, I'm going to mark this as "wontfix" because baking the size information into the type is what a RegularArray is. That makes it not quite the same as a NumPy array in a precompiled context. It does have consequences for performance: different regular sizes force Numba to recompile functions, as you point out, but it also injects a constant into loops for LLVM to optimize, whereas Numba's NumPy handling can't perform that optimization. So you gain on runtime and lose in compilation time. Interestingly, the Numba team was discussing the possibility of going the other way with their NumPy handling (as an option, not a requirement). What we're talking about here should be considered a new type.
That middle case would have to store its Adding a new node type is a big project, and it would differ from an existing node in a subtle way. And on top of that, we just have so much to do. |
Definitely not proposing a new node type, particularly not when it would only be required to support Numba!
This was what I was thinking of. However, it might be that we just accept that users need to be aware of these cases. Where users have layouts that change in regular size, they would need to convert the layout to jagged lists ahead-of-time.
Huh, I hadn't seen that. Interesting. The motivation for filing this issue was that we differ from Numba, so when a user has a The other issues that we have to work on certainly take precedence over this one. Maybe we'll revisit it in the future if we find it is a pressing concern. |
Description of new feature
The existing Numba support for Awkward includes known size information in the type. This differs from the way that NumPy arrays are handled, where the shape information is separate to the type. The consequence of this is that whenever the size of an array changes, so too does the type, and thus Numba recompiles the function for the input.
>>> numba.typeof(ak.from_numpy(np.identity(3))) ak.ArrayView(ak.RegularArrayType(ak.NumpyArrayType(array(float64, 1d, A), none, {}), 3, none, {}), None, ())
>>> numba.typeof(np.identity(3)) array(float64, 2d, C)
To be clear, it is the
RegularArray
size that denotes the length of the sublists that is included.The text was updated successfully, but these errors were encountered: