Skip to content

Commit 12c5c23

Browse files
author
Diptorup Deb
committed
Fix bug in getitem_arraynd_intp for dpnp.ndarray
- The dpnp.ndarray overload for getitem_arraynd_intp involves updating the sycl_queue object when __getitem__ returns a view. The existing implementation was trying to do so even when __getitem__ returns a scalar. Adds an extra check to avoid the problem.
1 parent 67ba7de commit 12c5c23

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

numba_dpex/dpnp_iface/arrayobj.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,12 +1075,13 @@ def getitem_arraynd_intp(context, builder, sig, args):
10751075
"""
10761076
ret = np_getitem_arraynd_intp(context, builder, sig, args)
10771077

1078-
array_val = args[0]
1079-
array_ty = sig.args[0]
1080-
sycl_queue_attr_pos = dpex_dmm.lookup(array_ty).get_field_position(
1081-
"sycl_queue"
1082-
)
1083-
sycl_queue_attr = builder.extract_value(array_val, sycl_queue_attr_pos)
1084-
ret = builder.insert_value(ret, sycl_queue_attr, sycl_queue_attr_pos)
1078+
if isinstance(sig.return_type, DpnpNdArray):
1079+
array_val = args[0]
1080+
array_ty = sig.args[0]
1081+
sycl_queue_attr_pos = dpex_dmm.lookup(array_ty).get_field_position(
1082+
"sycl_queue"
1083+
)
1084+
sycl_queue_attr = builder.extract_value(array_val, sycl_queue_attr_pos)
1085+
ret = builder.insert_value(ret, sycl_queue_attr, sycl_queue_attr_pos)
10851086

10861087
return ret

0 commit comments

Comments
 (0)