Class CL20
- java.lang.Object
-
- org.lwjgl.opencl.CL20
-
public class CL20 extends java.lang.ObjectThe core OpenCL 2.0 functionality.
-
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static longclCreateCommandQueueWithProperties(long context, long device, long[] properties, int[] errcode_ret)Array version of:CreateCommandQueueWithPropertiesstatic longclCreateCommandQueueWithProperties(long context, long device, java.nio.LongBuffer properties, java.nio.IntBuffer errcode_ret)Creates a host or device command-queue on a specific device.static longclCreatePipe(long context, long flags, int pipe_packet_size, int pipe_max_packets, int[] properties, int[] errcode_ret)Array version of:CreatePipestatic longclCreatePipe(long context, long flags, int pipe_packet_size, int pipe_max_packets, java.nio.IntBuffer properties, java.nio.IntBuffer errcode_ret)Creates a pipe object.static longclCreateSamplerWithProperties(long context, int[] sampler_properties, int[] errcode_ret)Array version of:CreateSamplerWithPropertiesstatic longclCreateSamplerWithProperties(long context, java.nio.IntBuffer sampler_properties, java.nio.IntBuffer errcode_ret)Creates a sampler object.static intclEnqueueSVMFree(long command_queue, PointerBuffer svm_pointers, CLSVMFreeCallbackI pfn_free_func, java.nio.ByteBuffer user_data, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to free the shared virtual memory buffer allocated usingSVMAllocor a shared system memory pointer.static intclEnqueueSVMMap(long command_queue, int blocking_map, long map_flags, java.nio.ByteBuffer svm_ptr, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command that will allow the host to update a region of a SVM buffer.static intclEnqueueSVMMemcpy(long command_queue, int blocking_copy, java.nio.ByteBuffer dst_ptr, java.nio.ByteBuffer src_ptr, long size, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to do amemcpyoperation.static intclEnqueueSVMMemFill(long command_queue, java.nio.ByteBuffer svm_ptr, java.nio.ByteBuffer pattern, long size, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to fill a region in memory with a pattern of a given pattern size.static intclEnqueueSVMUnmap(long command_queue, java.nio.ByteBuffer svm_ptr, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to indicate that the host has completed updating the region given bysvm_ptrand which was specified in a previous call toEnqueueSVMMap.static intclGetPipeInfo(long pipe, int param_name, java.nio.ByteBuffer param_value, PointerBuffer param_value_size_ret)Queries information specific to a pipe object.static intclGetPipeInfo(long pipe, int param_name, int[] param_value, PointerBuffer param_value_size_ret)int[] version of:GetPipeInfostatic intclGetPipeInfo(long pipe, int param_name, java.nio.IntBuffer param_value, PointerBuffer param_value_size_ret)IntBuffer version of:GetPipeInfostatic intclSetKernelArgSVMPointer(long kernel, int arg_index, java.nio.ByteBuffer arg_value)Set a SVM pointer as the argument value for a specific argument of a kernel.static intclSetKernelExecInfo(long kernel, int param_name, java.nio.ByteBuffer param_value)Can be used to pass additional information other than argument values to a kernel.static intclSetKernelExecInfo(long kernel, int param_name, int[] param_value)int[] version of:SetKernelExecInfostatic intclSetKernelExecInfo(long kernel, int param_name, java.nio.IntBuffer param_value)IntBuffer version of:SetKernelExecInfostatic intclSetKernelExecInfo(long kernel, int param_name, PointerBuffer param_value)PointerBuffer version of:SetKernelExecInfostatic java.nio.ByteBufferclSVMAlloc(long context, long flags, long size, int alignment)Allocates a shared virtual memory buffer (referred to as a SVM buffer) that can be shared by the host and all devices in an OpenCL context that support shared virtual memory.static voidclSVMFree(long context, java.nio.ByteBuffer svm_pointer)Frees a shared virtual memory buffer allocated usingSVMAlloc.
-
-
-
Field Detail
-
CL_VERSION_2_0
public static final int CL_VERSION_2_0
OpenCL Version.- See Also:
- Constant Field Values
-
CL_INVALID_PIPE_SIZE
public static final int CL_INVALID_PIPE_SIZE
Error Codes- See Also:
- Constant Field Values
-
CL_INVALID_DEVICE_QUEUE
public static final int CL_INVALID_DEVICE_QUEUE
Error Codes- See Also:
- Constant Field Values
-
CL_DEVICE_QUEUE_ON_HOST_PROPERTIES
public static final int CL_DEVICE_QUEUE_ON_HOST_PROPERTIES
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS
public static final int CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE
public static final int CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES
public static final int CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE
public static final int CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE
public static final int CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_MAX_ON_DEVICE_QUEUES
public static final int CL_DEVICE_MAX_ON_DEVICE_QUEUES
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_MAX_ON_DEVICE_EVENTS
public static final int CL_DEVICE_MAX_ON_DEVICE_EVENTS
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_SVM_CAPABILITIES
public static final int CL_DEVICE_SVM_CAPABILITIES
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE
public static final int CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_MAX_PIPE_ARGS
public static final int CL_DEVICE_MAX_PIPE_ARGS
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS
public static final int CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_PIPE_MAX_PACKET_SIZE
public static final int CL_DEVICE_PIPE_MAX_PACKET_SIZE
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT
public static final int CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT
public static final int CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT
public static final int CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT
cl_device_info- See Also:
- Constant Field Values
-
CL_QUEUE_ON_DEVICE
public static final int CL_QUEUE_ON_DEVICE
cl_command_queue_properties- See Also:
- Constant Field Values
-
CL_QUEUE_ON_DEVICE_DEFAULT
public static final int CL_QUEUE_ON_DEVICE_DEFAULT
cl_command_queue_properties- See Also:
- Constant Field Values
-
CL_DEVICE_SVM_COARSE_GRAIN_BUFFER
public static final int CL_DEVICE_SVM_COARSE_GRAIN_BUFFER
cl_device_svm_capabilities- See Also:
- Constant Field Values
-
CL_DEVICE_SVM_FINE_GRAIN_BUFFER
public static final int CL_DEVICE_SVM_FINE_GRAIN_BUFFER
cl_device_svm_capabilities- See Also:
- Constant Field Values
-
CL_DEVICE_SVM_FINE_GRAIN_SYSTEM
public static final int CL_DEVICE_SVM_FINE_GRAIN_SYSTEM
cl_device_svm_capabilities- See Also:
- Constant Field Values
-
CL_DEVICE_SVM_ATOMICS
public static final int CL_DEVICE_SVM_ATOMICS
cl_device_svm_capabilities- See Also:
- Constant Field Values
-
CL_QUEUE_SIZE
public static final int CL_QUEUE_SIZE
cl_command_queue_info- See Also:
- Constant Field Values
-
CL_MEM_SVM_FINE_GRAIN_BUFFER
public static final int CL_MEM_SVM_FINE_GRAIN_BUFFER
cl_svm_mem_flags- See Also:
- Constant Field Values
-
CL_MEM_SVM_ATOMICS
public static final int CL_MEM_SVM_ATOMICS
cl_svm_mem_flags- See Also:
- Constant Field Values
-
CL_MEM_OBJECT_PIPE
public static final int CL_MEM_OBJECT_PIPE
cl_mem_object_type- See Also:
- Constant Field Values
-
CL_MEM_USES_SVM_POINTER
public static final int CL_MEM_USES_SVM_POINTER
cl_mem_info- See Also:
- Constant Field Values
-
CL_sRGB
public static final int CL_sRGB
cl_channel_order- See Also:
- Constant Field Values
-
CL_sRGBx
public static final int CL_sRGBx
cl_channel_order- See Also:
- Constant Field Values
-
CL_sRGBA
public static final int CL_sRGBA
cl_channel_order- See Also:
- Constant Field Values
-
CL_sBGRA
public static final int CL_sBGRA
cl_channel_order- See Also:
- Constant Field Values
-
CL_ABGR
public static final int CL_ABGR
cl_channel_order- See Also:
- Constant Field Values
-
CL_PIPE_PACKET_SIZE
public static final int CL_PIPE_PACKET_SIZE
cl_pipe_info- See Also:
- Constant Field Values
-
CL_PIPE_MAX_PACKETS
public static final int CL_PIPE_MAX_PACKETS
cl_pipe_info- See Also:
- Constant Field Values
-
CL_SAMPLER_MIP_FILTER_MODE
public static final int CL_SAMPLER_MIP_FILTER_MODE
cl_sampler_info- See Also:
- Constant Field Values
-
CL_SAMPLER_LOD_MIN
public static final int CL_SAMPLER_LOD_MIN
cl_sampler_info- See Also:
- Constant Field Values
-
CL_SAMPLER_LOD_MAX
public static final int CL_SAMPLER_LOD_MAX
cl_sampler_info- See Also:
- Constant Field Values
-
CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE
public static final int CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE
cl_program_build_info- See Also:
- Constant Field Values
-
CL_KERNEL_ARG_TYPE_PIPE
public static final int CL_KERNEL_ARG_TYPE_PIPE
cl_kernel_arg_type_qualifier- See Also:
- Constant Field Values
-
CL_KERNEL_EXEC_INFO_SVM_PTRS
public static final int CL_KERNEL_EXEC_INFO_SVM_PTRS
cl_kernel_exec_info- See Also:
- Constant Field Values
-
CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM
public static final int CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM
cl_kernel_exec_info- See Also:
- Constant Field Values
-
CL_COMMAND_SVM_FREE
public static final int CL_COMMAND_SVM_FREE
cl_command_type- See Also:
- Constant Field Values
-
CL_COMMAND_SVM_MEMCPY
public static final int CL_COMMAND_SVM_MEMCPY
cl_command_type- See Also:
- Constant Field Values
-
CL_COMMAND_SVM_MEMFILL
public static final int CL_COMMAND_SVM_MEMFILL
cl_command_type- See Also:
- Constant Field Values
-
CL_COMMAND_SVM_MAP
public static final int CL_COMMAND_SVM_MAP
cl_command_type- See Also:
- Constant Field Values
-
CL_COMMAND_SVM_UNMAP
public static final int CL_COMMAND_SVM_UNMAP
cl_command_type- See Also:
- Constant Field Values
-
CL_PROFILING_COMMAND_COMPLETE
public static final int CL_PROFILING_COMMAND_COMPLETE
cl_profiling_info- See Also:
- Constant Field Values
-
-
Method Detail
-
clCreateCommandQueueWithProperties
public static long clCreateCommandQueueWithProperties(long context, long device, java.nio.LongBuffer properties, java.nio.IntBuffer errcode_ret)Creates a host or device command-queue on a specific device.OpenCL objects such as memory, program and kernel objects are created using a context. Operations on these objects are performed using a command-queue. The command-queue can be used to queue a set of operations (referred to as commands) in order. Having multiple command-queues allows applications to queue multiple independent commands without requiring synchronization. Note that this should work as long as these objects are not being shared. Sharing of objects across multiple command-queues will require the application to perform appropriate synchronization.
- Parameters:
context- a valid OpenCL contextdevice- a device associated with context. It can either be in the list of devices specified when context is created usingCreateContextor have the same device type as device type specified when context is created usingCreateContextFromType.properties- a list of properties for the command-queue and their corresponding values. Each property name is immediately followed by the corresponding desired value. The list is terminated with0. If a supported property and its value is not specified in properties, its default value will be used.propertiescan beNULLin which case the default values for supported command-queue properties will be used. One of:QUEUE_PROPERTIESQUEUE_SIZEerrcode_ret- will return an appropriate error code. Iferrcode_retisNULL, no error code is returned.- Returns:
- a valid non-zero command-queue and
errcode_retis set toSUCCESSif the command-queue is created successfully. Otherwise, it returns aNULLvalue with one of the following error values returned inerrcode_ret:INVALID_CONTEXTifcontextis not a valid context.INVALID_DEVICEifdeviceis not a valid device or is not associated withcontext.INVALID_VALUEif values specified inpropertiesare not valid.INVALID_QUEUE_PROPERTIESif values specified inpropertiesare valid but are not supported by the device.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clCreatePipe
public static long clCreatePipe(long context, long flags, int pipe_packet_size, int pipe_max_packets, java.nio.IntBuffer properties, java.nio.IntBuffer errcode_ret)Creates a pipe object.- Parameters:
context- a valid OpenCL context used to create the pipe objectflags- a bit-field that is used to specify allocation and usage information such as the memory arena that should be used to allocate the pipe object and how it will be used. If value specified for flags is 0, the default is used which isMEM_READ_WRITE.pipe_packet_size- the size in bytes of a pipe packetpipe_max_packets- the pipe capacity by specifying the maximum number of packets the pipe can holdproperties- a list of properties for the pipe and their corresponding values. Each property name is immediately followed by the corresponding desired value. The list is terminated with0. In OpenCL 2.0,propertiesmust beNULL.errcode_ret- will return an appropriate error code. Iferrcode_retisNULL, no error code is returned.- Returns:
- a valid non-zero pipe object and
errcode_retis set toSUCCESSif the pipe object is created successfully. Otherwise, it returns aNULLvalue with one of the following error values returned inerrcode_ret:INVALID_CONTEXTifcontextis not a valid context.INVALID_VALUEif values specified inflagsare invalid.INVALID_VALUEifpropertiesis notNULL.INVALID_PIPE_SIZEifpipe_packet_sizeis0or thepipe_packet_sizeexceedsDEVICE_PIPE_MAX_PACKET_SIZEvalue for all devices incontextor ifpipe_max_packetsis0.MEM_OBJECT_ALLOCATION_FAILUREif there is a failure to allocate memory for the pipe object.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clGetPipeInfo
public static int clGetPipeInfo(long pipe, int param_name, java.nio.ByteBuffer param_value, PointerBuffer param_value_size_ret)Queries information specific to a pipe object.- Parameters:
pipe- the pipe object being queriedparam_name- the information to queryparam_value- a pointer to memory where the appropriate result being queried is returned. Ifparam_valueisNULL, it is ignored.param_value_size_ret- the actual size in bytes of data being queried byparam_value. IfNULL, it is ignored.- Returns:
SUCCESSif the function is executed successfully. Otherwise, it returns one of the following errors:INVALID_VALUEifparam_nameis not valid, or if size in bytes specified byparam_value_sizeis < size of return type andparam_valueis notNULL.INVALID_MEM_OBJECTifpipeis not a valid pipe object.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clGetPipeInfo
public static int clGetPipeInfo(long pipe, int param_name, java.nio.IntBuffer param_value, PointerBuffer param_value_size_ret)IntBuffer version of:GetPipeInfo
-
clSVMAlloc
public static java.nio.ByteBuffer clSVMAlloc(long context, long flags, long size, int alignment)Allocates a shared virtual memory buffer (referred to as a SVM buffer) that can be shared by the host and all devices in an OpenCL context that support shared virtual memory.If
MEM_SVM_FINE_GRAIN_BUFFERis not specified, the buffer can be created as a coarse grained SVM allocation. Similarly, ifMEM_SVM_ATOMICSis not specified, the buffer can be created without support for the OpenCL 2.0 SVM atomic operations.Calling
SVMAllocdoes not itself provide consistency for the shared memory region. When the host can't use the SVM atomic operations, it must rely on OpenCL's guaranteed memory consistency at synchronization points. To initialize a buffer to be shared with a kernel, the host can create the buffer and use the resulting virtual memory pointer to initialize the buffer's contents.For SVM to be used efficiently, the host and any devices sharing a buffer containing virtual memory pointers should have the same endianness. If the context passed to
SVMAllochas devices with mixed endianness and the OpenCL implementation is unable to implement SVM because of that mixed endianness,SVMAllocwill fail and returnNULL.Although SVM is generally not supported for image objects,
CreateImagemay create an image from a buffer (a 1D image from a buffer or a 2D image from buffer) if the buffer specified in its image description parameter is a SVM buffer. Such images have a linear memory representation so their memory can be shared using SVM. However, fine grained sharing and atomics are not supported for image reads and writes in a kernel.If
CreateBufferis called with a pointer returned bySVMAllocas itshost_ptrargument, andMEM_USE_HOST_PTRis set in itsflagsargument,CreateBufferwill succeed and return a valid non-zero buffer object as long as thesizeargument toCreateBufferis no larger than thesizeargument passed in the originalSVMAlloccall. The new buffer object returned has the shared memory as the underlying storage. Locations in the buffer's underlying shared memory can be operated on using, e.g., atomic operations if the device supports them.- Parameters:
context- a valid OpenCL context used to create the SVM bufferflags- a bit-field that is used to specify allocation and usage information. One of:MEM_READ_WRITEMEM_WRITE_ONLYMEM_READ_ONLYMEM_SVM_FINE_GRAIN_BUFFERMEM_SVM_ATOMICSsize- the size in bytes of the SVM buffer to be allocatedalignment- the minimum alignment in bytes that is required for the newly created buffer's memory region. It must be a power of two up to the largest data type supported by the OpenCL device. For the full profile, the largest data type islong16. For the embedded profile, it islong16if the device supports 64-bit integers; otherwise it isint16. If alignment is0, a default alignment will be used that is equal to the size of largest data type supported by the OpenCL implementation.- Returns:
- a valid non-
NULLshared virtual memory address if the SVM buffer is successfully allocated. Otherwise, likemalloc, it returns aNULLpointer value.SVMAllocwill fail if:contextis not a valid context.flagsdoes not containMEM_SVM_FINE_GRAIN_BUFFERbut does containMEM_SVM_ATOMICS.- Values specified in
flagsdo not follow rules for supported values. MEM_SVM_FINE_GRAIN_BUFFERorMEM_SVM_ATOMICSis specified in flags and these are not supported by at least one device in context.- The values specified in
flagsare not valid. sizeis0or >DEVICE_MAX_MEM_ALLOC_SIZEvalue for any device in context.alignmentis not a power of two or the OpenCL implementation cannot support the specified alignment for at least one device in context.- There was a failure to allocate resources.
-
clSVMFree
public static void clSVMFree(long context, java.nio.ByteBuffer svm_pointer)Frees a shared virtual memory buffer allocated usingSVMAlloc.Note that
SVMFreedoes not wait for previously enqueued commands that may be usingsvm_pointerto finish before freeingsvm_pointer. It is the responsibility of the application to make sure that enqueued commands that usesvm_pointerhave finished before freeingsvm_pointer. This can be done by enqueuing a blocking operation such asFinish,WaitForEvents,EnqueueReadBufferor by registering a callback with the events associated with enqueued commands and when the last enqueued command has finished freeingsvm_pointer.The behavior of using
svm_pointerafter it has been freed is undefined. In addition, if a buffer object is created usingCreateBufferwithsvm_pointer, the buffer object must first be released before thesvm_pointeris freed.- Parameters:
context- a valid OpenCL context used to create the SVM buffersvm_pointer- must be the value returned by a call toSVMAlloc. If aNULLpointer is passed insvm_pointer, no action occurs.
-
clEnqueueSVMFree
public static int clEnqueueSVMFree(long command_queue, PointerBuffer svm_pointers, CLSVMFreeCallbackI pfn_free_func, java.nio.ByteBuffer user_data, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to free the shared virtual memory buffer allocated usingSVMAllocor a shared system memory pointer.- Parameters:
command_queue- a valid host command-queuesvm_pointers- the shared virtual memory pointers to be freed. Each pointer insvm_pointersthat was allocated usingSVMAllocmust have been allocated from the same context from whichcommand_queuewas created. The memory associated withsvm_pointerscan be reused or freed after the function returns.pfn_free_func- the callback function to be called to free the SVM pointers. If pfn_free_func isNULL, all pointers specified insvm_pointersmust be allocated usingSVMAllocand the OpenCL implementation will free these SVM pointers.pfn_free_funcmust be a valid callback function if any SVM pointer to be freed is a shared system memory pointer i.e. not allocated usingSVMAlloc. Ifpfn_free_funcis a valid callback function, the OpenCL implementation will callpfn_free_functo free all the SVM pointers specified insvm_pointers.user_data- will be passed as theuser_dataargument whenpfn_free_funcis called.user_datacan beNULL.event_wait_list- a list of events that need to complete before this particular command can be executed. Ifevent_wait_listisNULL, then this particular command does not wait on any event to complete. The events specified inevent_wait_listact as synchronization points. The context associated with events inevent_wait_listandcommand_queuemust 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.eventcan beNULLin 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 theevent_wait_listand theeventarguments are notNULL, the event argument should not refer to an element of theevent_wait_listarray.- Returns:
SUCCESSif the function is executed successfully. Otherwise, it returns one of the following errors:INVALID_COMMAND_QUEUEifcommand_queueis not a valid command-queue.INVALID_VALUEifnum_svm_pointersis0or ifsvm_pointersisNULLor if any of the pointers specified insvm_pointersarray isNULL.INVALID_EVENT_WAIT_LISTifevent_wait_listisNULLandnum_events_in_wait_list> 0, orevent_wait_listis notNULLandnum_events_in_wait_listis 0, or if event objects inevent_wait_listare not valid events.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clEnqueueSVMMemcpy
public static int clEnqueueSVMMemcpy(long command_queue, int blocking_copy, java.nio.ByteBuffer dst_ptr, java.nio.ByteBuffer src_ptr, long size, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to do amemcpyoperation.If
dst_ptrand/orsrc_ptrare allocated usingSVMAllocthen they must be allocated from the same context from whichcommand_queuewas created. Otherwise the behavior is undefined.- Parameters:
command_queue- the host command-queue in which the read / write command will be queuedblocking_copy- indicates if the copy operation is blocking or non-blocking.If
blocking_copyisTRUEi.e. the copy command is blocking,EnqueueSVMMemcpydoes not return until the buffer data has been copied into memory pointed to bydst_ptr.If
blocking_copyisFALSEi.e. the copy command is non-blocking,EnqueueSVMMemcpyqueues a non-blocking copy command and returns. The contents of the buffer thatdst_ptrpoint to cannot be used until the copy command has completed. The event argument returns an event object which can be used to query the execution status of the read command. When the copy command has completed, the contents of the buffer thatdst_ptrpoints to can be used by the application.dst_ptr- the pointer to a memory region where data is copied tosrc_ptr- the pointer to a memory region where data is copied fromsize- the size in bytes of data being copiedevent_wait_list- a list of events that need to complete before this particular command can be executed. Ifevent_wait_listisNULL, then this particular command does not wait on any event to complete. The events specified inevent_wait_listact as synchronization points. The context associated with events inevent_wait_listandcommand_queuemust 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.eventcan beNULLin 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 theevent_wait_listand theeventarguments are notNULL, the event argument should not refer to an element of theevent_wait_listarray.- Returns:
SUCCESSif the function is executed successfully. Otherwise, it returns one of the following errors:INVALID_COMMAND_QUEUEifcommand_queueis not a valid command-queue.INVALID_CONTEXTif the context associated withcommand_queueand events inevent_wait_listare not the same.INVALID_EVENT_WAIT_LISTifevent_wait_listisNULLandnum_events_in_wait_list> 0, orevent_wait_listis notNULLandnum_events_in_wait_listis 0, or if event objects inevent_wait_listare not valid events.EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LISTif the copy operation is blocking and the execution status of any of the events inevent_wait_listis a negative integer value.INVALID_VALUEifdst_ptrorsrc_ptrareNULL.INVALID_VALUEifsizeis0.MEM_COPY_OVERLAPif the values specified fordst_ptr,src_ptrandsizeresult in an overlapping copy.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clEnqueueSVMMemFill
public static int clEnqueueSVMMemFill(long command_queue, java.nio.ByteBuffer svm_ptr, java.nio.ByteBuffer pattern, long size, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to fill a region in memory with a pattern of a given pattern size.- Parameters:
command_queue- the host command-queue in which the fill command will be queuedsvm_ptr- a pointer to a memory region that will be filled with pattern. It must be aligned topattern_sizebytes. Ifsvm_ptris allocated usingSVMAllocthen it must be allocated from the same context from whichcommand_queuewas created. Otherwise the behavior is undefined.pattern- a pointer to the data pattern of sizepattern_sizein bytes.patternwill be used to fill a region in buffer starting atsvm_ptrand issizebytes in size. The data pattern must be a scalar or vector integer or floating-point data type supported by OpenCL. For example, if region pointed to bysvm_ptris to be filled with a pattern of float4 values, then pattern will be a pointer to acl_float4value andpattern_sizewill besizeof(cl_float4). The maximum value ofpattern_sizeis the size of the largest integer or floating-point vector data type supported by the OpenCL device. The memory associated with pattern can be reused or freed after the function returns.size- the size in bytes of region being filled starting withsvm_ptrand must be a multiple ofpattern_sizeevent_wait_list- a list of events that need to complete before this particular command can be executed. Ifevent_wait_listisNULL, then this particular command does not wait on any event to complete. The events specified inevent_wait_listact as synchronization points. The context associated with events inevent_wait_listandcommand_queuemust 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.eventcan beNULLin 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 theevent_wait_listand theeventarguments are notNULL, the event argument should not refer to an element of theevent_wait_listarray.- Returns:
SUCCESSif the function is executed successfully. Otherwise, it returns one of the following errors:INVALID_COMMAND_QUEUEifcommand_queueis not a valid command-queue.INVALID_CONTEXTif the context associated withcommand_queueand events inevent_wait_listare not the same.INVALID_VALUEifsvm_ptrisNULL.INVALID_VALUEifsvm_ptris not aligned topattern_sizebytes.INVALID_VALUEifpatternisNULLor ifpattern_sizeis0or ifpattern_sizeis not one of{1, 2, 4, 8, 16, 32, 64, 128}.INVALID_VALUEifsizeis0or is not a multiple ofpattern_size.INVALID_EVENT_WAIT_LISTifevent_wait_listisNULLandnum_events_in_wait_list> 0, orevent_wait_listis notNULLandnum_events_in_wait_listis 0, or if event objects inevent_wait_listare not valid events.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clEnqueueSVMMap
public static int clEnqueueSVMMap(long command_queue, int blocking_map, long map_flags, java.nio.ByteBuffer svm_ptr, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command that will allow the host to update a region of a SVM buffer. Note that since we are enqueuing a command with a SVM buffer, the region is already mapped in the host address space.- Parameters:
command_queue- a valid host command-queueblocking_map- indicates if the map operation is blocking or non-blocking.If
blocking_mapisTRUE,EnqueueSVMMapdoes not return until the application can access the contents of the SVM region specified bysvm_ptrandsizeon the host.If
blocking_mapisFALSEi.e. map operation is non-blocking, the region specified bysvm_ptrandsizecannot be used until the map command has completed. The event argument returns an event object which can be used to query the execution status of the map command. When the map command is completed, the application can access the contents of the region specified bysvm_ptrandsize.map_flags- a bit-fieldsvm_ptr- a pointer to a memory region andsizein bytes that will be updated by the host. Ifsvm_ptris allocated usingSVMAllocthen it must be allocated from the same context from whichcommand_queuewas created. Otherwise the behavior is undefined.event_wait_list- a list of events that need to complete before this particular command can be executed. Ifevent_wait_listisNULL, then this particular command does not wait on any event to complete. The events specified inevent_wait_listact as synchronization points. The context associated with events inevent_wait_listandcommand_queuemust 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.eventcan beNULLin 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 theevent_wait_listand theeventarguments are notNULL, the event argument should not refer to an element of theevent_wait_listarray.- Returns:
SUCCESSif the function is executed successfully. Otherwise, it returns one of the following errors:INVALID_COMMAND_QUEUEifcommand_queueis not a valid command-queue.INVALID_CONTEXTif context associated withcommand_queueand events inevent_wait_listare not the same.INVALID_VALUEifsvm_ptrisNULL.INVALID_VALUEifsizeis0or if values specified inmap_flagsare not valid.INVALID_EVENT_WAIT_LISTifevent_wait_listisNULLandnum_events_in_wait_list> 0, orevent_wait_listis notNULLandnum_events_in_wait_listis 0, or if event objects inevent_wait_listare not valid events.EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LISTif the map operation is blocking and the execution status of any of the events inevent_wait_listis a negative integer value.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clEnqueueSVMUnmap
public static int clEnqueueSVMUnmap(long command_queue, java.nio.ByteBuffer svm_ptr, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to indicate that the host has completed updating the region given bysvm_ptrand which was specified in a previous call toEnqueueSVMMap.- Parameters:
command_queue- a valid host command-queuesvm_ptr- a pointer that was specified in a previous call toEnqueueSVMMap. Ifsvm_ptris allocated usingSVMAllocthen it must be allocated from the same context from whichcommand_queuewas created. Otherwise the behavior is undefined.event_wait_list- a list of events that need to complete before this particular command can be executed. Ifevent_wait_listisNULL, then this particular command does not wait on any event to complete. The events specified inevent_wait_listact as synchronization points. The context associated with events inevent_wait_listandcommand_queuemust 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.eventcan beNULLin 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 theevent_wait_listand theeventarguments are notNULL, the event argument should not refer to an element of theevent_wait_listarray.- Returns:
SUCCESSif the function is executed successfully. Otherwise, it returns one of the following errors:INVALID_COMMAND_QUEUEifcommand_queueis not a valid command-queue.INVALID_CONTEXTif context associated withcommand_queueand events inevent_wait_listare not the same.INVALID_VALUEifsvm_ptrisNULL.INVALID_EVENT_WAIT_LISTifevent_wait_listisNULLandnum_events_in_wait_list> 0, orevent_wait_listis notNULLandnum_events_in_wait_listis 0, or if event objects inevent_wait_listare not valid events.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clSetKernelArgSVMPointer
public static int clSetKernelArgSVMPointer(long kernel, int arg_index, java.nio.ByteBuffer arg_value)Set a SVM pointer as the argument value for a specific argument of a kernel.- Parameters:
kernel- a valid kernel objectarg_index- the argument index. Arguments to the kernel are referred by indices that go from0for the leftmost argument ton - 1, wherenis the total number of arguments declared by a kernel.arg_value- the SVM pointer that should be used as the argument value for argument specified byarg_index. The SVM pointer specified is the value used by all API calls that enqueue kernel (EnqueueNDRangeKernel) until the argument value is changed by a call toSetKernelArgSVMPointerforkernel. The SVM pointer can only be used for arguments that are declared to be a pointer to global or constant memory. The SVM pointer value must be aligned according to the argument's type. For example, if the argument is declared to beglobal float4 *p, the SVM pointer value passed forpmust be at a minimum aligned to afloat4. The SVM pointer value specified as the argument value can be the pointer returned bySVMAllocor can be a pointer + offset into the SVM region.- Returns:
SUCCESSif the function was executed successfully. Otherwise, it returns one of the following errors:INVALID_KERNELifkernelis not a valid kernel object.INVALID_ARG_INDEXifarg_indexis not a valid argument index.INVALID_ARG_VALUEifarg_valuespecified is not a valid value.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clSetKernelExecInfo
public static int clSetKernelExecInfo(long kernel, int param_name, java.nio.ByteBuffer param_value)Can be used to pass additional information other than argument values to a kernel.NOTES
1. Coarse-grain or fine-grain buffer SVM pointers used by a kernel which are not passed as a kernel arguments must be specified using
SetKernelExecInfowithKERNEL_EXEC_INFO_SVM_PTRS. For example, if SVM buffer A contains a pointer to another SVM buffer B, and the kernel dereferences that pointer, then a pointer to B must either be passed as an argument in the call to that kernel or it must be made available to the kernel usingSetKernelExecInfo. For example, we might pass extra SVM pointers as follows:clSetKernelExecInfo(kernel, CL_KERNEL_EXEC_INFO_SVM_PTRS, num_ptrs * sizeof(void *), extra_svm_ptr_list);Here
num_ptrsspecifies the number of additional SVM pointers whileextra_svm_ptr_listspecifies a pointer to memory containing those SVM pointers. When callingSetKernelExecInfowithKERNEL_EXEC_INFO_SVM_PTRSto specify pointers to non-argument SVM buffers as extra arguments to a kernel, each of these pointers can be the SVM pointer returned bySVMAllocor can be a pointer + offset into the SVM region. It is sufficient to provide one pointer for each SVM buffer used.2.
KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEMis used to indicate whether SVM pointers used by a kernel will refer to system allocations or not.KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM=FALSEindicates that the OpenCL implementation may assume that system pointers are not passed as kernel arguments and are not stored inside SVM allocations passed as kernel arguments.KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM=TRUEindicates that the OpenCL implementation must assume that system pointers might be passed as kernel arguments and/or stored inside SVM allocations passed as kernel arguments. In this case, if the device to which the kernel is enqueued does not support system SVM pointers,EnqueueNDRangeKernelwill return aINVALID_OPERATIONerror. If none of the devices in the context associated with kernel support fine-grain system SVM allocations,SetKernelExecInfowill return aINVALID_OPERATIONerror.If
SetKernelExecInfohas not been called with a value forKERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM, the default value is used for this kernel attribute. The default value depends on whether the device on which the kernel is enqueued supports fine-grain system SVM allocations. If so, the default value used isTRUE(system pointers might be passed); otherwise, the default isFALSE.- Parameters:
kernel- the kernel object being queriedparam_name- the information to be passed tokernel. One of:KERNEL_EXEC_INFO_SVM_PTRSKERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEMparam_value- a pointer to memory where the appropriate values determined byparam_nameare specified- Returns:
SUCCESSif the function is executed successfully. Otherwise, it returns one of the following errors:INVALID_KERNELifkernelis a not a valid kernel object.INVALID_VALUEifparam_nameis not valid, ifparam_valueisNULLor if the size specified byparam_value_sizeis not valid.INVALID_OPERATIONifparam_name=KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEMandparam_value=TRUEbut no devices in context associated with kernel support fine-grain system SVM allocations.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clSetKernelExecInfo
public static int clSetKernelExecInfo(long kernel, int param_name, PointerBuffer param_value)PointerBuffer version of:SetKernelExecInfo
-
clSetKernelExecInfo
public static int clSetKernelExecInfo(long kernel, int param_name, java.nio.IntBuffer param_value)IntBuffer version of:SetKernelExecInfo
-
clCreateSamplerWithProperties
public static long clCreateSamplerWithProperties(long context, java.nio.IntBuffer sampler_properties, java.nio.IntBuffer errcode_ret)Creates a sampler object.- Parameters:
context- a valid OpenCL contextsampler_properties- a list of sampler property names and their corresponding values. Each sampler property name is immediately followed by the corresponding desired value. The list is terminated with0. If a supported property and its value is not specified insampler_properties, its default value will be used.sampler_propertiescan beNULLin which case the default values for supported sampler properties will be used.errcode_ret- will return an appropriate error code. Iferrcode_retisNULL, no error code is returned.- Returns:
- a valid non-zero sampler object and
errcode_retis set toSUCCESSif the sampler object is created successfully. Otherwise, it returns aNULLvalue with one of the following error values returned inerrcode_ret:INVALID_CONTEXTifcontextis not a valid context.INVALID_VALUEif the property name insampler_propertiesis not a supported property name, if the value specified for a supported property name is not valid, or if the same property name is specified more than once.INVALID_OPERATIONif images are not supported by any device associated with context.OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
-
clCreateCommandQueueWithProperties
public static long clCreateCommandQueueWithProperties(long context, long device, long[] properties, int[] errcode_ret)Array version of:CreateCommandQueueWithProperties
-
clCreatePipe
public static long clCreatePipe(long context, long flags, int pipe_packet_size, int pipe_max_packets, int[] properties, int[] errcode_ret)Array version of:CreatePipe
-
clGetPipeInfo
public static int clGetPipeInfo(long pipe, int param_name, int[] param_value, PointerBuffer param_value_size_ret)int[] version of:GetPipeInfo
-
clSetKernelExecInfo
public static int clSetKernelExecInfo(long kernel, int param_name, int[] param_value)int[] version of:SetKernelExecInfo
-
clCreateSamplerWithProperties
public static long clCreateSamplerWithProperties(long context, int[] sampler_properties, int[] errcode_ret)Array version of:CreateSamplerWithProperties
-
-