Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
d4fd805
Rename folder dpctl to dpctl_ext
vlad-perevezentsev Feb 2, 2026
c040713
Add simplify_iteration_space implementation to libtensor
vlad-perevezentsev Feb 5, 2026
14b466f
Extend codespell ignore list for libtensor
vlad-perevezentsev Feb 5, 2026
dcc421b
Add copy_and_cast kernels to libtensor
vlad-perevezentsev Feb 5, 2026
5a9c14c
Add copy_usm_ndarray_into_usm_ndarray implementation
vlad-perevezentsev Feb 5, 2026
4f63340
Add pybind11 bindings for dpctl_ext.tensor._tensor_impl
vlad-perevezentsev Feb 5, 2026
634579c
Add CMake build files for dpctl_ext
vlad-perevezentsev Feb 5, 2026
79d40f2
Add empty __init__ to dpctl_ext/
vlad-perevezentsev Feb 5, 2026
7949c17
Enable _same_logical_tensors in _tensor_impl
vlad-perevezentsev Feb 5, 2026
29d6c02
Add device_support_queries to enable default device types
vlad-perevezentsev Feb 5, 2026
936e719
Enable building and packaging of dpctl_ext
vlad-perevezentsev Feb 5, 2026
cd85f1e
Use _tensor_impl from dpctl_ext.tensor in dpnp
vlad-perevezentsev Feb 5, 2026
0c6780a
Move put() and take() to dpctl_ext/tensor
vlad-perevezentsev Feb 5, 2026
87e5482
Use put/take from dpctl_ext.tensor in dpnp
vlad-perevezentsev Feb 5, 2026
b537f30
Move full() to dpctl_ext/tensor
vlad-perevezentsev Feb 5, 2026
d50f263
Use full and _full_usm_ndarray from dpctl_ext in dpnp
vlad-perevezentsev Feb 6, 2026
f189dc5
Update .gitignore to ignore .so files in dpctl_ext
vlad-perevezentsev Feb 6, 2026
f9a1817
Move _zeros_usm_ndarray to dpctl_ext
vlad-perevezentsev Feb 6, 2026
4b8505a
Use _zeros_usm_ndarray from dpctl_ext in dpnp_fill.py
vlad-perevezentsev Feb 6, 2026
61106b2
Move linear-sequence implementations to dpctl_ext/tensor
vlad-perevezentsev Feb 6, 2026
a030579
Use _tensor_impl from dpctl_ext in dpnp_utils_fft.py
vlad-perevezentsev Feb 6, 2026
a1d6fa3
Move tril()/triu() to dpctl_ext/tensor
vlad-perevezentsev Feb 6, 2026
f1d6e56
Use tril/triu/_tril from dpctl_ext.tensor in dpnp
vlad-perevezentsev Feb 6, 2026
6680790
Disable pylint no-name-in-module for dpctl_ext
vlad-perevezentsev Feb 9, 2026
263b717
Add TODO comments
vlad-perevezentsev Feb 12, 2026
4130c1b
Use default_device_complex_type from dpctl_ext on test_array_api_info.py
vlad-perevezentsev Feb 12, 2026
17ca9ab
Remove unused build_dpctl_ext function
vlad-perevezentsev Feb 12, 2026
79cb2a4
Apply remarks for CMake files
vlad-perevezentsev Feb 12, 2026
4bf080e
Apply remarks for c++ files
vlad-perevezentsev Feb 12, 2026
cfa6cd6
Remove linear-sequence implementations
vlad-perevezentsev Feb 16, 2026
e0e50ac
Merge move_tensor_impl_ext into move_tensor_impl_ext_part_2
vlad-perevezentsev Feb 16, 2026
087a2ec
Use _tensor_impl from dpctl_ext in dpnp
vlad-perevezentsev Feb 16, 2026
f4492fb
Add missing include
vlad-perevezentsev Feb 16, 2026
b367c9f
Use nested namespace syntax
vlad-perevezentsev Feb 16, 2026
3113716
Add missing include complex
vlad-perevezentsev Feb 17, 2026
978afee
Add missing memory and queue checks
vlad-perevezentsev Feb 17, 2026
fec84ec
Move ti._copy_numpy_ndarray_into_usm_ndarray()
vlad-perevezentsev Feb 17, 2026
497e810
Move asnumpy(),from_numpy(), to_numpy() to dpctl_ext/tensor
vlad-perevezentsev Feb 17, 2026
3be4e14
Update dpnp.asnumpy to use dpctl_ext functions
vlad-perevezentsev Feb 17, 2026
1d88365
Move copy(), astype() to dpctl_ext/tensor
vlad-perevezentsev Feb 17, 2026
fd18db0
reuse astype(), copy() from dpctl_ext
vlad-perevezentsev Feb 17, 2026
0976171
Move _copy_usm_ndarray_for_reshape
vlad-perevezentsev Feb 17, 2026
318692e
Move reshape() to dpctl_ext/tensor
vlad-perevezentsev Feb 17, 2026
3c0c113
Reuse reshape from dpctl_ext in dpnp
vlad-perevezentsev Feb 17, 2026
30f2c53
Move _copy_usm_ndarray_for_roll
vlad-perevezentsev Feb 17, 2026
85c29da
Move roll() to dpctl_ext/tensor
vlad-perevezentsev Feb 17, 2026
6e8d857
Update dpnp.roll to use dpctl_ext
vlad-perevezentsev Feb 17, 2026
19e93b9
Update .gitignore to ignore .so files in dpctl_ext
vlad-perevezentsev Feb 18, 2026
b111e49
Remove unused includes in tensor_ctors.cpp
vlad-perevezentsev Feb 18, 2026
c082224
Use Python::Module for dpctl_ext static lib to avoid libpython depend…
vlad-perevezentsev Feb 18, 2026
9e7deb3
Merge move_tensor_impl_ext into move_tensor_impl_ext_part_2
vlad-perevezentsev Feb 18, 2026
1a736f7
Merge include-dpctl-tensor into move_tensor_impl_ext_part_2
vlad-perevezentsev Feb 19, 2026
8bde614
Merge move_tensor_impl_ext_part_2 into move_tensor_impl_copy
vlad-perevezentsev Feb 19, 2026
c3bc8ba
Move ti.mask_positions() and ti._cumsum_1d()
vlad-perevezentsev Feb 19, 2026
69b36b2
Move ti._extract(), ti._place(), ti._nonzero()
vlad-perevezentsev Feb 19, 2026
70a0fc6
Move place() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 19, 2026
afa5411
Move extract() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 19, 2026
7feb4ee
Move nonzero() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 19, 2026
f63f2f0
Move put_along_axis to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 19, 2026
6fecefe
Move take_along_axis() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 19, 2026
b60d095
Move ti._eye to() to dpctl_ext/tensor/libtensor
vlad-perevezentsev Feb 19, 2026
a1eea4e
Move eye() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 19, 2026
95ccf70
Move ti._repeat... to dpctl_ext/tensor
vlad-perevezentsev Feb 19, 2026
43f97cf
Move repeat() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 19, 2026
9b248f4
Move ti._where() to dpctl_ext/tensor/libtensor
vlad-perevezentsev Feb 19, 2026
24425cf
Move _type_utils.py to dpctl_ext/tensor
vlad-perevezentsev Feb 19, 2026
c88297c
Use import _type_utils from dpctl_ext
vlad-perevezentsev Feb 20, 2026
9207fc5
Move _broadcast_shape_impl to dpctl_ext/tenspr/_manipulation_fucntion…
vlad-perevezentsev Feb 20, 2026
ebbce34
Reuse can_cast() from dpctl_ext/tensor
vlad-perevezentsev Feb 20, 2026
6a13333
Reuse finfo(), iinfo(), isdtype() from dpctl_ext/tensor
vlad-perevezentsev Feb 20, 2026
de2c429
Reuse result_type() from dpctl_ext/tensor
vlad-perevezentsev Feb 20, 2026
9a97002
Move _scalar_utils.py to dpctl_ext/tensor
vlad-perevezentsev Feb 20, 2026
15c467d
Move where() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 20, 2026
134bb35
Update imports in dpnp/dpnp_iface_indexing.py
vlad-perevezentsev Feb 20, 2026
5fa6ee7
Merge move_tensor_impl_accum_bool_ind_eye into move_tensor_impl_repea…
vlad-perevezentsev Feb 20, 2026
c58b531
Enable -fno-fast-math compiler flag
vlad-perevezentsev Feb 20, 2026
4f00632
Move _clip to dpctl_ext/tensor/libtensor
vlad-perevezentsev Feb 20, 2026
5d45d85
Move clip() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 20, 2026
e70425b
Populate dispatch tables with where
vlad-perevezentsev Feb 20, 2026
36919c1
Move _linspace_step/_linspace_affine to dpctl_ext/tensor/libtensor
vlad-perevezentsev Feb 23, 2026
95ac4f7
Move ti.linspace() and reuse it in dpnp
vlad-perevezentsev Feb 23, 2026
1054e2d
Move ti.empty() and reuse it in dpctl_ext/tensor
vlad-perevezentsev Feb 23, 2026
d493454
Reuse dpctl_ext.tensor.empty() in dpnp
vlad-perevezentsev Feb 23, 2026
186ae3c
Move ti.empty_like() and reuse it in dpctl_ext/tensor
vlad-perevezentsev Feb 23, 2026
5503b9a
Reuse dpctl_ext.tensor.empty_like() in dpnp
vlad-perevezentsev Feb 23, 2026
748c5b5
Move ti.arange() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 23, 2026
a7370a8
Move ti.asarray() and reuse it in dpctl_ext/tensor
vlad-perevezentsev Feb 23, 2026
effcbe8
Reuse dpctl_ext.tensor.asarray() in dpnp
vlad-perevezentsev Feb 23, 2026
f9f547a
Move ti.full_like() to dpctl_ext/tensor
vlad-perevezentsev Feb 23, 2026
0d84d7b
Move ti.meshgrid() to dpctl_ext/tensor
vlad-perevezentsev Feb 23, 2026
8c15ddb
Move ti.ones() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 23, 2026
23d2229
Move ti.ones_like() to dpctl_ext/tensor
vlad-perevezentsev Feb 23, 2026
97dc7e1
Move ti.zeros() to dpctl_ext/tensor and reuse it in dpnp
vlad-perevezentsev Feb 23, 2026
a6c397e
Move ti.zeros_like() to dpctl_ext/tensor
vlad-perevezentsev Feb 23, 2026
b8c5390
Move ti.broadcast_to() to dpctl_ext/tensor and reuse it in dpctl_ext/…
vlad-perevezentsev Feb 23, 2026
a7cbfdc
Reuse dpctl_ext.tensor.broadcast_to() in dpnp
vlad-perevezentsev Feb 23, 2026
bd265da
Move ti.broadcast_arrays() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
080c7d8
Move ti.concat() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
ea7ea3c
Move ti.expand_dims() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
d2e9279
Move ti.flip() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
4e63cca
Move ti.permute_dims() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
9c88edb
Move ti.moveaxis() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
ba51636
Move ti.squeeze() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
bb16c19
Move ti.stack() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
ccad5f0
Move ti.swapaxes() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
b5e3541
Move ti.tile() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
325729b
Move ti.unstack() to dpctl_ext.tensor and reuse it
vlad-perevezentsev Feb 23, 2026
da8d6fb
Merge include-dpctl-tensor into move_tensor_impl_repeat_where_clip
vlad-perevezentsev Mar 3, 2026
a0e2933
Import where from dpctl_ext
vlad-perevezentsev Mar 3, 2026
0ded248
Use import from dpctl_ext for _type_utils
vlad-perevezentsev Mar 4, 2026
39912ae
Use import from dpctl_ext for _numpy_helper
vlad-perevezentsev Mar 4, 2026
ac2a711
Use a relative path in __init__.py
vlad-perevezentsev Mar 4, 2026
e7d45ab
Use a relative path in python tensor files
vlad-perevezentsev Mar 4, 2026
ba0699c
Remove redundant dpctl::tensor::py_internal qualifiers
vlad-perevezentsev Mar 4, 2026
f46a031
Clean up includes
vlad-perevezentsev Mar 4, 2026
26c6ff6
Use import from dpctl_ext for _scalar_utils
vlad-perevezentsev Mar 4, 2026
1837844
Use dpctl.tensor._scakal_utils for elementwise
vlad-perevezentsev Mar 4, 2026
32b2490
Add include <cassert>
vlad-perevezentsev Mar 5, 2026
b1451fe
Merge include-dpctl-tensor into move_tensor_impl_repeat_where_clip
vlad-perevezentsev Mar 5, 2026
d759157
Merge move_tensor_impl_repeat_where_clip into move_tensor_impl_linear…
vlad-perevezentsev Mar 5, 2026
7347d1c
Clean up uncludes
vlad-perevezentsev Mar 5, 2026
e7cb910
Use a relative path in python tensor files
vlad-perevezentsev Mar 5, 2026
85de2e5
Reuse functions from dpctl_ext.tensor in dpnp
vlad-perevezentsev Mar 5, 2026
ec2416b
Merge include-dpctl-tensor into move_tensor_impl_linear_sequence
vlad-perevezentsev Mar 5, 2026
0d30fc5
Apply remarks
vlad-perevezentsev Mar 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dpctl_ext/tensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set(_tensor_impl_sources
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_reshape.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_roll.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/integer_advanced_indexing.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/boolean_advanced_indexing.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/eye_ctor.cpp
Expand Down Expand Up @@ -93,7 +93,7 @@ endif()
set(_no_fast_math_sources
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_and_cast_usm_to_usm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/full_ctor.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/clip.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/where.cpp
)
Expand Down
46 changes: 46 additions & 0 deletions dpctl_ext/tensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,21 @@
to_numpy,
)
from ._ctors import (
arange,
asarray,
empty,
empty_like,
eye,
full,
full_like,
linspace,
meshgrid,
ones,
ones_like,
tril,
triu,
zeros,
zeros_like,
)
from ._indexing_functions import (
extract,
Expand All @@ -51,38 +62,73 @@
take_along_axis,
)
from ._manipulation_functions import (
broadcast_arrays,
broadcast_to,
concat,
expand_dims,
flip,
moveaxis,
permute_dims,
repeat,
roll,
squeeze,
stack,
swapaxes,
tile,
unstack,
)
from ._reshape import reshape
from ._search_functions import where
from ._type_utils import can_cast, finfo, iinfo, isdtype, result_type

__all__ = [
"arange",
"asarray",
"asnumpy",
"astype",
"broadcast_arrays",
"broadcast_to",
"can_cast",
"concat",
"copy",
"clip",
"empty",
"empty_like",
"extract",
"expand_dims",
"eye",
"finfo",
"flip",
"from_numpy",
"full",
"full_like",
"iinfo",
"isdtype",
"linspace",
"meshgrid",
"moveaxis",
"permute_dims",
"nonzero",
"ones",
"ones_like",
"place",
"put",
"put_along_axis",
"repeat",
"reshape",
"result_type",
"roll",
"squeeze",
"stack",
"swapaxes",
"take",
"take_along_axis",
"tile",
"to_numpy",
"tril",
"triu",
"unstack",
"where",
"zeros",
"zeros_like",
]
74 changes: 37 additions & 37 deletions dpctl_ext/tensor/_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,20 @@ def _clip_none(x, val, out, order, _binary_fn):

if ti._array_overlap(x, out):
if not ti._same_logical_tensors(x, out):
out = dpt.empty_like(out)
out = dpt_ext.empty_like(out)

if isinstance(val, dpt.usm_ndarray):
if (
ti._array_overlap(val, out)
and not ti._same_logical_tensors(val, out)
and val_dtype == res_dt
):
out = dpt.empty_like(out)
out = dpt_ext.empty_like(out)

if isinstance(val, dpt.usm_ndarray):
val_ary = val
else:
val_ary = dpt.asarray(val, dtype=val_dtype, sycl_queue=exec_q)
val_ary = dpt_ext.asarray(val, dtype=val_dtype, sycl_queue=exec_q)

if order == "A":
order = (
Expand All @@ -197,17 +197,17 @@ def _clip_none(x, val, out, order, _binary_fn):
x, val_ary, res_dt, res_shape, res_usm_type, exec_q
)
else:
out = dpt.empty(
out = dpt_ext.empty(
res_shape,
dtype=res_dt,
usm_type=res_usm_type,
sycl_queue=exec_q,
order=order,
)
if x_shape != res_shape:
x = dpt.broadcast_to(x, res_shape)
x = dpt_ext.broadcast_to(x, res_shape)
if val_ary.shape != res_shape:
val_ary = dpt.broadcast_to(val_ary, res_shape)
val_ary = dpt_ext.broadcast_to(val_ary, res_shape)
_manager = SequentialOrderManager[exec_q]
dep_evs = _manager.submitted_events
ht_binary_ev, binary_ev = _binary_fn(
Expand All @@ -229,7 +229,7 @@ def _clip_none(x, val, out, order, _binary_fn):
if order == "K":
buf = _empty_like_orderK(val_ary, res_dt)
else:
buf = dpt.empty_like(val_ary, dtype=res_dt, order=order)
buf = dpt_ext.empty_like(val_ary, dtype=res_dt, order=order)
_manager = SequentialOrderManager[exec_q]
dep_evs = _manager.submitted_events
ht_copy_ev, copy_ev = ti._copy_usm_ndarray_into_usm_ndarray(
Expand All @@ -242,7 +242,7 @@ def _clip_none(x, val, out, order, _binary_fn):
x, buf, res_dt, res_shape, res_usm_type, exec_q
)
else:
out = dpt.empty(
out = dpt_ext.empty(
res_shape,
dtype=res_dt,
usm_type=res_usm_type,
Expand All @@ -251,8 +251,8 @@ def _clip_none(x, val, out, order, _binary_fn):
)

if x_shape != res_shape:
x = dpt.broadcast_to(x, res_shape)
buf = dpt.broadcast_to(buf, res_shape)
x = dpt_ext.broadcast_to(x, res_shape)
buf = dpt_ext.broadcast_to(buf, res_shape)
ht_binary_ev, binary_ev = _binary_fn(
src1=x,
src2=buf,
Expand Down Expand Up @@ -353,14 +353,14 @@ def clip(x, /, min=None, max=None, out=None, order="K"):

if ti._array_overlap(x, out):
if not ti._same_logical_tensors(x, out):
out = dpt.empty_like(out)
out = dpt_ext.empty_like(out)
else:
return out
else:
if order == "K":
out = _empty_like_orderK(x, x.dtype)
else:
out = dpt.empty_like(x, order=order)
out = dpt_ext.empty_like(x, order=order)

_manager = SequentialOrderManager[exec_q]
dep_evs = _manager.submitted_events
Expand Down Expand Up @@ -519,32 +519,32 @@ def clip(x, /, min=None, max=None, out=None, order="K"):

if ti._array_overlap(x, out):
if not ti._same_logical_tensors(x, out):
out = dpt.empty_like(out)
out = dpt_ext.empty_like(out)

if isinstance(min, dpt.usm_ndarray):
if (
ti._array_overlap(min, out)
and not ti._same_logical_tensors(min, out)
and buf1_dt is None
):
out = dpt.empty_like(out)
out = dpt_ext.empty_like(out)

if isinstance(max, dpt.usm_ndarray):
if (
ti._array_overlap(max, out)
and not ti._same_logical_tensors(max, out)
and buf2_dt is None
):
out = dpt.empty_like(out)
out = dpt_ext.empty_like(out)

if isinstance(min, dpt.usm_ndarray):
a_min = min
else:
a_min = dpt.asarray(min, dtype=min_dtype, sycl_queue=exec_q)
a_min = dpt_ext.asarray(min, dtype=min_dtype, sycl_queue=exec_q)
if isinstance(max, dpt.usm_ndarray):
a_max = max
else:
a_max = dpt.asarray(max, dtype=max_dtype, sycl_queue=exec_q)
a_max = dpt_ext.asarray(max, dtype=max_dtype, sycl_queue=exec_q)

if order == "A":
order = (
Expand Down Expand Up @@ -572,19 +572,19 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
exec_q,
)
else:
out = dpt.empty(
out = dpt_ext.empty(
res_shape,
dtype=res_dt,
usm_type=res_usm_type,
sycl_queue=exec_q,
order=order,
)
if x_shape != res_shape:
x = dpt.broadcast_to(x, res_shape)
x = dpt_ext.broadcast_to(x, res_shape)
if a_min.shape != res_shape:
a_min = dpt.broadcast_to(a_min, res_shape)
a_min = dpt_ext.broadcast_to(a_min, res_shape)
if a_max.shape != res_shape:
a_max = dpt.broadcast_to(a_max, res_shape)
a_max = dpt_ext.broadcast_to(a_max, res_shape)
_manager = SequentialOrderManager[exec_q]
dep_ev = _manager.submitted_events
ht_binary_ev, binary_ev = ti._clip(
Expand Down Expand Up @@ -612,7 +612,7 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
if order == "K":
buf2 = _empty_like_orderK(a_max, buf2_dt)
else:
buf2 = dpt.empty_like(a_max, dtype=buf2_dt, order=order)
buf2 = dpt_ext.empty_like(a_max, dtype=buf2_dt, order=order)
_manager = SequentialOrderManager[exec_q]
dep_ev = _manager.submitted_events
ht_copy_ev, copy_ev = ti._copy_usm_ndarray_into_usm_ndarray(
Expand All @@ -631,18 +631,18 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
exec_q,
)
else:
out = dpt.empty(
out = dpt_ext.empty(
res_shape,
dtype=res_dt,
usm_type=res_usm_type,
sycl_queue=exec_q,
order=order,
)

x = dpt.broadcast_to(x, res_shape)
x = dpt_ext.broadcast_to(x, res_shape)
if a_min.shape != res_shape:
a_min = dpt.broadcast_to(a_min, res_shape)
buf2 = dpt.broadcast_to(buf2, res_shape)
a_min = dpt_ext.broadcast_to(a_min, res_shape)
buf2 = dpt_ext.broadcast_to(buf2, res_shape)
ht_binary_ev, binary_ev = ti._clip(
src=x,
min=a_min,
Expand All @@ -668,7 +668,7 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
if order == "K":
buf1 = _empty_like_orderK(a_min, buf1_dt)
else:
buf1 = dpt.empty_like(a_min, dtype=buf1_dt, order=order)
buf1 = dpt_ext.empty_like(a_min, dtype=buf1_dt, order=order)
_manager = SequentialOrderManager[exec_q]
dep_ev = _manager.submitted_events
ht_copy_ev, copy_ev = ti._copy_usm_ndarray_into_usm_ndarray(
Expand All @@ -687,18 +687,18 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
exec_q,
)
else:
out = dpt.empty(
out = dpt_ext.empty(
res_shape,
dtype=res_dt,
usm_type=res_usm_type,
sycl_queue=exec_q,
order=order,
)

x = dpt.broadcast_to(x, res_shape)
buf1 = dpt.broadcast_to(buf1, res_shape)
x = dpt_ext.broadcast_to(x, res_shape)
buf1 = dpt_ext.broadcast_to(buf1, res_shape)
if a_max.shape != res_shape:
a_max = dpt.broadcast_to(a_max, res_shape)
a_max = dpt_ext.broadcast_to(a_max, res_shape)
ht_binary_ev, binary_ev = ti._clip(
src=x,
min=buf1,
Expand Down Expand Up @@ -736,7 +736,7 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
if order == "K":
buf1 = _empty_like_orderK(a_min, buf1_dt)
else:
buf1 = dpt.empty_like(a_min, dtype=buf1_dt, order=order)
buf1 = dpt_ext.empty_like(a_min, dtype=buf1_dt, order=order)

_manager = SequentialOrderManager[exec_q]
dep_evs = _manager.submitted_events
Expand All @@ -747,7 +747,7 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
if order == "K":
buf2 = _empty_like_orderK(a_max, buf2_dt)
else:
buf2 = dpt.empty_like(a_max, dtype=buf2_dt, order=order)
buf2 = dpt_ext.empty_like(a_max, dtype=buf2_dt, order=order)
ht_copy2_ev, copy2_ev = ti._copy_usm_ndarray_into_usm_ndarray(
src=a_max, dst=buf2, sycl_queue=exec_q, depends=dep_evs
)
Expand All @@ -758,17 +758,17 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
x, buf1, buf2, res_dt, res_shape, res_usm_type, exec_q
)
else:
out = dpt.empty(
out = dpt_ext.empty(
res_shape,
dtype=res_dt,
usm_type=res_usm_type,
sycl_queue=exec_q,
order=order,
)

x = dpt.broadcast_to(x, res_shape)
buf1 = dpt.broadcast_to(buf1, res_shape)
buf2 = dpt.broadcast_to(buf2, res_shape)
x = dpt_ext.broadcast_to(x, res_shape)
buf1 = dpt_ext.broadcast_to(buf1, res_shape)
buf2 = dpt_ext.broadcast_to(buf2, res_shape)
ht_, clip_ev = ti._clip(
src=x,
min=buf1,
Expand Down
Loading
Loading