-
Notifications
You must be signed in to change notification settings - Fork 33
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
numba_dpex's kernel disregards strides of input array #572
Comments
This is a limitation of how numba-dppy supports dpnp features. I will qualify it as an enhancement for future work. |
I think for preventing this situation numba-dppy should raise exception if receives array w/ strides. |
A better minimal reproducer: @dpex.kernel
def change_values(x):
i = dpex.get_global_id(0)
x[i] = -3
N = 10
out = dpnp.arange(0, 20, dtype=dpnp.int64)
b = out[::2]
print(f"out = {out}, out.shape = {out.shape}, out.strides = {out.strides}")
print(f"b = {b}, b.shape = {b.shape}, b.strides = {b.strides}")
change_values[dpex.Range(N)](b)
print(f"out = {out}, out.shape = {out.shape}, out.strides = {out.strides}")
print(f"b = {b}, b.shape = {b.shape}, b.strides = {b.strides}") output: out = [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19], out.shape = (20,), out.strides = (1,)
b = [ 0 2 4 6 8 10 12 14 16 18], b.shape = (10,), b.strides = (2,)
out = [ -3 -3 -12884901886 -8589934593 4294967295
-3 -3 -12884901881 -8589934593 4294967295
-3 -3 12 13 14
15 16 17 18 19], out.shape = (20,), out.strides = (1,)
b = [ -3 -12884901886 4294967295 -3 -8589934593
-3 12 14 16 18], b.shape = (10,), b.strides = (2,) Expected output: out = [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19], out.shape = (20,), out.strides = (1,)
b = [ 0 2 4 6 8 10 12 14 16 18], b.shape = (10,), b.strides = (2,)
out = [ -3 1 -3 3 -3 5 -3 7 -3 9 -3 11 -3 13 -3 15 -3 17 -3 19], out.shape = (20,), out.strides = (1,)
b = [-3 -3 -3 -3 -3 -3 -3 -3 -3 -3], b.shape = (10,), b.strides = (2,) |
This is related to |
Resolved by #1271 |
#1271 works only in 1-dim case. If the array dimension is more than 1, the indexing doesn't skip the right amount of rows across the axis-0. Reopening. |
Resolved by #1285 |
Please close issues when the associated PR is merged. Reopening the ticket. |
Executing this script outputs
The expected result should have been
UPDATE : Updated the reproducer to work with latest numba-dpex.
The text was updated successfully, but these errors were encountered: