-
Notifications
You must be signed in to change notification settings - Fork 7
Add initial version of ufunc tests #21
base: pydppl
Are you sure you want to change the base?
Conversation
numba/dppl/tests/dppl/test_ufuncs.py
Outdated
|
||
input_types = (input_type,) * ufunc.nin | ||
output_types = (output_type,) * ufunc.nout | ||
cfunc = dppl.kernel(pyfunc) |
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.
We are supposed to test the numpy compatibility for numba.njit(parallel:{'offload':True}) as well
continue | ||
|
||
output_type = self._determine_output_type( | ||
input_type, int_output_type, float_output_type) |
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 issue with testing some functions (e.g. sin, cos) for integer is the incompatibility of the dtype of the output buffer we pass and the actual output. For integer input we need a float type output for function like cos. We need to make changes in _determine_output_type() to accomodate this.
numba/dppl/tests/dppl/test_ufuncs.py
Outdated
enable_pyobj_flags.set("no_rewrites") | ||
|
||
no_pyobj_flags = Flags() | ||
no_pyobj_flags.set("no_rewrites") |
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.
This flag might prevent rewrite of numpy calls to array expressions, which in turn will prevent us from generating parfor nodes. The parfor nodes trigger the gpu code generation.
@reazulhoque I fixed all according your comments, could you please take a look? |
input_types = (input_type,) * ufunc.nin | ||
output_types = (output_type,) * ufunc.nout | ||
cfunc_kernel = dppl.kernel(pyfunc) | ||
cfunc = njit(parallel={'offload':True})(pyfunc) |
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.
Unfortunately numba is not rewriting this ufuncs as array expression because the output argument is being provided. (https://github.com/IntelPython/numba/blob/pydppl/numba/np/ufunc/array_exprs.py#L88)
We need to find a solution to this as without the ufuncs being rewritten as array expression we will not generate a parfor node and in turn will not create a GPU kernel for it.
No description provided.