From 4a0c17129dbf5969ac89293c6096f92274337314 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 11 Oct 2023 07:04:30 -0500 Subject: [PATCH 1/2] SyclEvent._wait static function to use _Wait, not _WaitAndThrow --- dpctl/_sycl_event.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpctl/_sycl_event.pyx b/dpctl/_sycl_event.pyx index 34576a2ef7..3b8f89d4c5 100644 --- a/dpctl/_sycl_event.pyx +++ b/dpctl/_sycl_event.pyx @@ -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): From 058107d00f9a2b006612b26409d92ea62464c057 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 11 Oct 2023 10:55:35 -0500 Subject: [PATCH 2/2] SyclContext and SyclQueue creation now use NULL async_handler pointer The default_async_handler function pointer used previously was not useful, since the integral argument passed to it by libSyclInterface did not convey useful information to take meaningful actions, and raising SyclAsyncErrorException is not helpful. --- dpctl/_sycl_context.pyx | 7 ++----- dpctl/_sycl_queue.pxd | 2 -- dpctl/_sycl_queue.pyx | 19 +++---------------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/dpctl/_sycl_context.pyx b/dpctl/_sycl_context.pyx index 71c2fb7591..a9873fa0de 100644 --- a/dpctl/_sycl_context.pyx +++ b/dpctl/_sycl_context.pyx @@ -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__ = [ @@ -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 = ( - &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): @@ -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 = ( - &default_async_error_handler) + cdef error_handler_callback * eh_callback = NULL cdef DPCTLSyclContextRef CRef = NULL cdef DPCTLSyclDeviceRef *elems diff --git a/dpctl/_sycl_queue.pxd b/dpctl/_sycl_queue.pxd index c906ada4d6..8f9028fabf 100644 --- a/dpctl/_sycl_queue.pxd +++ b/dpctl/_sycl_queue.pxd @@ -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 ]: diff --git a/dpctl/_sycl_queue.pyx b/dpctl/_sycl_queue.pyx index 6acf3396e1..361b9d5924 100644 --- a/dpctl/_sycl_queue.pyx +++ b/dpctl/_sycl_queue.pyx @@ -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 @@ -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 @@ -404,7 +391,7 @@ cdef class SyclQueue(_SyclQueue): QRef = DPCTLQueue_Create( CRef, DRef, - &default_async_error_handler, + NULL, props ) if QRef is NULL: @@ -481,7 +468,7 @@ cdef class SyclQueue(_SyclQueue): QRef = DPCTLQueue_Create( CRef, DRef, - &default_async_error_handler, + NULL, props ) if (QRef is NULL): @@ -566,7 +553,7 @@ cdef class SyclQueue(_SyclQueue): qref = DPCTLQueue_Create( cref, dref, - &default_async_error_handler, + NULL, props ) if qref is NULL: