Skip to content

Commit 0680523

Browse files
Added is_in_order property
__repr__ is modified to reflect the in_order property: ``` In [1]: import dpctl In [2]: dpctl.SyclQueue(property="in_order") Out[2]: <dpctl.SyclQueue at 0x7f5ac2485230, property=in_order> In [3]: q = _ In [4]: q.is_in_order Out[4]: True In [5]: q2 = dpctl.SyclQueue() In [6]: q2.is_in_order Out[6]: False In [7]: q2 Out[7]: <dpctl.SyclQueue at 0x7f5a9a85a8c0> ```
1 parent ba5ac1f commit 0680523

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dpctl/_sycl_queue.pyx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ from ._backend cimport (
4747
DPCTLQueue_SubmitNDRange,
4848
DPCTLQueue_SubmitRange,
4949
DPCTLQueue_Wait,
50+
DPCTLQueue_IsInOrder,
5051
DPCTLSyclBackendType,
5152
DPCTLSyclContextRef,
5253
DPCTLSyclDeviceSelectorRef,
@@ -729,12 +730,21 @@ cdef class SyclQueue(_SyclQueue):
729730

730731
DPCTLQueue_MemAdvise(self._queue_ref, ptr, count, advice)
731732

733+
@property
734+
def is_in_order(self):
735+
"""True if SyclQueue is in-order, False if it is out-of-order."""
736+
return DPCTLQueue_IsInOrder(self._queue_ref)
737+
732738
@property
733739
def __name__(self):
734740
return "SyclQueue"
735741

736742
def __repr__(self):
737-
return "<dpctl." + self.__name__ + " at {}>".format(hex(id(self)))
743+
cdef cpp_bool in_order = DPCTLQueue_IsInOrder(self._queue_ref)
744+
if in_order:
745+
return "<dpctl." + self.__name__ + " at {}, property=in_order>".format(hex(id(self)))
746+
else:
747+
return "<dpctl." + self.__name__ + " at {}>".format(hex(id(self)))
738748

739749
def _get_capsule(self):
740750
cdef DPCTLSyclQueueRef QRef = NULL

0 commit comments

Comments
 (0)