Skip to content

Commit a4390ab

Browse files
Introduce dpctl.SyclQueue.submit_async
The SyclQueue.submit has become synchronosing, although it still returns a SyclEvent (with exectuion_status always complete)
1 parent c4dff8f commit a4390ab

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

dpctl/_sycl_queue.pxd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ cdef public api class SyclQueue (_SyclQueue) [
7777
object args,
7878
list dEvents
7979
)
80+
cpdef SyclEvent submit_async(
81+
self,
82+
SyclKernel kernel,
83+
list args,
84+
list gS,
85+
list lS=*,
86+
list dEvents=*
87+
)
8088
cpdef SyclEvent submit(
8189
self,
8290
SyclKernel kernel,

dpctl/_sycl_queue.pyx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ cdef class SyclQueue(_SyclQueue):
789789
return SyclEvent._create(htERef)
790790

791791

792-
cpdef SyclEvent submit(
792+
cpdef SyclEvent submit_async(
793793
self,
794794
SyclKernel kernel,
795795
list args,
@@ -921,6 +921,18 @@ cdef class SyclQueue(_SyclQueue):
921921

922922
return SyclEvent._create(Eref)
923923

924+
cpdef SyclEvent submit(
925+
self,
926+
SyclKernel kernel,
927+
list args,
928+
list gS,
929+
list lS=None,
930+
list dEvents=None
931+
):
932+
cdef SyclEvent e = self.submit_async(kernel, args, gS, lS, dEvents)
933+
e.wait()
934+
return e
935+
924936
cpdef void wait(self):
925937
with nogil: DPCTLQueue_Wait(self._queue_ref)
926938

dpctl/tests/test_sycl_kernel_submit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def test_create_program_from_source(ctype_str, dtype, ctypes_ctor):
114114
)
115115

116116

117-
def test_async_submit():
117+
def test_submit_async():
118118
try:
119119
q = dpctl.SyclQueue("opencl")
120120
except dpctl.SyclQueueCreationError:
@@ -182,7 +182,7 @@ def test_async_submit():
182182

183183
async_detected = False
184184
for attempt in range(5):
185-
e1 = q.submit(
185+
e1 = q.submit_async(
186186
kern1Kernel,
187187
[
188188
first_row,
@@ -192,7 +192,7 @@ def test_async_submit():
192192
n,
193193
],
194194
)
195-
e2 = q.submit(
195+
e2 = q.submit_async(
196196
kern2Kernel,
197197
[
198198
second_row,
@@ -202,7 +202,7 @@ def test_async_submit():
202202
n,
203203
],
204204
)
205-
e3 = q.submit(
205+
e3 = q.submit_async(
206206
kern3Kernel,
207207
[third_row, first_row, second_row],
208208
[

0 commit comments

Comments
 (0)