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
Added overload methods for Numpy's ufunc.reduce #7524
Conversation
) | ||
|
||
fn = cgutils.get_or_insert_function( | ||
builder.module, fnty, "dufunc_reduce_direct" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current issue I was facing is that this call cannot detect the implemented dufunc_reduce_direct
method in C code. Is it a type
issue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add the symbol - try using llvmlite.binding.add_symbol('dufunc_reduce_direct', <addr of dufunc_reduce_direct>)
numba/np/ufunc/_internal.c
Outdated
@@ -344,6 +344,29 @@ init_ufunc_dispatch(void) | |||
return result; | |||
} | |||
|
|||
|
|||
NUMBA_EXPORT_FUNC(PyObject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not too familiar with this C function declarations of Numba so I might be doing something wrong here.
(Looking at the failing build)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to wrap the return type in NUMBA_EXPORT_FUNC
(at least for now) - can you try without it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think this should be returning a PyObject*
since, that's what a PyCFunctionWithKeywords
returns: https://docs.python.org/3/c-api/structures.html#c.PyCFunctionWithKeywords
…ded tests Co-authored-by: Brandon Willard <brandonwillard@users.noreply.github.com>
…np/ufunc/dufunc.py
a0e2e21
to
df89966
Compare
Reference an existing issue
Resolves #6313 #2751
This PR aims to implement the
numpy.ufunc.METHOD
as a callable insidenjit
-ed functions so that we can do stuff like: