Skip to content

Commit 088fbcb

Browse files
committed
Clarify async error handling priorities
Cherry pick KhronosGroup#925 from main (cherry picked from commit 84d72d7)
1 parent 46bcc45 commit 088fbcb

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

adoc/chapters/programming_interface.adoc

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17432,10 +17432,9 @@ The queue and context classes can optionally take an asynchronous handler object
1743217432
<<async-handler>> on construction, which is a callable such as a function class
1743317433
or lambda, with an [code]#exception_list# as a parameter.
1743417434
Invocation of an <<async-handler>> may be triggered by the queue member
17435-
functions [code]#queue::wait_and_throw()# or
17436-
[code]#queue::throw_asynchronous()#, by the event member function
17437-
[api]#event::wait_and_throw#, or automatically on destruction of a queue or
17438-
context that contains unconsumed asynchronous errors.
17435+
functions [api]#queue::wait_and_throw# or [api]#queue::throw_asynchronous#, by
17436+
the event member function [api]#event::wait_and_throw#, or automatically on
17437+
destruction of a queue or context that contains unconsumed asynchronous errors.
1743917438
When invoked, an <<async-handler>> is called and receives an
1744017439
[code]#exception_list# argument containing a list of exception objects
1744117440
representing any unconsumed <<async-error,asynchronous errors>> associated with
@@ -17465,30 +17464,25 @@ when possible, and must then invoke [code]#std::terminate# or equivalent.
1746517464
[[subsubsec:async.handler.priorities]]
1746617465
==== Priorities of async handlers
1746717466

17468-
If the SYCL runtime can associate an <<async-error>> with a specific queue,
17469-
then:
17470-
17471-
* If the queue was constructed with an <<async-handler>>, that handler is
17472-
invoked to handle the error.
17473-
* Otherwise if the context enclosed by the queue was constructed with an
17474-
<<async-handler>>, that handler is invoked to handle the error.
17475-
* Otherwise when no handler was passed to either queue or context on
17476-
construction, then a default handler is invoked to handle the error, as
17477-
described by <<subsubsec:exception.nohandler>>.
17478-
* All handler invocations in this list occur at times as defined by
17479-
<<subsubsec:exception.async>>.
17480-
17481-
If the SYCL runtime cannot associate an <<async-error>> with a specific queue,
17482-
then:
17483-
17484-
* If the context in which the error occurred was constructed with an
17485-
<<async-handler>>, then that handler is invoked to handle the error.
17486-
* Otherwise when no handler was passed to the associated context on
17487-
construction, then a default handler is invoked to handle the error, as
17488-
described by <<subsubsec:exception.nohandler>>.
17489-
* All handler invocations in this list occur at times as defined by
17490-
<<subsubsec:exception.async>>.
17491-
17467+
If the async error is reported from a call to [api]#queue::wait_and_throw#,
17468+
[api]#queue::throw_asynchronous#, or from the queue destructor, the async error
17469+
is reported as follows:
17470+
17471+
* If the queue was constructed with an <<async-handler>>, that handler is
17472+
invoked to handle the error.
17473+
* Otherwise if the context enclosed by the queue was constructed with an
17474+
<<async-handler>>, that handler is invoked to handle the error.
17475+
* Otherwise, the default handler is invoked to handle the error as described in
17476+
<<subsubsec:exception.nohandler>>.
17477+
17478+
If the async error is reported from a call to [api]#event::wait_and_throw# and
17479+
if the event was created from a queue that has not yet been destroyed, the async
17480+
error is reported using the rules above for that queue.
17481+
17482+
Otherwise, the async error is reported from a call to
17483+
[api]#event::wait_and_throw# and the event was created from a queue that has
17484+
since been destroyed.
17485+
The behavior is undefined in this case.
1749217486

1749317487
==== Asynchronous errors with a secondary queue
1749417488

0 commit comments

Comments
 (0)