JOCL v2.6.0-rc-20250722
JOCL, OpenCL® API Binding for Java™ (public API).
com.jogamp.opencl.CLKernel Class Reference

High level abstraction for an OpenCL Kernel. More...

Inheritance diagram for com.jogamp.opencl.CLKernel:
Collaboration diagram for com.jogamp.opencl.CLKernel:

Public Member Functions

CLKernel putArg (final CLMemory<?> value)
 
CLKernel putArg (final short value)
 
CLKernel putArg (final int value)
 
CLKernel putArg (final long value)
 
CLKernel putArg (final float value)
 
CLKernel putArg (final double value)
 
CLKernel putNullArg (final int size)
 
CLKernel putArgs (final CLMemory<?>... values)
 
CLKernel rewind ()
 Resets the argument index to 0. More...
 
int position ()
 Returns the argument index used in the relative putArt(...) methods. More...
 
CLKernel setArg (final int argumentIndex, final CLMemory<?> value)
 
CLKernel setArg (final int argumentIndex, final short value)
 
CLKernel setArg (final int argumentIndex, final int value)
 
CLKernel setArg (final int argumentIndex, final long value)
 
CLKernel setArg (final int argumentIndex, final float value)
 
CLKernel setArg (final int argumentIndex, final double value)
 
CLKernel setNullArg (final int argumentIndex, final int size)
 
CLKernel setArgs (final CLMemory<?>... values)
 
CLKernel setArgs (final Object... values)
 
CLKernel setForce32BitArgs (final boolean force)
 Forces double and long arguments to be passed as float and int to the OpenCL kernel. More...
 
CLProgram getProgram ()
 
boolean isForce32BitArgsEnabled ()
 
long getLocalMemorySize (final CLDevice device)
 Returns the amount of local memory in bytes being used by a kernel. More...
 
long getWorkGroupSize (final CLDevice device)
 Returns the work group size for this kernel on the given device. More...
 
long[] getCompileWorkGroupSize (final CLDevice device)
 Returns the work-group size specified by the attribute((reqd_work_group_size(X, Y, Z))) qualifier in kernel sources. More...
 
long getPreferredWorkGroupSizeMultiple (final CLDevice device)
 Returns the preferred multiple of workgroup size to use for kernel launch. More...
 
long getPrivateMemSize (final CLDevice device)
 Returns the number of bytes of private memory used by each work item in the kernel. More...
 
void release ()
 Releases all resources of this kernel from its context. More...
 
String toString ()
 
boolean equals (final Object obj)
 
int hashCode ()
 
CLKernel clone ()
 Returns a new instance of this kernel with uninitialized arguments. More...
 

Public Attributes

final String name
 
final int numArgs
 

Detailed Description

High level abstraction for an OpenCL Kernel.

A kernel is a function declared in a program. A kernel is identified by the kernel qualifier applied to any function in a program. A kernel object encapsulates the specific kernel function declared in a program and the argument values to be used when executing this kernel function. CLKernel is not threadsafe.

See also
CLProgram::createCLKernel(java.lang.String)
CLProgram::createCLKernels()
Author
Michael Bien, et al.

Definition at line 53 of file CLKernel.java.

Member Function Documentation

◆ clone()

CLKernel com.jogamp.opencl.CLKernel.clone ( )

Returns a new instance of this kernel with uninitialized arguments.

Definition at line 431 of file CLKernel.java.

Here is the call graph for this function:

◆ equals()

boolean com.jogamp.opencl.CLKernel.equals ( final Object  obj)

Definition at line 402 of file CLKernel.java.

Here is the call graph for this function:

◆ getCompileWorkGroupSize()

long[] com.jogamp.opencl.CLKernel.getCompileWorkGroupSize ( final CLDevice  device)

Returns the work-group size specified by the attribute((reqd_work_group_size(X, Y, Z))) qualifier in kernel sources.

If the work-group size is not specified using the above attribute qualifier new long[]{(0, 0, 0)} is returned. The returned array has always three elements.

Version
1.0

Definition at line 342 of file CLKernel.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLocalMemorySize()

long com.jogamp.opencl.CLKernel.getLocalMemorySize ( final CLDevice  device)

Returns the amount of local memory in bytes being used by a kernel.

This includes local memory that may be needed by an implementation to execute the kernel, variables declared inside the kernel with the __local address qualifier and local memory to be allocated for arguments to the kernel declared as pointers with the __local address qualifier and whose size is specified with clSetKernelArg. If the local memory size, for any pointer argument to the kernel declared with the __local address qualifier, is not specified, its size is assumed to be 0.

Version
1.0

Definition at line 320 of file CLKernel.java.

◆ getPreferredWorkGroupSizeMultiple()

long com.jogamp.opencl.CLKernel.getPreferredWorkGroupSizeMultiple ( final CLDevice  device)

Returns the preferred multiple of workgroup size to use for kernel launch.

This is only a performance hint; enqueueing with other sizes will still work, unless the size is more than the maximum allowed.

Version
1.1

Definition at line 360 of file CLKernel.java.

Here is the caller graph for this function:

◆ getPrivateMemSize()

long com.jogamp.opencl.CLKernel.getPrivateMemSize ( final CLDevice  device)

Returns the number of bytes of private memory used by each work item in the kernel.

This includes private memory declared with the __private qualifier, as well as other private memory used by the implementation.

Version
1.1

Definition at line 370 of file CLKernel.java.

Here is the caller graph for this function:

◆ getProgram()

CLProgram com.jogamp.opencl.CLKernel.getProgram ( )

Definition at line 279 of file CLKernel.java.

◆ getWorkGroupSize()

long com.jogamp.opencl.CLKernel.getWorkGroupSize ( final CLDevice  device)

Returns the work group size for this kernel on the given device.

This provides a mechanism for the application to query the work-group size that can be used to execute a kernel on a specific device given by device. The OpenCL implementation uses the resource requirements of the kernel (register usage etc.) to determine what this work-group size should be.

Version
1.0

Definition at line 332 of file CLKernel.java.

Here is the caller graph for this function:

◆ hashCode()

int com.jogamp.opencl.CLKernel.hashCode ( )

Definition at line 420 of file CLKernel.java.

Here is the call graph for this function:

◆ isForce32BitArgsEnabled()

boolean com.jogamp.opencl.CLKernel.isForce32BitArgsEnabled ( )
See also
setForce32BitArgs(boolean)

Definition at line 286 of file CLKernel.java.

◆ position()

int com.jogamp.opencl.CLKernel.position ( )

Returns the argument index used in the relative putArt(...) methods.

Definition at line 166 of file CLKernel.java.

Here is the caller graph for this function:

◆ putArg() [1/6]

CLKernel com.jogamp.opencl.CLKernel.putArg ( final CLMemory<?>  value)

Definition at line 107 of file CLKernel.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ putArg() [2/6]

CLKernel com.jogamp.opencl.CLKernel.putArg ( final double  value)

Definition at line 137 of file CLKernel.java.

Here is the call graph for this function:

◆ putArg() [3/6]

CLKernel com.jogamp.opencl.CLKernel.putArg ( final float  value)

Definition at line 131 of file CLKernel.java.

Here is the call graph for this function:

◆ putArg() [4/6]

CLKernel com.jogamp.opencl.CLKernel.putArg ( final int  value)

Definition at line 119 of file CLKernel.java.

Here is the call graph for this function:

◆ putArg() [5/6]

CLKernel com.jogamp.opencl.CLKernel.putArg ( final long  value)

Definition at line 125 of file CLKernel.java.

Here is the call graph for this function:

◆ putArg() [6/6]

CLKernel com.jogamp.opencl.CLKernel.putArg ( final short  value)

Definition at line 113 of file CLKernel.java.

Here is the call graph for this function:

◆ putArgs()

CLKernel com.jogamp.opencl.CLKernel.putArgs ( final CLMemory<?>...  values)

Definition at line 149 of file CLKernel.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ putNullArg()

CLKernel com.jogamp.opencl.CLKernel.putNullArg ( final int  size)

Definition at line 143 of file CLKernel.java.

Here is the call graph for this function:

◆ release()

void com.jogamp.opencl.CLKernel.release ( )

Releases all resources of this kernel from its context.

Implements com.jogamp.opencl.CLResource.

Definition at line 386 of file CLKernel.java.

Here is the call graph for this function:

◆ rewind()

CLKernel com.jogamp.opencl.CLKernel.rewind ( )

Resets the argument index to 0.

Definition at line 158 of file CLKernel.java.

Here is the caller graph for this function:

◆ setArg() [1/6]

CLKernel com.jogamp.opencl.CLKernel.setArg ( final int  argumentIndex,
final CLMemory<?>  value 
)

Definition at line 175 of file CLKernel.java.

Here is the caller graph for this function:

◆ setArg() [2/6]

CLKernel com.jogamp.opencl.CLKernel.setArg ( final int  argumentIndex,
final double  value 
)

Definition at line 204 of file CLKernel.java.

◆ setArg() [3/6]

CLKernel com.jogamp.opencl.CLKernel.setArg ( final int  argumentIndex,
final float  value 
)

Definition at line 199 of file CLKernel.java.

◆ setArg() [4/6]

CLKernel com.jogamp.opencl.CLKernel.setArg ( final int  argumentIndex,
final int  value 
)

Definition at line 185 of file CLKernel.java.

◆ setArg() [5/6]

CLKernel com.jogamp.opencl.CLKernel.setArg ( final int  argumentIndex,
final long  value 
)

Definition at line 190 of file CLKernel.java.

◆ setArg() [6/6]

CLKernel com.jogamp.opencl.CLKernel.setArg ( final int  argumentIndex,
final short  value 
)

Definition at line 180 of file CLKernel.java.

◆ setArgs() [1/2]

CLKernel com.jogamp.opencl.CLKernel.setArgs ( final CLMemory<?>...  values)

Definition at line 218 of file CLKernel.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setArgs() [2/2]

CLKernel com.jogamp.opencl.CLKernel.setArgs ( final Object...  values)

Definition at line 223 of file CLKernel.java.

Here is the call graph for this function:

◆ setForce32BitArgs()

CLKernel com.jogamp.opencl.CLKernel.setForce32BitArgs ( final boolean  force)

Forces double and long arguments to be passed as float and int to the OpenCL kernel.

This can be used in applications which want to mix kernels with different floating point precision.

Definition at line 274 of file CLKernel.java.

Here is the caller graph for this function:

◆ setNullArg()

CLKernel com.jogamp.opencl.CLKernel.setNullArg ( final int  argumentIndex,
final int  size 
)

Definition at line 213 of file CLKernel.java.

Here is the caller graph for this function:

◆ toString()

String com.jogamp.opencl.CLKernel.toString ( )

Reimplemented from com.jogamp.opencl.CLObject.

Definition at line 396 of file CLKernel.java.

Member Data Documentation

◆ name

final String com.jogamp.opencl.CLKernel.name

Definition at line 55 of file CLKernel.java.

◆ numArgs

final int com.jogamp.opencl.CLKernel.numArgs

Definition at line 56 of file CLKernel.java.


The documentation for this class was generated from the following file: