The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Asynchronous Events

It will be very helpful to be able to be notified asynchronously when specific OpenCL events have completed.

Note that clWaitForEvents() has several deficiencies:

1) One cannot wait for any of several events to complete - only until they all complete.
2) According to appendix A.2 ("Multiple Host Threads") of the OpenCL bible, calls to clWaitForEvents() are probably not thread-safe. This means that we cannot even wait for different events in different threads, and in any case, even if other threads were ready to enqueue new OpenCL operation(s), they must still wait for the thread that is stuck in clWaitForEvents() - there is even no way to abort that waiting-for-events thread. Even interrupting/killing/longjmp that thread is probably not an option as it is likely to leave the OpenCL library in a locked or weird state.

A simple and clean solution is to be able to request a callback when an event completes. For example:

That would be ideal - short of that, the least required to support complex and multi-threaded parallel applications would be to:

1. Require clWaitForEvents() to be thread-safe (without blocking other threads from using OpenCL functions simultaneously);
and/or
2. Introduce an interruptible variant of clWaitForEvents(), that returns when a signal was received, even if the event(s) are not yet complete;
and/or
3. Introduce an OpenCL call that waits for ANY of several events to complete;
and/or
4. Create a new type of event: an "abort-event", which can be used in clWaitForEvents() and its variants, but is activated by the host-program to cause clWaitForEvents() to be aborted.