-
Notifications
You must be signed in to change notification settings - Fork 32
Pass to rewrite Numpy function names to be able to overload them for Numba-dppy pipeline #52
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
Pass to rewrite Numpy function names to be able to overload them for Numba-dppy pipeline #52
Conversation
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.
@reazulhoque mostly high-level comments. Watch out for DPPL to DPPY renaming as that is coming in next release. We need documentation and comments.
numba_dppy/dpnp_glue/dpnpimpl.py
Outdated
dpnp_lowering.ensure_dpnp(name) | ||
|
||
@classmethod | ||
def dpctl_get_current_queue(cls): |
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.
Why are we adding dpctl_*
methods under the _DPNP_EXTENSION
class? Any reason the class name is in all caps?
numba_dppy/dpnp_glue/dpnpimpl.py
Outdated
|
||
return dpnp_sum_impl | ||
|
||
''' |
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 am not a fan of having commented out code in the source. Please remove this code and bring it back once ready as a fresh PR.
numba_dppy/dpnp_glue/dpnpimpl.py
Outdated
return types.ExternalFunctionPointer(sig, get_pointer=get_pointer) | ||
|
||
@classmethod | ||
def dpnp_eig(cls, fn_name, type_names): |
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.
Since the overload is not yet ready, we should remove this function from this PR and bring it back in a follow up.
numba_dppy/dpnp_glue/stubs.py
Outdated
class sum(Stub): | ||
pass | ||
|
||
class eig(Stub): |
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.
same here.
numba_dppy/dppy_passbuilder.py
Outdated
@@ -2,30 +2,49 @@ | |||
|
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.
Was this file reformatted using black? We should avoid mixing reformatting with logical changes. Reformatting should be a separate PR. Otherwise it creates too much noise.
if isinstance(stmt, ir.Assign) and isinstance(stmt.value, ir.Expr): | ||
lhs = stmt.target.name | ||
rhs = stmt.value | ||
# replace np.func(sum) with name from self.function_name_map |
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.
not just np.sum
right?
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.
LGTM! merging this PR. Thanks!
…Numba-dppy pipeline (#52) * Sum example * Moved from infer_type, lower_builtin to overload * Added two level module name functions * Remove cython generated file * Module name fix for moving to new extension * Incomplete linalg.eig implementation * Updted all dppl to dppy and moved rewrite_numpy_function_pass to it's own file * Import module at correct locations * Added comments * Added test and updated comments * Revert unneeded changes * Update Eigen implementation * Remove eig implementation * Add checking equivalent IR Co-authored-by: reazul.hoque <reazul.hoque@intel.com>
The PR introduces a pass to rewrite the name of the Numpy function we intend to overload for Numba-dppy.
numba_dppy.dpnp.function_name
.numab_dppy.dpnp
module.@overload
decorator.Currnetly it has examples of how we can use this method to overload
np.sum
andnp.linalg.eig
(incomplete). We will need to port existing functions we provide support for and also new ones.