Cloo 0.9.1
|
Represents an OpenCL kernel. More...
Public Member Functions | |
long | GetLocalMemorySize (ComputeDevice device) |
Gets the amount of local memory in bytes used by the ComputeKernel. | |
long[] | GetCompileWorkGroupSize (ComputeDevice device) |
Gets the compile work-group size specified by the __attribute__((reqd_work_group_size(X, Y, Z))) qualifier. | |
long | GetPreferredWorkGroupSizeMultiple (ComputeDevice device) |
Gets the preferred multiple of workgroup size for launch. | |
long | GetPrivateMemorySize (ComputeDevice device) |
Gets the minimum amount of memory, in bytes, used by each work-item in the kernel. | |
long | GetWorkGroupSize (ComputeDevice device) |
Gets the maximum work-group size that can be used to execute the ComputeKernel on a ComputeDevice. | |
void | SetArgument (int index, IntPtr dataSize, IntPtr dataAddr) |
Sets an argument of the ComputeKernel (no argument tracking). | |
void | SetLocalArgument (int index, long dataSize) |
Sets the size in bytes of an argument specfied with the local or __local address space qualifier. | |
void | SetMemoryArgument (int index, ComputeMemory memObj) |
Sets a T* , image2d_t or image3d_t argument of the ComputeKernel. | |
void | SetSamplerArgument (int index, ComputeSampler sampler) |
Sets a sampler_t argument of the ComputeKernel. | |
void | SetValueArgument< T > (int index, T data) |
Sets a value argument of the ComputeKernel. | |
Protected Member Functions | |
override void | Dispose (bool manual) |
Releases the associated OpenCL object. | |
Properties | |
CLKernelHandle | Handle [get, set] |
The handle of the ComputeKernel. | |
ComputeContext | Context [get] |
Gets the ComputeContext associated with the ComputeKernel. | |
string | FunctionName [get] |
Gets the function name of the ComputeKernel. | |
ComputeProgram | Program [get] |
Gets the ComputeProgram that the ComputeKernel belongs to. |
Represents an OpenCL kernel.
A kernel object encapsulates a specific kernel function declared in a program and the argument values to be used when executing this kernel function.
override void Cloo.ComputeKernel.Dispose | ( | bool | manual | ) | [protected, virtual] |
Releases the associated OpenCL object.
manual | Specifies the operation mode of this method. |
manual must be true
if this method is invoked directly by the application.
Implements Cloo.ComputeResource.
long [] Cloo.ComputeKernel.GetCompileWorkGroupSize | ( | ComputeDevice | device | ) |
Gets the compile work-group size specified by the __attribute__((reqd_work_group_size(X, Y, Z)))
qualifier.
device | One of the ComputeKernel.Program.Devices. |
__attribute__((reqd_work_group_size(X, Y, Z)))
qualifier. If no such qualifier is specified, (0, 0, 0) is returned. long Cloo.ComputeKernel.GetLocalMemorySize | ( | ComputeDevice | device | ) |
Gets the amount of local memory in bytes used by the ComputeKernel.
device | One of the ComputeKernel.Program.Devices. |
long Cloo.ComputeKernel.GetPreferredWorkGroupSizeMultiple | ( | ComputeDevice | device | ) |
Gets the preferred multiple of workgroup size for launch.
device | One of the ComputeKernel.Program.Devices. |
The returned value is a performance hint. Specifying a workgroup size that is not a multiple of the value returned by this query as the value of the local work size argument to ComputeCommandQueue.Execute will not fail to enqueue the kernel for execution unless the work-group size specified is larger than the device maximum. Requires OpenCL 1.1.
long Cloo.ComputeKernel.GetPrivateMemorySize | ( | ComputeDevice | device | ) |
Gets the minimum amount of memory, in bytes, used by each work-item in the kernel.
device | One of the ComputeKernel.Program.Devices. |
The returned value may include any private memory needed by an implementation to execute the kernel, including that used by the language built-ins and variable declared inside the kernel with the __private
or private
qualifier.
long Cloo.ComputeKernel.GetWorkGroupSize | ( | ComputeDevice | device | ) |
Gets the maximum work-group size that can be used to execute the ComputeKernel on a ComputeDevice.
device | One of the ComputeKernel.Program.Devices. |
void Cloo.ComputeKernel.SetArgument | ( | int | index, |
IntPtr | dataSize, | ||
IntPtr | dataAddr | ||
) |
Sets an argument of the ComputeKernel (no argument tracking).
index | The argument index. |
dataSize | The size of the argument data in bytes. |
dataAddr | A pointer to the data that should be used as the argument value. |
Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n-1, where n is the total number of arguments declared by the kernel.
Note that this method does not provide argument tracking. It is up to the user to reference the kernel arguments (i.e. prevent them from being garbage collected) until the kernel has finished execution.
void Cloo.ComputeKernel.SetLocalArgument | ( | int | index, |
long | dataSize | ||
) |
Sets the size in bytes of an argument specfied with the local
or __local
address space qualifier.
index | The argument index. |
dataSize | The size of the argument data in bytes. |
Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n-1, where n is the total number of arguments declared by the kernel.
void Cloo.ComputeKernel.SetMemoryArgument | ( | int | index, |
ComputeMemory | memObj | ||
) |
Sets a T*
, image2d_t
or image3d_t
argument of the ComputeKernel.
index | The argument index. |
memObj | The ComputeMemory that is passed as the argument. |
This method will automatically track memObj to prevent it from being collected by the GC.
Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n-1, where n is the total number of arguments declared by the kernel.
void Cloo.ComputeKernel.SetSamplerArgument | ( | int | index, |
ComputeSampler | sampler | ||
) |
Sets a sampler_t
argument of the ComputeKernel.
index | The argument index. |
sampler | The ComputeSampler that is passed as the argument. |
This method will automatically track sampler to prevent it from being collected by the GC.
Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n-1, where n is the total number of arguments declared by the kernel.
void Cloo.ComputeKernel.SetValueArgument< T > | ( | int | index, |
T | data | ||
) |
Sets a value argument of the ComputeKernel.
T | The type of the argument. |
index | The argument index. |
data | The data that is passed as the argument value. |
Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n-1, where n is the total number of arguments declared by the kernel.
T | : | struct |
ComputeContext Cloo.ComputeKernel.Context [get] |
Gets the ComputeContext associated with the ComputeKernel.
The ComputeContext associated with the ComputeKernel.
string Cloo.ComputeKernel.FunctionName [get] |
Gets the function name of the ComputeKernel.
The function name of the ComputeKernel.
CLKernelHandle Cloo.ComputeKernel.Handle [get, set] |
The handle of the ComputeKernel.
ComputeProgram Cloo.ComputeKernel.Program [get] |
Gets the ComputeProgram that the ComputeKernel belongs to.
The ComputeProgram that the ComputeKernel belongs to.