File tree Expand file tree Collapse file tree 5 files changed +48
-1
lines changed Expand file tree Collapse file tree 5 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 65
65
)
66
66
67
67
from ._version import get_versions
68
- from .enum_types import backend_type , device_type
68
+ from .enum_types import backend_type , device_type , event_status_type
69
69
70
70
__all__ = [
71
71
"SyclContext" ,
113
113
__all__ += [
114
114
"device_type" ,
115
115
"backend_type" ,
116
+ "event_status_type" ,
116
117
]
117
118
__all__ += [
118
119
"get_include" ,
Original file line number Diff line number Diff line change @@ -104,6 +104,12 @@ cdef extern from "dpctl_sycl_enum_types.h":
104
104
_L1_cache ' L1_cache' ,
105
105
_next_partitionable ' next_partitionable' ,
106
106
107
+ ctypedef enum _event_status_type ' DPCTLSyclEventStatusType' :
108
+ _UNKNOWN_STATUS ' DPCTL_UNKNOWN_STATUS'
109
+ _SUBMITTED ' DPCTL_SUBMITTED'
110
+ _RUNNING ' DPCTL_RUNNING'
111
+ _COMPLETE ' DPCTL_COMPLETE'
112
+
107
113
108
114
cdef extern from " dpctl_sycl_types.h" :
109
115
cdef struct DPCTLOpaqueSyclContext
@@ -221,6 +227,7 @@ cdef extern from "dpctl_sycl_event_interface.h":
221
227
cdef DPCTLSyclEventRef DPCTLEvent_Copy(const DPCTLSyclEventRef ERef)
222
228
cdef void DPCTLEvent_Wait(DPCTLSyclEventRef ERef)
223
229
cdef void DPCTLEvent_Delete(DPCTLSyclEventRef ERef)
230
+ cdef _event_status_type DPCTLEvent_GetCommandExecutionStatus(DPCTLSyclEventRef ERef)
224
231
225
232
226
233
cdef extern from " dpctl_sycl_kernel_interface.h" :
Original file line number Diff line number Diff line change @@ -29,10 +29,14 @@ from ._backend cimport ( # noqa: E211
29
29
DPCTLEvent_Copy,
30
30
DPCTLEvent_Create,
31
31
DPCTLEvent_Delete,
32
+ DPCTLEvent_GetCommandExecutionStatus,
32
33
DPCTLEvent_Wait,
33
34
DPCTLSyclEventRef,
35
+ _event_status_type,
34
36
)
35
37
38
+ from .enum_types import backend_type, event_status_type
39
+
36
40
__all__ = [
37
41
" SyclEvent" ,
38
42
" SyclEventRaw" ,
@@ -209,3 +213,19 @@ cdef class SyclEventRaw(_SyclEventRaw):
209
213
" SyclEventRef" ,
210
214
& _event_capsule_deleter
211
215
)
216
+
217
+ @property
218
+ def execution_status (self ):
219
+ """ Returns the event status.
220
+ """
221
+ cdef _event_status_type ESTy = DPCTLEvent_GetCommandExecutionStatus(
222
+ self ._event_ref
223
+ )
224
+ if ESTy == _event_status_type._SUBMITTED:
225
+ return event_status_type.submitted
226
+ elif ESTy == _event_status_type._RUNNING:
227
+ return event_status_type.running
228
+ elif ESTy == _event_status_type._COMPLETE:
229
+ return event_status_type.complete
230
+ else :
231
+ raise ValueError (" Unknown event status." )
Original file line number Diff line number Diff line change 25
25
__all__ = [
26
26
"device_type" ,
27
27
"backend_type" ,
28
+ "event_status_type" ,
28
29
]
29
30
30
31
@@ -71,3 +72,11 @@ class backend_type(Enum):
71
72
host = auto ()
72
73
level_zero = auto ()
73
74
opencl = auto ()
75
+
76
+
77
+ class event_status_type (Enum ):
78
+
79
+ unknown_status = auto ()
80
+ submitted = auto ()
81
+ running = auto ()
82
+ complete = auto ()
Original file line number Diff line number Diff line change 23
23
import dpctl
24
24
import dpctl .memory as dpctl_mem
25
25
import dpctl .program as dpctl_prog
26
+ from dpctl import event_status_type as esty
26
27
27
28
from ._helper import has_cpu
28
29
@@ -70,3 +71,12 @@ def test_create_event_raw_from_capsule():
70
71
dpctl .SyclEventRaw (event_capsule )
71
72
except ValueError :
72
73
pytest .fail ("Failed to create an event from capsule" )
74
+
75
+
76
+ def test_execution_status ():
77
+ event = dpctl .SyclEventRaw ()
78
+ try :
79
+ event_status = event .execution_status
80
+ except ValueError :
81
+ pytest .fail ("Failed to get an event status" )
82
+ assert event_status == esty .complete
You can’t perform that action at this time.
0 commit comments