Class KHRSemaphore


  • public class KHRSemaphore
    extends java.lang.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.

    • Method Detail

      • nclCreateSemaphoreWithPropertiesKHR

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

        public static long clCreateSemaphoreWithPropertiesKHR​(long context,
                                                              java.nio.LongBuffer sema_props,
                                                              @Nullable
                                                              java.nio.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
                                                     java.nio.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,
                                                       java.nio.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
                                                java.nio.ByteBuffer param_value,
                                                @Nullable
                                                org.lwjgl.PointerBuffer param_value_size_ret)
        
        public static int clGetSemaphoreInfoKHR​(long sema_object,
                                                int param_name,
                                                @Nullable
                                                java.nio.IntBuffer param_value,
                                                @Nullable
                                                org.lwjgl.PointerBuffer param_value_size_ret)
        
        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,
                                                              @Nullable
                                                              int[] errcode_ret)
      • clEnqueueWaitSemaphoresKHR

        public static int clEnqueueWaitSemaphoresKHR​(long command_queue,
                                                     org.lwjgl.PointerBuffer sema_objects,
                                                     @Nullable
                                                     long[] 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,
                                                @Nullable
                                                int[] param_value,
                                                @Nullable
                                                org.lwjgl.PointerBuffer param_value_size_ret)
        Array version of: GetSemaphoreInfoKHR