Public Member Functions | Protected Member Functions | Properties

Cloo.ComputeKernel Class Reference

Represents an OpenCL kernel. More...

Inheritance diagram for Cloo.ComputeKernel:
Cloo.ComputeResource Cloo.ComputeObject

List of all members.

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 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 a value argument of the ComputeKernel.
void SetLocalArgument (int index, long dataSize)
 Sets the size in bytes of an argument specfied with the local address space qualifier.
void SetMemoryArgument (int index, ComputeMemory memObj)
 Sets a T*, image2d_t or image3d_t argument of the ComputeKernel.
void SetMemoryArgument (int index, ComputeMemory memObj, bool track)
 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 SetSamplerArgument (int index, ComputeSampler sampler, bool track)
 Sets a sampler_t argument of the ComputeKernel.
void SetValueArgument< T > (int index, T data)
 Sets a value argument of the ComputeKernel.
override string ToString ()
 Gets the string representation of the ComputeKernel.

Protected Member Functions

override void Dispose (bool manual)

Properties

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.

Detailed Description

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.

See also:
ComputeCommandQueue, ComputeProgram

Member Function Documentation

override void Cloo.ComputeKernel.Dispose ( bool  manual  )  [protected, virtual]

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.

Parameters:
device One of the ComputeKernel.Program.Devices.
Returns:
The compile work-group size specified by the __attribute__((reqd_work_group_size(X, Y, Z))) qualifier. If such qualifier is not specified, (0, 0, 0) is returned.
long Cloo.ComputeKernel.GetLocalMemorySize ( ComputeDevice  device  ) 

Gets the amount of local memory in bytes used by the ComputeKernel.

Parameters:
device One of the ComputeKernel.Program.Devices.
Returns:
The amount of local memory in bytes used by the ComputeKernel.
long Cloo.ComputeKernel.GetWorkGroupSize ( ComputeDevice  device  ) 

Gets the maximum work-group size that can be used to execute the ComputeKernel on a ComputeDevice.

Parameters:
device One of the ComputeKernel.Program.Devices.
Returns:
The maximum work-group size that can be used to execute the ComputeKernel on device .
void Cloo.ComputeKernel.SetArgument ( int  index,
IntPtr  dataSize,
IntPtr  dataAddr 
)

Sets a value argument of the ComputeKernel.

Parameters:
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 a kernel.

void Cloo.ComputeKernel.SetLocalArgument ( int  index,
long  dataSize 
)

Sets the size in bytes of an argument specfied with the local address space qualifier.

Parameters:
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 a kernel.

void Cloo.ComputeKernel.SetMemoryArgument ( int  index,
ComputeMemory  memObj,
bool  track 
)

Sets a T*, image2d_t or image3d_t argument of the ComputeKernel.

Parameters:
index The argument index.
memObj The ComputeMemory that is passed as the argument.
track Specify whether the kernel should prevent garbage collection of the memObj until ComputeKernel execution. This is useful if the application code doesn't refer to memObj after this call or forces a GC.Collect() between this call and the ComputeKernel execution.

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 a kernel.

void Cloo.ComputeKernel.SetMemoryArgument ( int  index,
ComputeMemory  memObj 
)

Sets a T*, image2d_t or image3d_t argument of the ComputeKernel.

Parameters:
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 a kernel.

void Cloo.ComputeKernel.SetSamplerArgument ( int  index,
ComputeSampler  sampler,
bool  track 
)

Sets a sampler_t argument of the ComputeKernel.

Parameters:
index The argument index.
sampler The ComputeSampler that is passed as the argument.
track Specify whether the kernel should prevent garbage collection of the sampler until ComputeKernel execution. This is useful if the application code doesn't refer to sampler after this call or forces a GC.Collect() between this call and the ComputeKernel execution.

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 a kernel.

void Cloo.ComputeKernel.SetSamplerArgument ( int  index,
ComputeSampler  sampler 
)

Sets a sampler_t argument of the ComputeKernel.

Parameters:
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 a kernel.

void Cloo.ComputeKernel.SetValueArgument< T > ( int  index,
data 
)

Sets a value argument of the ComputeKernel.

Template Parameters:
T The type of the argument.
Parameters:
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 a kernel.

Type Constraints
T :struct 
override string Cloo.ComputeKernel.ToString (  ) 

Gets the string representation of the ComputeKernel.

Returns:
The string representation of the ComputeKernel.

Reimplemented from Cloo.ComputeObject.


Property Documentation

ComputeContext Cloo.ComputeKernel.Context [get]

Gets the ComputeContext associated with the ComputeKernel.

string Cloo.ComputeKernel.FunctionName [get]

Gets the function name of the ComputeKernel.

ComputeProgram Cloo.ComputeKernel.Program [get]

Gets the ComputeProgram that the ComputeKernel belongs to.


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