Package com.aparapi.internal.jni
Class KernelRunnerJNI
- java.lang.Object
-
- com.aparapi.internal.jni.KernelRunnerJNI
-
- Direct Known Subclasses:
KernelRunner
public abstract class KernelRunnerJNI extends java.lang.ObjectThis class is intended to be used as a 'proxy' or 'facade' object for Java code to interact with JNI
-
-
Field Summary
Fields Modifier and Type Field Description protected static intARG_APARAPI_BUFFERTODO:protected static intARG_ARRAYThis 'bit' indicates that a particularKernelArgrepresents an array.
SoARG_ARRAY|ARG_INTtells us this arg is an array ofint.protected static intARG_ARRAYLENGTHThis '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 intARG_BOOLEANThis 'bit' indicates that a particularKernelArgrepresents abooleantype (array or primitive).protected static intARG_BYTEThis 'bit' indicates that a particularKernelArgrepresents abytetype (array or primitive).protected static intARG_CHARThis 'bit' indicates that a particularKernelArgrepresents achartype (array or primitive).protected static intARG_CONSTANTThis 'bit' indicates that a particularKernelArgresides in constant memory in the generated OpenCL code.protected static intARG_DOUBLEThis 'bit' indicates that a particularKernelArgrepresents adoubletype (array or primitive).protected static intARG_EXPLICITThis 'bit' indicates that the arg has been explicitly marked for readingprotected static intARG_EXPLICIT_WRITEThis 'bit' indicates that the arg has been explicitly marked for writingprotected static intARG_FLOATThis 'bit' indicates that a particularKernelArgrepresents afloattype (array or primitive).protected static intARG_GLOBALThis 'bit' indicates that a particularKernelArgresides in global memory in the generated OpenCL code.protected static intARG_INTThis 'bit' indicates that a particularKernelArgrepresents ainttype (array or primitive).protected static intARG_LOCALThis 'bit' indicates that a particularKernelArgresides in local memory in the generated OpenCL code.protected static intARG_LONGThis 'bit' indicates that a particularKernelArgrepresents alongtype (array or primitive).protected static intARG_OBJ_ARRAY_STRUCTTODO:protected static intARG_PRIMITIVEThis 'bit' indicates that a particularKernelArgrepresents a primitive (non array).
SoARG_PRIMITIVE|ARG_INTtells us this arg is a primitiveint.protected static intARG_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.protected static intARG_SHORTTODO:protected static intARG_STATICThis 'bit' indicates that a particularKernelArgrepresents astaticfield (array or primitive).protected static intARG_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.protected static intJNI_FLAG_USE_ACCThis 'bit' indicates that we want to execute on the Acceleratr.protected static intJNI_FLAG_USE_GPUThis 'bit' indicates that we want to execute on the GPU.
-
Constructor Summary
Constructors Constructor Description KernelRunnerJNI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longbuildProgramJNI(long _jniContextHandle, java.lang.String _source, java.lang.String _binaryKey)protected intdisposeJNI(long _jniContextHandle)protected java.lang.StringgetExtensionsJNI(long _jniContextHandle)protected intgetJNI(long _jniContextHandle, java.lang.Object _array)protected int[]getKernelCompileWorkGroupSizeJNI(long _jniContextHandle)protected longgetKernelLocalMemSizeInUseJNI(long _jniContextHandle)protected intgetKernelMaxWorkGroupSizeJNI(long _jniContextHandle)protected longgetKernelMinimumPrivateMemSizeInUsePerWorkItemJNI(long _jniContextHandle)protected intgetKernelPreferredWorkGroupSizeMultipleJNI(long _jniContextHandle)protected java.util.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, java.nio.ByteBuffer _inBuffer, java.nio.ByteBuffer _outBuffer)protected intsetArgsJNI(long _jniContextHandle, KernelArgJNI[] _args, int argc)
-
-
-
Field Detail
-
ARG_BOOLEAN
protected static final int ARG_BOOLEAN
This 'bit' indicates that a particularKernelArgrepresents abooleantype (array or primitive).- See Also:
UsedByJNICode, Constant Field Values
-
ARG_BYTE
protected static final int ARG_BYTE
This 'bit' indicates that a particularKernelArgrepresents abytetype (array or primitive).- See Also:
UsedByJNICode, Constant Field Values
-
ARG_FLOAT
protected static final int ARG_FLOAT
This 'bit' indicates that a particularKernelArgrepresents afloattype (array or primitive).- See Also:
UsedByJNICode, Constant Field Values
-
ARG_INT
protected static final int ARG_INT
This 'bit' indicates that a particularKernelArgrepresents ainttype (array or primitive).- See Also:
UsedByJNICode, Constant Field Values
-
ARG_DOUBLE
protected static final int ARG_DOUBLE
This 'bit' indicates that a particularKernelArgrepresents adoubletype (array or primitive).- See Also:
UsedByJNICode, Constant Field Values
-
ARG_LONG
protected static final int ARG_LONG
This 'bit' indicates that a particularKernelArgrepresents alongtype (array or primitive).- See Also:
UsedByJNICode, Constant Field Values
-
ARG_SHORT
protected static final int ARG_SHORT
TODO:- See Also:
UsedByJNICode, Constant Field Values
-
ARG_ARRAY
protected static final int ARG_ARRAY
This 'bit' indicates that a particularKernelArgrepresents an array.
SoARG_ARRAY|ARG_INTtells us this arg is an array ofint.- See Also:
UsedByJNICode, Constant Field Values
-
ARG_PRIMITIVE
protected static final int ARG_PRIMITIVE
This 'bit' indicates that a particularKernelArgrepresents a primitive (non array).
SoARG_PRIMITIVE|ARG_INTtells us this arg is a primitiveint.- See Also:
UsedByJNICode, Constant Field Values
-
ARG_READ
protected static final int ARG_READ
This '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:
UsedByJNICode, Constant Field Values
-
ARG_WRITE
protected static final int ARG_WRITE
This '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:
UsedByJNICode, Constant Field Values
-
ARG_LOCAL
protected static final int ARG_LOCAL
This 'bit' indicates that a particularKernelArgresides in local memory in the generated OpenCL code.- See Also:
UsedByJNICode,Experimental, Constant Field Values
-
ARG_GLOBAL
protected static final int ARG_GLOBAL
This 'bit' indicates that a particularKernelArgresides in global memory in the generated OpenCL code.- See Also:
UsedByJNICode,Experimental, Constant Field Values
-
ARG_CONSTANT
protected static final int ARG_CONSTANT
This 'bit' indicates that a particularKernelArgresides in constant memory in the generated OpenCL code.- See Also:
UsedByJNICode,Experimental, Constant Field Values
-
ARG_ARRAYLENGTH
protected static final int ARG_ARRAYLENGTH
This '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:
UsedByJNICode, Constant Field Values
-
ARG_APARAPI_BUFFER
protected static final int ARG_APARAPI_BUFFER
TODO:- See Also:
UsedByJNICode, Constant Field Values
-
ARG_EXPLICIT
protected static final int ARG_EXPLICIT
This 'bit' indicates that the arg has been explicitly marked for reading- See Also:
UsedByJNICode, Constant Field Values
-
ARG_EXPLICIT_WRITE
protected static final int ARG_EXPLICIT_WRITE
This 'bit' indicates that the arg has been explicitly marked for writing- See Also:
UsedByJNICode, Constant Field Values
-
ARG_OBJ_ARRAY_STRUCT
protected static final int ARG_OBJ_ARRAY_STRUCT
TODO:- See Also:
UsedByJNICode, Constant Field Values
-
ARG_CHAR
protected static final int ARG_CHAR
This 'bit' indicates that a particularKernelArgrepresents achartype (array or primitive).- See Also:
UsedByJNICode, Constant Field Values
-
ARG_STATIC
protected static final int ARG_STATIC
This 'bit' indicates that a particularKernelArgrepresents astaticfield (array or primitive).- See Also:
UsedByJNICode, Constant Field Values
-
JNI_FLAG_USE_GPU
protected static final int JNI_FLAG_USE_GPU
This 'bit' indicates that we want to execute on the GPU. Be careful changing final constants starting with JNI.- See Also:
UsedByJNICode, Constant Field Values
-
JNI_FLAG_USE_ACC
protected static final int JNI_FLAG_USE_ACC
This 'bit' indicates that we want to execute on the Acceleratr. Be careful changing final constants starting with JNI.- See Also:
UsedByJNICode, Constant Field Values
-
-
Method Detail
-
initJNI
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 version- Parameters:
_kernel-_device-_flags-- Returns:
-
getJNI
protected int getJNI(long _jniContextHandle, java.lang.Object _array)
-
buildProgramJNI
protected long buildProgramJNI(long _jniContextHandle, java.lang.String _source, java.lang.String _binaryKey)- 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
protected int setArgsJNI(long _jniContextHandle, KernelArgJNI[] _args, int argc)
-
runKernelJNI
protected int runKernelJNI(long _jniContextHandle, Range _range, boolean _needSync, int _passes, java.nio.ByteBuffer _inBuffer, java.nio.ByteBuffer _outBuffer)
-
disposeJNI
protected int disposeJNI(long _jniContextHandle)
-
getExtensionsJNI
protected java.lang.String getExtensionsJNI(long _jniContextHandle)
-
getProfileInfoJNI
protected java.util.List<ProfileInfo> getProfileInfoJNI(long _jniContextHandle)
-
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)
-
-