Skip to content

Do not use wait and throw #1436

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 2 commits into from
Oct 14, 2023
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
7 changes: 2 additions & 5 deletions dpctl/_sycl_context.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ from ._backend cimport ( # noqa: E211
error_handler_callback,
)
from ._sycl_device cimport SyclDevice
from ._sycl_queue cimport default_async_error_handler
from ._sycl_device import SyclDeviceCreationError

__all__ = [
Expand Down Expand Up @@ -201,8 +200,7 @@ cdef class SyclContext(_SyclContext):
cdef int _init_context_from_one_device(self, SyclDevice device, int props):
cdef DPCTLSyclDeviceRef DRef = device.get_device_ref()
cdef DPCTLSyclContextRef CRef = NULL
cdef error_handler_callback * eh_callback = (
<error_handler_callback *>&default_async_error_handler)
cdef error_handler_callback * eh_callback = NULL
# look up cached contexts for root devices first
CRef = DPCTLDeviceMgr_GetCachedContext(DRef)
if (CRef is NULL):
Expand All @@ -219,8 +217,7 @@ cdef class SyclContext(_SyclContext):
cdef int j = 0
cdef size_t num_bytes
cdef DPCTLDeviceVectorRef DVRef = NULL
cdef error_handler_callback * eh_callback = (
<error_handler_callback *>&default_async_error_handler)
cdef error_handler_callback * eh_callback = NULL
cdef DPCTLSyclContextRef CRef = NULL
cdef DPCTLSyclDeviceRef *elems

Expand Down
2 changes: 1 addition & 1 deletion dpctl/_sycl_event.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ cdef class SyclEvent(_SyclEvent):

@staticmethod
cdef void _wait(SyclEvent event):
with nogil: DPCTLEvent_WaitAndThrow(event._event_ref)
with nogil: DPCTLEvent_Wait(event._event_ref)

@staticmethod
def wait_for(event):
Expand Down
2 changes: 0 additions & 2 deletions dpctl/_sycl_queue.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ from ._sycl_event cimport SyclEvent
from .program._program cimport SyclKernel


cdef void default_async_error_handler(int) except * nogil

cdef public api class _SyclQueue [
object Py_SyclQueueObject, type Py_SyclQueueType
]:
Expand Down
19 changes: 3 additions & 16 deletions dpctl/_sycl_queue.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ from ._backend cimport ( # noqa: E211
_arg_data_type,
_backend_type,
_queue_property_type,
error_handler_callback,
)
from .memory._memory cimport _Memory

Expand Down Expand Up @@ -114,18 +113,6 @@ cdef class SyclQueueCreationError(Exception):
pass


cdef class SyclAsynchronousError(Exception):
"""
A SyclAsynchronousError exception is raised when SYCL operation submission
or execution encounters an error.
"""


cdef void default_async_error_handler(int err) except * nogil:
with gil:
raise SyclAsynchronousError(err)


cdef int _parse_queue_properties(object prop) except *:
cdef int res = 0
cdef object props
Expand Down Expand Up @@ -404,7 +391,7 @@ cdef class SyclQueue(_SyclQueue):
QRef = DPCTLQueue_Create(
CRef,
DRef,
<error_handler_callback *>&default_async_error_handler,
NULL,
props
)
if QRef is NULL:
Expand Down Expand Up @@ -481,7 +468,7 @@ cdef class SyclQueue(_SyclQueue):
QRef = DPCTLQueue_Create(
CRef,
DRef,
<error_handler_callback *>&default_async_error_handler,
NULL,
props
)
if (QRef is NULL):
Expand Down Expand Up @@ -566,7 +553,7 @@ cdef class SyclQueue(_SyclQueue):
qref = DPCTLQueue_Create(
cref,
dref,
<error_handler_callback *>&default_async_error_handler,
NULL,
props
)
if qref is NULL:
Expand Down