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 intTODO:protected static final intThis 'bit' indicates that a particularKernelArgrepresents an array.
SoARG_ARRAY|ARG_INTtells us this arg is an array ofint.protected static final intThis 'bit' indicates that a particularKernelArghas it's length reference, in which case a synthetic arg is passed (name mangled) to the OpenCL kernel.protected static final intThis 'bit' indicates that a particularKernelArgrepresents abooleantype (array or primitive).protected static final intThis 'bit' indicates that a particularKernelArgrepresents abytetype (array or primitive).protected static final intThis 'bit' indicates that a particularKernelArgrepresents achartype (array or primitive).protected static final intThis 'bit' indicates that a particularKernelArgresides in constant memory in the generated OpenCL code.protected static final intThis 'bit' indicates that a particularKernelArgrepresents adoubletype (array or primitive).protected static final intThis 'bit' indicates that the arg has been explicitly marked for readingprotected static final intThis 'bit' indicates that the arg has been explicitly marked for writingprotected static final intThis 'bit' indicates that a particularKernelArgrepresents afloattype (array or primitive).protected static final intThis 'bit' indicates that a particularKernelArgresides in global memory in the generated OpenCL code.protected static final intThis 'bit' indicates that a particularKernelArgrepresents ainttype (array or primitive).protected static final intThis 'bit' indicates that a particularKernelArgresides in local memory in the generated OpenCL code.protected static final intThis 'bit' indicates that a particularKernelArgrepresents alongtype (array or primitive).protected static final intTODO:protected static final intThis 'bit' indicates that a particularKernelArgrepresents a primitive (non array).
SoARG_PRIMITIVE|ARG_INTtells us this arg is a primitiveint.protected static final intThis 'bit' indicates that a particularKernelArgis read by the Kernel (note from the Kernel's point of view).
SoARG_ARRAY|ARG_INT|ARG_READtells us this arg is an array of int's that are read by the kernel.protected static final intTODO:protected static final intThis 'bit' indicates that a particularKernelArgrepresents astaticfield (array or primitive).protected static final intThis 'bit' indicates that a particularKernelArgis mutated by the Kernel (note from the Kernel's point of view).
SoARG_ARRAY|ARG_INT|ARG_WRITEtells us this arg is an array of int's that we expect the kernel to mutate.protected static final intThis 'bit' indicates that we want to execute on the Acceleratr.protected static final intThis 'bit' indicates that we want to execute on the GPU. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longbuildProgramJNI(long _jniContextHandle, String _source, String _binaryKey) protected intdisposeJNI(long _jniContextHandle) protected StringgetExtensionsJNI(long _jniContextHandle) protected intprotected int[]getKernelCompileWorkGroupSizeJNI(long _jniContextHandle) protected longgetKernelLocalMemSizeInUseJNI(long _jniContextHandle) protected intgetKernelMaxWorkGroupSizeJNI(long _jniContextHandle) protected longgetKernelMinimumPrivateMemSizeInUsePerWorkItemJNI(long _jniContextHandle) protected intgetKernelPreferredWorkGroupSizeMultipleJNI(long _jniContextHandle) protected List<ProfileInfo> getProfileInfoJNI(long _jniContextHandle) protected longinitJNI(Kernel _kernel, OpenCLDevice _device, int _flags) TODO: synchronized to avoid race in clGetPlatformIDs() in OpenCL lib problem should fixed in some future OpenCL versionprotected intrunKernelJNI(long _jniContextHandle, Range _range, boolean _needSync, int _passes, ByteBuffer _inBuffer, ByteBuffer _outBuffer) protected intsetArgsJNI(long _jniContextHandle, KernelArgJNI[] _args, int argc)
-
Field Details
-
ARG_BOOLEAN
protected static final int ARG_BOOLEANThis 'bit' indicates that a particularKernelArgrepresents abooleantype (array or primitive).- See Also:
-
ARG_BYTE
protected static final int ARG_BYTEThis 'bit' indicates that a particularKernelArgrepresents abytetype (array or primitive).- See Also:
-
ARG_FLOAT
protected static final int ARG_FLOATThis 'bit' indicates that a particularKernelArgrepresents afloattype (array or primitive).- See Also:
-
ARG_INT
protected static final int ARG_INTThis 'bit' indicates that a particularKernelArgrepresents ainttype (array or primitive).- See Also:
-
ARG_DOUBLE
protected static final int ARG_DOUBLEThis 'bit' indicates that a particularKernelArgrepresents adoubletype (array or primitive).- See Also:
-
ARG_LONG
protected static final int ARG_LONGThis 'bit' indicates that a particularKernelArgrepresents alongtype (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 particularKernelArgrepresents an array.
SoARG_ARRAY|ARG_INTtells us this arg is an array ofint.- See Also:
-
ARG_PRIMITIVE
protected static final int ARG_PRIMITIVEThis 'bit' indicates that a particularKernelArgrepresents a primitive (non array).
SoARG_PRIMITIVE|ARG_INTtells us this arg is a primitiveint.- See Also:
-
ARG_READ
protected static final int ARG_READThis 'bit' indicates that a particularKernelArgis read by the Kernel (note from the Kernel's point of view).
SoARG_ARRAY|ARG_INT|ARG_READtells 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 particularKernelArgis mutated by the Kernel (note from the Kernel's point of view).
SoARG_ARRAY|ARG_INT|ARG_WRITEtells 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 particularKernelArgresides in local memory in the generated OpenCL code.- See Also:
-
ARG_GLOBAL
protected static final int ARG_GLOBALThis 'bit' indicates that a particularKernelArgresides in global memory in the generated OpenCL code.- See Also:
-
ARG_CONSTANT
protected static final int ARG_CONSTANTThis 'bit' indicates that a particularKernelArgresides in constant memory in the generated OpenCL code.- See Also:
-
ARG_ARRAYLENGTH
protected static final int ARG_ARRAYLENGTHThis 'bit' indicates that a particularKernelArghas 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 particularKernelArgrepresents achartype (array or primitive).- See Also:
-
ARG_STATIC
protected static final int ARG_STATICThis 'bit' indicates that a particularKernelArgrepresents astaticfield (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)
-