Skip to content

Commit c36cf72

Browse files
committed
Disallow inputs to dpnp_fill on separate queues
1 parent f8e058c commit c36cf72

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dpnp/dpnp_algo/dpnp_fill.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
# *****************************************************************************
2626

2727
import dpctl.tensor as dpt
28+
import dpctl.utils as dpu
2829
import numpy as np
2930
from dpctl.tensor._tensor_impl import (
3031
_copy_usm_ndarray_into_usm_ndarray,
3132
_full_usm_ndarray,
3233
_zeros_usm_ndarray,
3334
)
34-
from dpctl.utils import SequentialOrderManager
3535

3636
import dpnp
3737

@@ -46,14 +46,18 @@ def dpnp_fill(arr, val):
4646
val = dpnp.get_usm_ndarray(val)
4747
if val.shape != ():
4848
raise ValueError("`val` must be a scalar")
49+
if dpu.get_execution_queue((exec_q, val.sycl_queue)) is None:
50+
raise dpu.ExecutionPlacementError(
51+
"Input arrays have incompatible queues."
52+
)
4953
a_val = dpt.asarray(
5054
val,
5155
dtype=arr.dtype,
5256
usm_type=arr.usm_type,
5357
sycl_queue=exec_q,
5458
)
5559
a_val = dpt.broadcast_to(a_val, arr.shape)
56-
_manager = SequentialOrderManager[exec_q]
60+
_manager = dpu.SequentialOrderManager[exec_q]
5761
dep_evs = _manager.submitted_events
5862
h_ev, c_ev = _copy_usm_ndarray_into_usm_ndarray(
5963
src=a_val, dst=arr, sycl_queue=exec_q, depends=dep_evs
@@ -74,7 +78,7 @@ def dpnp_fill(arr, val):
7478
elif val_type is int and dpnp.issubdtype(dt, dpnp.integer):
7579
val = np.asarray(val, dtype=dt)[()]
7680

77-
_manager = SequentialOrderManager[exec_q]
81+
_manager = dpu.SequentialOrderManager[exec_q]
7882
dep_evs = _manager.submitted_events
7983
# can leverage efficient memset when val is 0
8084
if arr.flags["FORC"] and val == 0:

0 commit comments

Comments
 (0)