Skip to content

Refactor/sycl event #553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 1 deletion dpctl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
)

from ._version import get_versions
from .enum_types import backend_type, device_type
from .enum_types import backend_type, device_type, event_status_type

__all__ = [
"SyclContext",
Expand All @@ -88,6 +88,7 @@
]
__all__ += [
"SyclEvent",
"SyclEventRaw",
]
__all__ += [
"get_platforms",
Expand All @@ -112,6 +113,7 @@
__all__ += [
"device_type",
"backend_type",
"event_status_type",
]
__all__ += [
"get_include",
Expand Down
25 changes: 24 additions & 1 deletion dpctl/_backend.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
types defined by dpctl's C API.
"""

from libc.stdint cimport int64_t, uint32_t
from libc.stdint cimport int64_t, uint32_t, uint64_t
from libcpp cimport bool


Expand Down Expand Up @@ -104,6 +104,12 @@ cdef extern from "dpctl_sycl_enum_types.h":
_L1_cache 'L1_cache',
_next_partitionable 'next_partitionable',

ctypedef enum _event_status_type 'DPCTLSyclEventStatusType':
_UNKNOWN_STATUS 'DPCTL_UNKNOWN_STATUS'
_SUBMITTED 'DPCTL_SUBMITTED'
_RUNNING 'DPCTL_RUNNING'
_COMPLETE 'DPCTL_COMPLETE'


cdef extern from "dpctl_sycl_types.h":
cdef struct DPCTLOpaqueSyclContext
Expand Down Expand Up @@ -217,8 +223,25 @@ cdef extern from "dpctl_sycl_device_selector_interface.h":


cdef extern from "dpctl_sycl_event_interface.h":
cdef DPCTLSyclEventRef DPCTLEvent_Create()
cdef DPCTLSyclEventRef DPCTLEvent_Copy(const DPCTLSyclEventRef ERef)
cdef void DPCTLEvent_Wait(DPCTLSyclEventRef ERef)
cdef void DPCTLEvent_WaitAndThrow(DPCTLSyclEventRef ERef)
cdef void DPCTLEvent_Delete(DPCTLSyclEventRef ERef)
cdef _event_status_type DPCTLEvent_GetCommandExecutionStatus(DPCTLSyclEventRef ERef)
cdef _backend_type DPCTLEvent_GetBackend(DPCTLSyclEventRef ERef)
cdef struct DPCTLEventVector
ctypedef DPCTLEventVector *DPCTLEventVectorRef
cdef void DPCTLEventVector_Delete(DPCTLEventVectorRef EVRef)
cdef size_t DPCTLEventVector_Size(DPCTLEventVectorRef EVRef)
cdef DPCTLSyclEventRef DPCTLEventVector_GetAt(
DPCTLEventVectorRef EVRef,
size_t index)
cdef DPCTLEventVectorRef DPCTLEvent_GetWaitList(
DPCTLSyclEventRef ERef)
cdef uint64_t DPCTLEvent_GetProfilingInfoSubmit(DPCTLSyclEventRef ERef)
cdef uint64_t DPCTLEvent_GetProfilingInfoStart(DPCTLSyclEventRef ERef)
cdef uint64_t DPCTLEvent_GetProfilingInfoEnd(DPCTLSyclEventRef ERef)


cdef extern from "dpctl_sycl_kernel_interface.h":
Expand Down
28 changes: 21 additions & 7 deletions dpctl/_sycl_event.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,27 @@
from ._backend cimport DPCTLSyclEventRef


cdef public api class SyclEvent [object PySyclEventObject, type PySyclEventType]:
''' Wrapper class for a Sycl Event
'''
cdef DPCTLSyclEventRef _event_ref
cdef list _args
cdef public api class _SyclEvent [
object Py_SyclEventObject,
type Py_SyclEventType
]:
""" Data owner for SyclEvent
"""
cdef DPCTLSyclEventRef _event_ref
cdef object args


cdef public api class SyclEvent(_SyclEvent) [
object PySyclEventObject,
type PySyclEventType
]:
""" Python wrapper class for a ``cl::sycl::event``
"""
@staticmethod
cdef SyclEvent _create (DPCTLSyclEventRef e, list args)
cdef DPCTLSyclEventRef get_event_ref (self)
cdef SyclEvent _create (DPCTLSyclEventRef event, object args=*)
cdef int _init_event_default(self)
cdef int _init_event_from__SyclEvent(self, _SyclEvent other)
cdef int _init_event_from_capsule(self, object caps)
cdef DPCTLSyclEventRef get_event_ref (self)
cdef void _wait (SyclEvent event)
cpdef void wait (self)
Loading