Class KHRSemaphore

java.lang.Object
org.lwjgl.opencl.KHRSemaphore

public class KHRSemaphore extends Object
Native bindings to the khr_semaphore extension.

OpenCL provides cl_event as a primary mechanism of synchronization between host and device as well as across devices. While events can be waited on or can be passed as dependencies across work-submissions, they suffer from following limitations:

  • They are immutable.
  • They are not reusable.

This extension introduces a new type of synchronization object to represent semaphores that can be reused, waited on, and signaled multiple times by OpenCL work-submissions.

In particular, this extension defines:

  • A new type called cl_semaphore_khr to represent the semaphore objects.
  • A new type called cl_semaphore_properties_khr to specify metadata associated with semaphores.
  • Routines to create, retain, and release semaphores.
  • Routines to wait on and signal semaphore objects.
  • Routine to query the properties of semaphore objects.

Requires CL12.

  • Field Details

    • CL_PLATFORM_SEMAPHORE_TYPES_KHR

      public static final int CL_PLATFORM_SEMAPHORE_TYPES_KHR
      Accepted value for the param_name parameter to GetPlatformInfo to query the semaphore types supported by an OpenCL platform.
      See Also:
    • CL_DEVICE_SEMAPHORE_TYPES_KHR

      public static final int CL_DEVICE_SEMAPHORE_TYPES_KHR
      Accepted value for the param_name parameter to GetDeviceInfo to query the semaphore types supported by an OpenCL device.
      See Also:
    • CL_SEMAPHORE_TYPE_BINARY_KHR

      public static final int CL_SEMAPHORE_TYPE_BINARY_KHR
      Semaphore types.
      See Also:
    • CL_SEMAPHORE_CONTEXT_KHR

      public static final int CL_SEMAPHORE_CONTEXT_KHR
      New attributes that can be passed as part of cl_semaphore_info_khr.
      See Also:
    • CL_SEMAPHORE_REFERENCE_COUNT_KHR

      public static final int CL_SEMAPHORE_REFERENCE_COUNT_KHR
      New attributes that can be passed as part of cl_semaphore_info_khr.
      See Also:
    • CL_SEMAPHORE_PROPERTIES_KHR

      public static final int CL_SEMAPHORE_PROPERTIES_KHR
      New attributes that can be passed as part of cl_semaphore_info_khr.
      See Also:
    • CL_SEMAPHORE_PAYLOAD_KHR

      public static final int CL_SEMAPHORE_PAYLOAD_KHR
      New attributes that can be passed as part of cl_semaphore_info_khr.
      See Also:
    • CL_SEMAPHORE_TYPE_KHR

      public static final int CL_SEMAPHORE_TYPE_KHR
      New attributes that can be passed as part of cl_semaphore_info_khr or cl_semaphore_properties_khr.
      See Also:
    • CL_DEVICE_HANDLE_LIST_KHR

      public static final int CL_DEVICE_HANDLE_LIST_KHR
      New attributes that can be passed as part of cl_semaphore_info_khr or cl_semaphore_properties_khr.
      See Also:
    • CL_DEVICE_HANDLE_LIST_END_KHR

      public static final int CL_DEVICE_HANDLE_LIST_END_KHR
      New attributes that can be passed as part of cl_semaphore_info_khr or cl_semaphore_properties_khr.
      See Also:
    • CL_COMMAND_SEMAPHORE_WAIT_KHR

      public static final int CL_COMMAND_SEMAPHORE_WAIT_KHR
      New return values from GetEventInfo when param_name is EVENT_COMMAND_TYPE.
      See Also:
    • CL_COMMAND_SEMAPHORE_SIGNAL_KHR

      public static final int CL_COMMAND_SEMAPHORE_SIGNAL_KHR
      New return values from GetEventInfo when param_name is EVENT_COMMAND_TYPE.
      See Also:
    • CL_INVALID_SEMAPHORE_KHR

      public static final int CL_INVALID_SEMAPHORE_KHR
      The following error codes can be returned by APIs introduced as part of this specification or the specifications that depend on this.
      See Also:
  • Method Details

    • nclCreateSemaphoreWithPropertiesKHR

      public static long nclCreateSemaphoreWithPropertiesKHR(long context, long sema_props, long errcode_ret)
    • clCreateSemaphoreWithPropertiesKHR

      public static long clCreateSemaphoreWithPropertiesKHR(long context, LongBuffer sema_props, @Nullable IntBuffer errcode_ret)
      Parameters:
      errcode_ret - will return an appropriate error code. If errcode_ret is NULL, no error code is returned.
    • nclEnqueueWaitSemaphoresKHR

      public static int nclEnqueueWaitSemaphoresKHR(long command_queue, int num_sema_objects, long sema_objects, long sema_payload_list, int num_events_in_wait_list, long event_wait_list, long event)
      Unsafe version of: EnqueueWaitSemaphoresKHR
      Parameters:
      num_events_in_wait_list - the number of events in event_wait_list
    • clEnqueueWaitSemaphoresKHR

      public static int clEnqueueWaitSemaphoresKHR(long command_queue, org.lwjgl.PointerBuffer sema_objects, @Nullable LongBuffer sema_payload_list, @Nullable org.lwjgl.PointerBuffer event_wait_list, @Nullable org.lwjgl.PointerBuffer event)
      Parameters:
      event_wait_list - a list of events that need to complete before this particular command can be executed. If event_wait_list is NULL, then this particular command does not wait on any event to complete. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and 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. If the event_wait_list and the event arguments are not NULL, the event argument should not refer to an element of the event_wait_list array.
    • nclEnqueueSignalSemaphoresKHR

      public static int nclEnqueueSignalSemaphoresKHR(long command_queue, int num_sema_objects, long sema_objects, long sema_payload_list, int num_events_in_wait_list, long event_wait_list, long event)
      Unsafe version of: EnqueueSignalSemaphoresKHR
      Parameters:
      num_events_in_wait_list - the number of events in event_wait_list
    • clEnqueueSignalSemaphoresKHR

      public static int clEnqueueSignalSemaphoresKHR(long command_queue, org.lwjgl.PointerBuffer sema_objects, LongBuffer sema_payload_list, @Nullable org.lwjgl.PointerBuffer event_wait_list, @Nullable org.lwjgl.PointerBuffer event)
      Parameters:
      event_wait_list - a list of events that need to complete before this particular command can be executed. If event_wait_list is NULL, then this particular command does not wait on any event to complete. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and 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. If the event_wait_list and the event arguments are not NULL, the event argument should not refer to an element of the event_wait_list array.
    • nclGetSemaphoreInfoKHR

      public static int nclGetSemaphoreInfoKHR(long sema_object, int param_name, long param_value_size, long param_value, long param_value_size_ret)
      Unsafe version of: GetSemaphoreInfoKHR
      Parameters:
      param_value_size - the size in bytes of memory pointed to by param_value. This size must be ≥ size of return type. If param_value is NULL, it is ignored.
    • clGetSemaphoreInfoKHR

      public static int clGetSemaphoreInfoKHR(long sema_object, int param_name, @Nullable ByteBuffer param_value, @Nullable org.lwjgl.PointerBuffer param_value_size_ret)
      Parameters:
      param_value_size_ret - the actual size in bytes of data being queried by param_value. If NULL, it is ignored.
    • clGetSemaphoreInfoKHR

      public static int clGetSemaphoreInfoKHR(long sema_object, int param_name, @Nullable IntBuffer param_value, @Nullable org.lwjgl.PointerBuffer param_value_size_ret)
      Parameters:
      param_value_size_ret - the actual size in bytes of data being queried by param_value. If NULL, it is ignored.
    • clGetSemaphoreInfoKHR

      public static int clGetSemaphoreInfoKHR(long sema_object, int param_name, @Nullable org.lwjgl.PointerBuffer param_value, @Nullable org.lwjgl.PointerBuffer param_value_size_ret)
      Parameters:
      param_value_size_ret - the actual size in bytes of data being queried by param_value. If NULL, it is ignored.
    • clReleaseSemaphoreKHR

      public static int clReleaseSemaphoreKHR(long sema_object)
    • clRetainSemaphoreKHR

      public static int clRetainSemaphoreKHR(long sema_object)
    • clCreateSemaphoreWithPropertiesKHR

      public static long clCreateSemaphoreWithPropertiesKHR(long context, long[] sema_props, int @Nullable [] errcode_ret)
    • clEnqueueWaitSemaphoresKHR

      public static int clEnqueueWaitSemaphoresKHR(long command_queue, org.lwjgl.PointerBuffer sema_objects, long @Nullable [] sema_payload_list, @Nullable org.lwjgl.PointerBuffer event_wait_list, @Nullable org.lwjgl.PointerBuffer event)
      Array version of: EnqueueWaitSemaphoresKHR
    • clEnqueueSignalSemaphoresKHR

      public static int clEnqueueSignalSemaphoresKHR(long command_queue, org.lwjgl.PointerBuffer sema_objects, long[] sema_payload_list, @Nullable org.lwjgl.PointerBuffer event_wait_list, @Nullable org.lwjgl.PointerBuffer event)
      Array version of: EnqueueSignalSemaphoresKHR
    • clGetSemaphoreInfoKHR

      public static int clGetSemaphoreInfoKHR(long sema_object, int param_name, int @Nullable [] param_value, @Nullable org.lwjgl.PointerBuffer param_value_size_ret)
      Array version of: GetSemaphoreInfoKHR