-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
Description
In the numba backend (and all Jitted backends), we massage constants into global variables of the codegen function.
This poses has a couple of issues for the Numba backend:
- Functions with large arrays can't be cached
- The number of cached functions grows with small differences in the global arrays, but otherwise identical structure (not sure how common)
- Functions with more esoteric constant types can't be compiled: SparseVariables, RandomGenerator, TypedLists (see failures in Implement Sparse Ops in Numba #1676 and Run whole test suite on numba backend #811)
We could adopt the approach that the C-backend takes, which is to just use pointers to the storage list created by PyTensor function, for these constants. We only inline scalars in the C-backend codegen. This would work-around all the issues listed above.
On the downside, I'm not sure how hard it would make things for nutpie. CC @aseyboldt