Skip to content

Commit 9b5b38f

Browse files
committed
Add test for dpnp.empty() with dpjit queue arg
1 parent 863c7ad commit 9b5b38f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_empty.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,33 @@ def func(shape, queue):
139139
with pytest.raises(errors.TypingError):
140140
queue = dpctl.SyclQueue()
141141
func(10, queue)
142+
143+
144+
@pytest.mark.xfail(reason="dpjit allocates new dpctl.SyclQueue on boxing")
145+
# TODO: remove test_dpnp_empty_with_dpjit_queue_temp once pass.
146+
def test_dpnp_empty_with_dpjit_queue():
147+
"""Test if dpnp array can be created with a queue from another array"""
148+
149+
@dpjit
150+
def func(a):
151+
queue = a.sycl_queue
152+
return dpnp.empty(10, sycl_queue=queue)
153+
154+
a = dpnp.empty(10)
155+
b = func(a)
156+
157+
assert id(a.sycl_queue) == id(b.sycl_queue)
158+
159+
160+
def test_dpnp_empty_with_dpjit_queue_temp():
161+
"""Test if dpnp array can be created with a queue from another array"""
162+
163+
@dpjit
164+
def func(a):
165+
queue = a.sycl_queue
166+
return dpnp.empty(10, sycl_queue=queue)
167+
168+
a = dpnp.empty(10)
169+
b = func(a)
170+
171+
assert a.sycl_queue == b.sycl_queue

0 commit comments

Comments
 (0)