I’ve just released a small package on pypi called numba-ufunc-hooks:
It may be of interest as it contains a strategy for accessing internal numpy ufunc code. It only contains overloads for np.fft.{r,i,ir}fft at present, so it’s not very comprehensive and probably will never aim to be as this would supporting full ufunc generality (promotion etc.).
Briefly, the strategy gain’s access to the internal function pointers of numpy ufuncs using a (minimal) ctypes struct mirroring the C PyUfuncObject struct. Then, the function is invoked from an intrinsic with the appropriate arguments. To support caching, the ctypes ufunc objects are stored in a global variable accessible to LLVM at process startup.
Related prior discussions: