-
Notifications
You must be signed in to change notification settings - Fork 30
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
Unexpected result from divide-like ufuncs with unsigned integer array and negative integer scalar as inputs #1711
Comments
The cases with The remaining cases are illegal as of Numpy 2.0:
this is with dpctl 0.17.0 and Numpy 2.0.0rc2 #1650 fixed some issues with unsigned integers in the comparison functions, but some issues still remain. In general, it seems that calls to elementwise functions need to be revisited to do more sophisticated type and value checking for Python scalars to avoid these issues. For the divide cases, I suspect that the Python scalar is being cast to to unsigned integer out-of-bounds, then used in divide, resulting in bad data. Perhaps cases with scalars can take a fast-path for some functions to promote to the output type, rather than the type of the other array. This avoids bringing the scalar to the device once and then copying it immediately afterward, as well. |
As an update, with dpctl now working with Numpy 2.0, none of these cases work. This is probably good and expected for The case with |
The below example demonstrates unexpected dpctl behavior for
divide
,floor_divide
andremainder
binary functions.The issue is visible when one of the input has unsinged integer type, while another input is negative integer scalar.
Here is an example for
divide
:similar with
floor_divide
:and
remainder
:The text was updated successfully, but these errors were encountered: