C Specification
To enqueue a command to signal a set of semaphores, call the function
// Provided by cl_khr_semaphore
cl_int clEnqueueSignalSemaphoresKHR(
cl_command_queue command_queue,
cl_uint num_sema_objects,
const cl_semaphore_khr* sema_objects,
const cl_semaphore_payload_khr* sema_payload_list,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
clEnqueueSignalSemaphoresKHR is provided by the cl_khr_semaphore extension.
|
Parameters
-
command_queue specifies a valid command-queue.
-
num_sema_objects specifies the number of semaphore objects to signal.
-
sema_objects points to the list of semaphore objects to signal. The length of the list must be at least num_sema_objects.
-
sema_payload_list points to the list of values of type
cl_semaphore_containing semaphore payload values to signal. This can be set topayload_ khr NULLor will be ignored if no semaphores in the list of sema_objects require a payload. -
num_events_in_wait_list specifies the number of events in
-
event_wait_list points to the list of events that need to complete before clEnqueueSignalSemaphoresKHR can be executed. If event_wait_list is
NULL, then clEnqueueSignalSemaphoresKHR does not wait on any event to complete. If event_wait_list isNULL, num_events_in_wait_list must be 0. If event_wait_list is notNULL, the list of events pointed to by event_wait_list must be valid and num_events_in_wait_list must be greater than 0. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and that associated with command_queue must be the same.event returns an event object that identifies this particular command and can be used to query or queue a wait for this particular command to complete. event can be
NULL, in which case it will not be possible for the application to query the status of this command or queue a wait for this command to complete.
Description
The semaphore signal command waits for a list of events to complete and then
signals a list of semaphore objects.
The semaphore signal command returns an event which can be waited on to
ensure that all events in the event_wait_list have completed and all
semaphores in sema_objects have been signaled.
The successful completion of the event generated by
clEnqueueSignalSemaphoresKHR called on one or more semaphore objects of
type CL_SEMAPHORE_ changes the state of the corresponding
semaphore objects to signaled.
clEnqueueSignalSemaphoresKHR will not return until the binary semaphores
in sema_objects are in a state that makes them safe to wait on again.
If necessary, implementations may block in clEnqueueSignalSemaphoresKHR to
ensure the correct state of semaphores when returning.
There are no implications from this behavior for the state of event or the
events in event_wait_list when clEnqueueSignalSemaphoresKHR returns.
Signaling the same binary semaphore twice without an interleaving wait may
lead to undefined behavior.
|
When command_queue is an out-of-order command-queue there are no implicit dependencies between commands enqueued into the command-queue before the semaphore signal command and the semaphore signal command. If such dependencies are required, applications may enqueue a command-queue barrier before the semaphore signal command, to explicitly add dependencies between the preceding commands and the semaphore signal command. |
clEnqueueSignalSemaphoresKHR returns CL_SUCCESS if the function is
executed successfully.
Otherwise, it returns one of the following errors:
-
CL_INVALID_COMMAND_ QUEUE -
if command_queue is not a valid command-queue, or
-
if the device associated with command_queue is not same as one of the devices specified by
CL_SEMAPHORE_at the time of creating one or more of sema_objects, orDEVICE_ HANDLE_ LIST_ KHR -
if one or more of sema_objects belong to a context that does not contain a device associated with command_queue.
-
-
CL_INVALID_if num_sema_objects is 0.VALUE -
CL_INVALID_if any of the semaphore objects specified by sema_objects is not valid.SEMAPHORE_ KHR -
CL_INVALID_if the context associated with command_queue and any of the semaphore objects in sema_objects are not the same, or if the context associated with command_queue and that associated with events in event_wait_list are not the same.CONTEXT -
CL_INVALID_if any of the semaphore objects specified by sema_objects requires a semaphore payload and sema_payload_list isVALUE NULL. -
CL_INVALID_EVENT_ WAIT_ LIST -
if event_wait_list is
NULLand num_events_in_wait_list is not 0, or -
if event_wait_list is not
NULLand num_events_in_wait_list is 0, or -
if event objects in event_wait_list are not valid events.
-
-
CL_EXEC_if the execution status of any of the events in event_wait_list is a negative integer value.STATUS_ ERROR_ FOR_ EVENTS_ IN_ WAIT_ LIST -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.