Package com.aparapi.internal.jni
Class KernelRunnerJNI
java.lang.Object
com.aparapi.internal.jni.KernelRunnerJNI
- Direct Known Subclasses:
KernelRunner
This class is intended to be used as a 'proxy' or 'facade' object for Java code to interact with JNI
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
TODO:protected static final int
This 'bit' indicates that a particularKernelArg
represents an array.
SoARG_ARRAY|ARG_INT
tells us this arg is an array ofint
.protected static final int
This 'bit' indicates that a particularKernelArg
has it's length reference, in which case a synthetic arg is passed (name mangled) to the OpenCL kernel.protected static final int
This 'bit' indicates that a particularKernelArg
represents aboolean
type (array or primitive).protected static final int
This 'bit' indicates that a particularKernelArg
represents abyte
type (array or primitive).protected static final int
This 'bit' indicates that a particularKernelArg
represents achar
type (array or primitive).protected static final int
This 'bit' indicates that a particularKernelArg
resides in constant memory in the generated OpenCL code.protected static final int
This 'bit' indicates that a particularKernelArg
represents adouble
type (array or primitive).protected static final int
This 'bit' indicates that the arg has been explicitly marked for readingprotected static final int
This 'bit' indicates that the arg has been explicitly marked for writingprotected static final int
This 'bit' indicates that a particularKernelArg
represents afloat
type (array or primitive).protected static final int
This 'bit' indicates that a particularKernelArg
resides in global memory in the generated OpenCL code.protected static final int
This 'bit' indicates that a particularKernelArg
represents aint
type (array or primitive).protected static final int
This 'bit' indicates that a particularKernelArg
resides in local memory in the generated OpenCL code.protected static final int
This 'bit' indicates that a particularKernelArg
represents along
type (array or primitive).protected static final int
TODO:protected static final int
This 'bit' indicates that a particularKernelArg
represents a primitive (non array).
SoARG_PRIMITIVE|ARG_INT
tells us this arg is a primitiveint
.protected static final int
This 'bit' indicates that a particularKernelArg
is read by the Kernel (note from the Kernel's point of view).
SoARG_ARRAY|ARG_INT|ARG_READ
tells us this arg is an array of int's that are read by the kernel.protected static final int
TODO:protected static final int
This 'bit' indicates that a particularKernelArg
represents astatic
field (array or primitive).protected static final int
This 'bit' indicates that a particularKernelArg
is mutated by the Kernel (note from the Kernel's point of view).
SoARG_ARRAY|ARG_INT|ARG_WRITE
tells us this arg is an array of int's that we expect the kernel to mutate.protected static final int
This 'bit' indicates that we want to execute on the Acceleratr.protected static final int
This 'bit' indicates that we want to execute on the GPU. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected long
buildProgramJNI
(long _jniContextHandle, String _source, String _binaryKey) protected int
disposeJNI
(long _jniContextHandle) protected String
getExtensionsJNI
(long _jniContextHandle) protected int
protected int[]
getKernelCompileWorkGroupSizeJNI
(long _jniContextHandle) protected long
getKernelLocalMemSizeInUseJNI
(long _jniContextHandle) protected int
getKernelMaxWorkGroupSizeJNI
(long _jniContextHandle) protected long
getKernelMinimumPrivateMemSizeInUsePerWorkItemJNI
(long _jniContextHandle) protected int
getKernelPreferredWorkGroupSizeMultipleJNI
(long _jniContextHandle) protected List
<ProfileInfo> getProfileInfoJNI
(long _jniContextHandle) protected long
initJNI
(Kernel _kernel, OpenCLDevice _device, int _flags) TODO: synchronized to avoid race in clGetPlatformIDs() in OpenCL lib problem should fixed in some future OpenCL versionprotected int
runKernelJNI
(long _jniContextHandle, Range _range, boolean _needSync, int _passes, ByteBuffer _inBuffer, ByteBuffer _outBuffer) protected int
setArgsJNI
(long _jniContextHandle, KernelArgJNI[] _args, int argc)
-
Field Details
-
ARG_BOOLEAN
protected static final int ARG_BOOLEANThis 'bit' indicates that a particularKernelArg
represents aboolean
type (array or primitive).- See Also:
-
ARG_BYTE
protected static final int ARG_BYTEThis 'bit' indicates that a particularKernelArg
represents abyte
type (array or primitive).- See Also:
-
ARG_FLOAT
protected static final int ARG_FLOATThis 'bit' indicates that a particularKernelArg
represents afloat
type (array or primitive).- See Also:
-
ARG_INT
protected static final int ARG_INTThis 'bit' indicates that a particularKernelArg
represents aint
type (array or primitive).- See Also:
-
ARG_DOUBLE
protected static final int ARG_DOUBLEThis 'bit' indicates that a particularKernelArg
represents adouble
type (array or primitive).- See Also:
-
ARG_LONG
protected static final int ARG_LONGThis 'bit' indicates that a particularKernelArg
represents along
type (array or primitive).- See Also:
-
ARG_SHORT
protected static final int ARG_SHORTTODO:- See Also:
-
ARG_ARRAY
protected static final int ARG_ARRAYThis 'bit' indicates that a particularKernelArg
represents an array.
SoARG_ARRAY|ARG_INT
tells us this arg is an array ofint
.- See Also:
-
ARG_PRIMITIVE
protected static final int ARG_PRIMITIVEThis 'bit' indicates that a particularKernelArg
represents a primitive (non array).
SoARG_PRIMITIVE|ARG_INT
tells us this arg is a primitiveint
.- See Also:
-
ARG_READ
protected static final int ARG_READThis 'bit' indicates that a particularKernelArg
is read by the Kernel (note from the Kernel's point of view).
SoARG_ARRAY|ARG_INT|ARG_READ
tells us this arg is an array of int's that are read by the kernel.- See Also:
-
ARG_WRITE
protected static final int ARG_WRITEThis 'bit' indicates that a particularKernelArg
is mutated by the Kernel (note from the Kernel's point of view).
SoARG_ARRAY|ARG_INT|ARG_WRITE
tells us this arg is an array of int's that we expect the kernel to mutate.- See Also:
-
ARG_LOCAL
protected static final int ARG_LOCALThis 'bit' indicates that a particularKernelArg
resides in local memory in the generated OpenCL code.- See Also:
-
ARG_GLOBAL
protected static final int ARG_GLOBALThis 'bit' indicates that a particularKernelArg
resides in global memory in the generated OpenCL code.- See Also:
-
ARG_CONSTANT
protected static final int ARG_CONSTANTThis 'bit' indicates that a particularKernelArg
resides in constant memory in the generated OpenCL code.- See Also:
-
ARG_ARRAYLENGTH
protected static final int ARG_ARRAYLENGTHThis 'bit' indicates that a particularKernelArg
has it's length reference, in which case a synthetic arg is passed (name mangled) to the OpenCL kernel.- See Also:
-
ARG_APARAPI_BUFFER
protected static final int ARG_APARAPI_BUFFERTODO:- See Also:
-
ARG_EXPLICIT
protected static final int ARG_EXPLICITThis 'bit' indicates that the arg has been explicitly marked for reading- See Also:
-
ARG_EXPLICIT_WRITE
protected static final int ARG_EXPLICIT_WRITEThis 'bit' indicates that the arg has been explicitly marked for writing- See Also:
-
ARG_OBJ_ARRAY_STRUCT
protected static final int ARG_OBJ_ARRAY_STRUCTTODO:- See Also:
-
ARG_CHAR
protected static final int ARG_CHARThis 'bit' indicates that a particularKernelArg
represents achar
type (array or primitive).- See Also:
-
ARG_STATIC
protected static final int ARG_STATICThis 'bit' indicates that a particularKernelArg
represents astatic
field (array or primitive).- See Also:
-
JNI_FLAG_USE_GPU
protected static final int JNI_FLAG_USE_GPUThis 'bit' indicates that we want to execute on the GPU. Be careful changing final constants starting with JNI.- See Also:
-
JNI_FLAG_USE_ACC
protected static final int JNI_FLAG_USE_ACCThis 'bit' indicates that we want to execute on the Acceleratr. Be careful changing final constants starting with JNI.- See Also:
-
-
Constructor Details
-
KernelRunnerJNI
public KernelRunnerJNI()
-
-
Method Details
-
initJNI
TODO: synchronized to avoid race in clGetPlatformIDs() in OpenCL lib problem should fixed in some future OpenCL version- Parameters:
_kernel
-_device
-_flags
-- Returns:
-
getJNI
-
buildProgramJNI
- Parameters:
_source
- The OpenCL source code to compile, which may be sent empty if the binary for that source code is known to be cached on the JNI side under the key_binaryKey
._binaryKey
- A key which embodies a Kernel class and a Device, under which the JNI side will cache the compiled binary corresponding to that Kernel/Device pair. Once a certain _binaryKey has been passed to this method once, further calls to this method with that key will ignore the _source (which can be passed empty) andused the cached binary.By passing an empty String as the _binaryKey, the entire JNI-side binary caching apparatus can be disabled.
-
setArgsJNI
-
runKernelJNI
protected int runKernelJNI(long _jniContextHandle, Range _range, boolean _needSync, int _passes, ByteBuffer _inBuffer, ByteBuffer _outBuffer) -
disposeJNI
protected int disposeJNI(long _jniContextHandle) -
getExtensionsJNI
-
getProfileInfoJNI
-
getKernelMinimumPrivateMemSizeInUsePerWorkItemJNI
protected long getKernelMinimumPrivateMemSizeInUsePerWorkItemJNI(long _jniContextHandle) -
getKernelLocalMemSizeInUseJNI
protected long getKernelLocalMemSizeInUseJNI(long _jniContextHandle) -
getKernelPreferredWorkGroupSizeMultipleJNI
protected int getKernelPreferredWorkGroupSizeMultipleJNI(long _jniContextHandle) -
getKernelMaxWorkGroupSizeJNI
protected int getKernelMaxWorkGroupSizeJNI(long _jniContextHandle) -
getKernelCompileWorkGroupSizeJNI
protected int[] getKernelCompileWorkGroupSizeJNI(long _jniContextHandle)
-