Class CL21
- java.lang.Object
-
- org.lwjgl.opencl.CL21
-
public class CL21 extends java.lang.ObjectThe core OpenCL 2.1 functionality.
-
-
Field Summary
Fields Modifier and Type Field and Description static intCL_DEVICE_IL_VERSION
CL_DEVICE_MAX_NUM_SUB_GROUPS
CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESScl_device_infostatic intCL_KERNEL_COMPILE_NUM_SUB_GROUPScl_kernel_infostatic intCL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNTcl_kernel_sub_group_infostatic intCL_KERNEL_MAX_NUM_SUB_GROUPScl_kernel_infostatic intCL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE
CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGEcl_kernel_sub_group_infostatic intCL_PLATFORM_HOST_TIMER_RESOLUTIONcl_platform_infostatic intCL_PROGRAM_ILcl_program_infostatic intCL_QUEUE_DEVICE_DEFAULTcl_command_queue_infostatic intCL_UNORM_INT_101010_2cl_channel_typestatic intCL_VERSION_2_1OpenCL Version.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static longclCloneKernel(long source_kernel, int[] errcode_ret)Array version of:CloneKernelstatic longclCloneKernel(long source_kernel, java.nio.IntBuffer errcode_ret)Makes a shallow copy of the kernel object, its arguments and any information passed to the kernel object usingSetKernelExecInfo.static longclCreateProgramWithIL(long context, java.nio.ByteBuffer il, int[] errcode_ret)Array version of:CreateProgramWithILstatic longclCreateProgramWithIL(long context, java.nio.ByteBuffer il, java.nio.IntBuffer errcode_ret)Creates a program object for a context, and loads the IL pointed to byiland with length in byteslengthinto the program object.static intclEnqueueSVMMigrateMem(long command_queue, PointerBuffer svm_pointers, PointerBuffer sizes, long flags, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to indicate which device a set of ranges of SVM allocations should be associated with.static intclGetDeviceAndHostTimer(long device, long[] device_timestamp, long[] host_timestamp)Array version of:GetDeviceAndHostTimerstatic intclGetDeviceAndHostTimer(long device, java.nio.LongBuffer device_timestamp, java.nio.LongBuffer host_timestamp)Returns a reasonably synchronized pair of timestamps from the device timer and the host timer as seen by device.static intclGetHostTimer(long device, long[] host_timestamp)Array version of:GetHostTimerstatic intclGetHostTimer(long device, java.nio.LongBuffer host_timestamp)Returns the current value of the host clock as seen by device.static intclGetKernelSubGroupInfo(long kernel, long device, int param_name, java.nio.ByteBuffer input_value, java.nio.ByteBuffer param_value, PointerBuffer param_value_size_ret)Returns information about the kernel object.static intclGetKernelSubGroupInfo(long kernel, long device, int param_name, java.nio.ByteBuffer input_value, PointerBuffer param_value, PointerBuffer param_value_size_ret)PointerBuffer version of:GetKernelSubGroupInfostatic intclSetDefaultDeviceCommandQueue(long context, long device, long command_queue)Replaces a default device command queue created withCreateCommandQueueWithPropertiesand theQUEUE_ON_DEVICE_DEFAULTflag.
-
-
-
Field Detail
-
CL_VERSION_2_1
public static final int CL_VERSION_2_1
OpenCL Version.- See Also:
- Constant Field Values
-
CL_PLATFORM_HOST_TIMER_RESOLUTION
public static final int CL_PLATFORM_HOST_TIMER_RESOLUTION
cl_platform_info- See Also:
- Constant Field Values
-
CL_DEVICE_IL_VERSION
public static final int CL_DEVICE_IL_VERSION
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_MAX_NUM_SUB_GROUPS
public static final int CL_DEVICE_MAX_NUM_SUB_GROUPS
cl_device_info- See Also:
- Constant Field Values
-
CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS
public static final int CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS
cl_device_info- See Also:
- Constant Field Values
-
CL_QUEUE_DEVICE_DEFAULT
public static final int CL_QUEUE_DEVICE_DEFAULT
cl_command_queue_info- See Also:
- Constant Field Values
-
CL_UNORM_INT_101010_2
public static final int CL_UNORM_INT_101010_2
cl_channel_type- See Also:
- Constant Field Values
-
CL_PROGRAM_IL
public static final int CL_PROGRAM_IL
cl_program_info- See Also:
- Constant Field Values
-
CL_KERNEL_MAX_NUM_SUB_GROUPS
public static final int CL_KERNEL_MAX_NUM_SUB_GROUPS
cl_kernel_info- See Also:
- Constant Field Values
-
CL_KERNEL_COMPILE_NUM_SUB_GROUPS
public static final int CL_KERNEL_COMPILE_NUM_SUB_GROUPS
cl_kernel_info- See Also:
- Constant Field Values
-
CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE
public static final int CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE
cl_kernel_sub_group_info- See Also:
- Constant Field Values
-
CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE
public static final int CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE
cl_kernel_sub_group_info- See Also:
- Constant Field Values
-
CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT
public static final int CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT
cl_kernel_sub_group_info- See Also:
- Constant Field Values
-
-
Method Detail
-
clSetDefaultDeviceCommandQueue
public static int clSetDefaultDeviceCommandQueue(long context, long device, long command_queue)Replaces a default device command queue created withCreateCommandQueueWithPropertiesand theQUEUE_ON_DEVICE_DEFAULTflag.- Parameters:
context- a valid OpenCL contextdevice- a OpenCL device associated withcontextcommand_queue- a valid command-queue fordevice- Returns:
SUCCESSif the function is executed successfully. Otherwise, it returns one of the following errors:INVALID_CONTEXTifcontextis not a valid context.INVALID_DEVICEifdeviceis not a valid device or is not associated withcontext.INVALID_COMMAND_QUEUEifcommand_queueis not a valid command-queue.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.
-
clGetDeviceAndHostTimer
public static int clGetDeviceAndHostTimer(long device, java.nio.LongBuffer device_timestamp, java.nio.LongBuffer host_timestamp)Returns a reasonably synchronized pair of timestamps from the device timer and the host timer as seen by device. Implementations may need to execute this query with a high latency in order to provide reasonable synchronization of the timestamps. The host timestamp and device timestamp returned by this function andGetHostTimereach have an implementation defined timebase. The timestamps will always be in their respective timebases regardless of which query function is used. The timestamp returned fromGetEventProfilingInfofor an event on a device and a device timestamp queried from the same device will always be in the same timebase.- Parameters:
device- a device returned byGetDeviceIDsdevice_timestamp- will be updated with the value of the device timer in nanoseconds. The resolution of the timer is the same as the device profiling timer returned byGetDeviceInfoand theDEVICE_PROFILING_TIMER_RESOLUTIONquery.host_timestamp- will be updated with the value of the host timer in nanoseconds at the closest possible point in time to that at whichdevice_timestampwas returned. The resolution of the timer may be queried viaGetPlatformInfoand the flagPLATFORM_HOST_TIMER_RESOLUTION.- Returns:
SUCCESSwith a time value inhost_timestampif provided. Otherwise, it returns one of the following errors:INVALID_DEVICEifdeviceis not a valid OpenCL device.INVALID_VALUEifhost_timestampordevice_timestampisNULL.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.
-
clGetHostTimer
public static int clGetHostTimer(long device, java.nio.LongBuffer host_timestamp)Returns the current value of the host clock as seen by device. This value is in the same timebase as thehost_timestampreturned fromGetDeviceAndHostTimer. The implementation will return with as low a latency as possible to allow a correlation with a subsequent application sampled time. The host timestamp and device timestamp returned by this function andGetDeviceAndHostTimereach have an implementation defined timebase. The timestamps will always be in their respective timebases regardless of which query function is used. The timestamp returned fromGetEventProfilingInfofor an event on a device and a device timestamp queried from the same device will always be in the same timebase.- Parameters:
device- a device returned byGetDeviceIDshost_timestamp- will be updated with the value of the current timer in nanoseconds. The resolution of the timer may be queried viaGetPlatformInfoand the flagPLATFORM_HOST_TIMER_RESOLUTION.- Returns:
SUCCESSwith a time value inhost_timestampif provided. Otherwise, it returns one of the following errors:INVALID_DEVICEifdeviceis not a valid OpenCL device.INVALID_VALUEifhost_timestampisNULL.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.
-
clCreateProgramWithIL
public static long clCreateProgramWithIL(long context, java.nio.ByteBuffer il, java.nio.IntBuffer errcode_ret)Creates a program object for a context, and loads the IL pointed to byiland with length in byteslengthinto the program object.- Parameters:
context- a valid OpenCL contextil- a pointer to alength-byte block of memory containing SPIR-V or an implementation-defined intermediate languageerrcode_ret- will return an appropriate error code. Iferrcode_retisNULL, no error code is returned.- Returns:
- a valid non-zero program object and
errcode_retis set toSUCCESSif the program 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_VALUEifilisNULLor iflengthis zero.INVALID_VALUEif thelength-byte memory pointed to byildoes not contain well-formed intermediate language input that can be consumed by the OpenCL runtime.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.
-
clCloneKernel
public static long clCloneKernel(long source_kernel, java.nio.IntBuffer errcode_ret)Makes a shallow copy of the kernel object, its arguments and any information passed to the kernel object usingSetKernelExecInfo. If the kernel object was ready to be enqueued before copying it, the clone of the kernel object is ready to enqueue.The returned kernel object is an exact copy of
source_kernel, with one caveat: the reference count on the returned kernel object is set as if it had been returned byCreateKernel. The reference count ofsource_kernelwill not be changed.The resulting kernel will be in the same state as if
CreateKernelis called to create the resultant kernel with the same arguments as those used to createsource_kernel, the latest call toSetKernelArgorSetKernelArgSVMPointerfor each argument index applied to kernel and the last call toSetKernelExecInfofor each value of the param name parameter are applied to the new kernel object.All arguments of the new kernel object must be intact and it may be correctly used in the same situations as kernel except those that assume a pre-existing reference count. Setting arguments on the new kernel object will not affect
source_kernelexcept insofar as the argument points to a shared underlying entity and in that situation behavior is as if two kernel objects had been created and the same argument applied to each. Only the data stored in the kernel object is copied; data referenced by the kernel's arguments are not copied. For example, if a buffer or pointer argument is set on a kernel object, the pointer is copied but the underlying memory allocation is not.- Parameters:
source_kernel- a validcl_kernelobject that will be copied.source_kernelwill not be modified in any way by this function.errcode_ret- will return an appropriate error code. Iferrcode_retisNULL, no error code is returned.- Returns:
- a valid non-zero kernel object and
errcode_retis set toSUCCESSif the kernel is successfully copied. Otherwise it returns aNULLvalue with one of the following error values returned inerrcode_ret:INVALID_KERNELifsource_kernelis not a valid kernel 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.
-
clGetKernelSubGroupInfo
public static int clGetKernelSubGroupInfo(long kernel, long device, int param_name, java.nio.ByteBuffer input_value, java.nio.ByteBuffer param_value, PointerBuffer param_value_size_ret)Returns information about the kernel object.- Parameters:
kernel- the kernel object being querieddevice- a specific device in the list of devices associated withkernel. The list of devices is the list of devices in the OpenCL context that is associated withkernel. If the list of devices associated with kernel is a single device, device can be aNULLvalue.param_name- the information to query. One of:KERNEL_MAX_NUM_SUB_GROUPSKERNEL_COMPILE_NUM_SUB_GROUPSKERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGEKERNEL_SUB_GROUP_COUNT_FOR_NDRANGEKERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNTinput_value- a pointer to memory where the appropriate parameterization of the query is passed from. Ifinput_valueisNULL, it is ignored.param_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_DEVICEifdeviceis not in the list of devices associated withkernelor ifdeviceisNULLbut there is more than one device associated withkernel.INVALID_VALUEifparam_nameis not valid, or if size in bytes specified byparam_valueis < size of return type andparam_valueis notNULL.INVALID_VALUEifparam_nameisKERNEL_SUB_GROUP_SIZE_FOR_NDRANGEand the size in bytes specified byinput_value_sizeis not valid or ifinput_valueisNULL.INVALID_KERNELifkernelis not a valid kernel 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.
-
clGetKernelSubGroupInfo
public static int clGetKernelSubGroupInfo(long kernel, long device, int param_name, java.nio.ByteBuffer input_value, PointerBuffer param_value, PointerBuffer param_value_size_ret)PointerBuffer version of:GetKernelSubGroupInfo
-
clEnqueueSVMMigrateMem
public static int clEnqueueSVMMigrateMem(long command_queue, PointerBuffer svm_pointers, PointerBuffer sizes, long flags, PointerBuffer event_wait_list, PointerBuffer event)Enqueues a command to indicate which device a set of ranges of SVM allocations should be associated with. Once the event returned byclEnqueueSVMMigrateMemhas becomeCOMPLETE, the ranges specified by svm pointers and sizes have been successfully migrated to the device associated with command queue.The user is responsible for managing the event dependencies associated with this command in order to avoid overlapping access to SVM allocations. Improperly specified event dependencies passed to
clEnqueueSVMMigrateMemcould result in undefined results.- Parameters:
command_queue- a valid host command queue. The specified set of allocation ranges will be migrated to the OpenCL device associated withcommand_queue.svm_pointers- a pointer to an array of pointers. Each pointer in this array must be within an allocation produced by a call toSVMAlloc.sizes- an array of sizes. The pairsvm_pointers[i]andsizes[i]together define the starting address and number of bytes in a range to be migrated.sizesmay beNULLindicating that every allocation containing anysvm_pointer[i]is to be migrated. Also, ifsizes[i]is zero, then the entire allocation containingsvm_pointer[i]is migrated.flags- a bit-field that is used to specify migration optionsevent_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 sameINVALID_VALUEifnum_svm_pointersis zero orsvm_pointersisNULL.INVALID_VALUEifsizes[i]is non-zero range[svm_pointers[i], svm_pointers[i]+sizes[i])is not contained within an existingSVMAllocallocation.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.
-
clGetDeviceAndHostTimer
public static int clGetDeviceAndHostTimer(long device, long[] device_timestamp, long[] host_timestamp)Array version of:GetDeviceAndHostTimer
-
clGetHostTimer
public static int clGetHostTimer(long device, long[] host_timestamp)Array version of:GetHostTimer
-
clCreateProgramWithIL
public static long clCreateProgramWithIL(long context, java.nio.ByteBuffer il, int[] errcode_ret)Array version of:CreateProgramWithIL
-
clCloneKernel
public static long clCloneKernel(long source_kernel, int[] errcode_ret)Array version of:CloneKernel
-
-