ILGPU  0.9.0
ILGPU.Backends.OpenCL.CLKernelFunctionGenerator Class Reference

Represents a function generator for main kernel functions. More...

Inheritance diagram for ILGPU.Backends.OpenCL.CLKernelFunctionGenerator:
ILGPU.Backends.OpenCL.CLCodeGenerator ILGPU.Backends.OpenCL.CLVariableAllocator ILGPU.Backends.IBackendCodeGenerator< StringBuilder > ILGPU.Backends.VariableAllocator

Public Member Functions

 CLKernelFunctionGenerator (in GeneratorArgs args, Method method, Allocas allocas)
 Creates a new OpenCL function generator. More...
 
override void GenerateHeader (StringBuilder builder)
 Generates a function declaration in OpenCL code. More...
 
override void GenerateCode ()
 Generates OpenCL code. More...
 
- Public Member Functions inherited from ILGPU.Backends.OpenCL.CLCodeGenerator
void GenerateConstants (StringBuilder builder)
 Generates PTX constant declarations. More...
 
void Merge (StringBuilder builder)
 
void PushIndent ()
 Increases the current indentation level. More...
 
void PopIndent ()
 Decreases the current indentation level. More...
 
void AppendIndent ()
 Appends the current indentation level to the builder. More...
 
void PushAndAppendIndent ()
 Pushes the current indentation level and appends it to the builder. More...
 
void Declare (Variable target)
 Declares a variable More...
 
void GotoStatement (BasicBlock block)
 Emits a new goto statement to the given target block. More...
 
void Move (Variable target, Variable source)
 Emits a move operation. More...
 
StatementEmitter BeginStatement (Variable target)
 Begins a new statement. More...
 
StatementEmitter BeginStatement (Variable target, FieldAccess?fieldAccess)
 Begins a new statement. More...
 
StatementEmitter BeginStatement (Variable target, FieldAccess fieldAccess)
 Begins a new statement. More...
 
StatementEmitter BeginStatement (Variable target, Variable indexer)
 Begins a new statement. More...
 
StatementEmitter BeginStatement (Variable target, string command)
 Begins a new statement. More...
 
StatementEmitter BeginStatement (string command)
 Begins a new statement. More...
 
void GenerateCode (ReturnTerminator returnTerminator)
 
void GenerateCode (UnconditionalBranch branch)
 
void GenerateCode (IfBranch branch)
 
void GenerateCode (SwitchBranch branch)
 
void GenerateCode (MethodCall methodCall)
 
void GenerateCode (Parameter parameter)
 
void GenerateCode (PhiValue phiValue)
 
void GenerateCode (UnaryArithmeticValue value)
 
void GenerateCode (BinaryArithmeticValue value)
 
void GenerateCode (TernaryArithmeticValue value)
 
void GenerateCode (CompareValue value)
 
void GenerateCode (ConvertValue value)
 
void GenerateCode (PointerCast value)
 
void GenerateCode (FloatAsIntCast value)
 
void GenerateCode (IntAsFloatCast value)
 
void GenerateCode (IfPredicate predicate)
 
void GenerateCode (SwitchPredicate predicate)
 
void GenerateCode (GenericAtomic atomic)
 
void GenerateCode (AtomicCAS atomicCAS)
 
void GenerateCode (Alloca alloca)
 
void GenerateCode (MemoryBarrier barrier)
 
void GenerateCode (Load load)
 
void GenerateCode (Store store)
 
void GenerateCode (LoadFieldAddress value)
 
void GenerateCode (PrimitiveValue value)
 
void GenerateCode (StringValue value)
 
void GenerateCode (NullValue value)
 
void GenerateCode (StructureValue value)
 
void GenerateCode (GetField value)
 
void GenerateCode (SetField value)
 
void GenerateCode (GridIndexValue value)
 
void GenerateCode (GroupIndexValue value)
 
void GenerateCode (GridDimensionValue value)
 
void GenerateCode (GroupDimensionValue value)
 
void GenerateCode (WarpSizeValue value)
 
void GenerateCode (LaneIdxValue value)
 
void GenerateCode (PredicateBarrier barrier)
 
void GenerateCode (Barrier barrier)
 
void GenerateCode (Broadcast broadcast)
 
void GenerateCode (WarpShuffle shuffle)
 
void GenerateCode (SubWarpShuffle shuffle)
 
void GenerateCode (DebugOperation debug)
 
void GenerateCode (LoadElementAddress value)
 
void GenerateCode (AddressSpaceCast value)
 
- Public Member Functions inherited from ILGPU.Backends.OpenCL.CLVariableAllocator
 CLVariableAllocator (CLTypeGenerator typeGenerator)
 Constructs a new register allocator. More...
 
string GetVariableType (Variable variable)
 Resolves the type name of the given variable. More...
 
- Public Member Functions inherited from ILGPU.Backends.VariableAllocator
Variable Allocate (Value value)
 Allocates a new variable. More...
 
Variable Allocate (Value value, ArithmeticBasicValueType basicValueType)
 Allocates a new variable. More...
 
AllocateAs< T > (Value value)
 Allocates a new variable as type T . More...
 
Variable AllocateType (ArithmeticBasicValueType basicValueType)
 Allocates the given type. More...
 
Variable AllocateType (BasicValueType basicValueType)
 Allocates the given type. More...
 
PointerVariable AllocatePointerType (PointerType pointerType)
 Allocates a pointer type. More...
 
Variable AllocateType (TypeNode typeNode)
 Allocates the given type. More...
 
Variable Load (Value value)
 Loads the given value. More...
 
LoadAs< T > (Value value)
 Loads the given value as variable type T . More...
 
void Bind (Value node, Variable targetVariable)
 Binds the given value to the target variable. More...
 
- Public Member Functions inherited from ILGPU.Backends.IBackendCodeGenerator< StringBuilder >
void GenerateConstants (TKernelBuilder builder)
 Generates all constant definitions (if any). More...
 
void GenerateHeader (TKernelBuilder builder)
 Generates a header definition (if any). More...
 
void GenerateCode ()
 Generates the actual function code. More...
 
void GenerateCode (MethodCall methodCall)
 Generates code for the given value. More...
 
void GenerateCode (PhiValue phiValue)
 Generates code for the given value. More...
 
void GenerateCode (Parameter parameter)
 Generates code for the given value. More...
 
void GenerateCode (UnaryArithmeticValue value)
 Generates code for the given value. More...
 
void GenerateCode (BinaryArithmeticValue value)
 Generates code for the given value. More...
 
void GenerateCode (TernaryArithmeticValue value)
 Generates code for the given value. More...
 
void GenerateCode (CompareValue value)
 Generates code for the given value. More...
 
void GenerateCode (ConvertValue value)
 Generates code for the given value. More...
 
void GenerateCode (PointerCast value)
 Generates code for the given value. More...
 
void GenerateCode (AddressSpaceCast value)
 Generates code for the given value. More...
 
void GenerateCode (FloatAsIntCast value)
 Generates code for the given value. More...
 
void GenerateCode (IntAsFloatCast value)
 Generates code for the given value. More...
 
void GenerateCode (IfPredicate predicate)
 Generates code for the given value. More...
 
void GenerateCode (SwitchPredicate predicate)
 Generates code for the given value. More...
 
void GenerateCode (GenericAtomic atomic)
 Generates code for the given value. More...
 
void GenerateCode (AtomicCAS atomicCAS)
 Generates code for the given value. More...
 
void GenerateCode (Alloca alloca)
 Generates code for the given value. More...
 
void GenerateCode (MemoryBarrier barrier)
 Generates code for the given value. More...
 
void GenerateCode (Load load)
 Generates code for the given value. More...
 
void GenerateCode (Store store)
 Generates code for the given value. More...
 
void GenerateCode (LoadElementAddress value)
 Generates code for the given value. More...
 
void GenerateCode (LoadFieldAddress value)
 Generates code for the given value. More...
 
void GenerateCode (PrimitiveValue value)
 Generates code for the given value. More...
 
void GenerateCode (StringValue value)
 Generates code for the given value. More...
 
void GenerateCode (NullValue value)
 Generates code for the given value. More...
 
void GenerateCode (StructureValue value)
 Generates code for the given value. More...
 
void GenerateCode (GetField value)
 Generates code for the given value. More...
 
void GenerateCode (SetField value)
 Generates code for the given value. More...
 
void GenerateCode (GridIndexValue value)
 Generates code for the given value. More...
 
void GenerateCode (GroupIndexValue value)
 Generates code for the given value. More...
 
void GenerateCode (GridDimensionValue value)
 Generates code for the given value. More...
 
void GenerateCode (GroupDimensionValue value)
 Generates code for the given value. More...
 
void GenerateCode (WarpSizeValue value)
 Generates code for the given value. More...
 
void GenerateCode (LaneIdxValue value)
 Generates code for the given value. More...
 
void GenerateCode (PredicateBarrier barrier)
 Generates code for the given value. More...
 
void GenerateCode (Barrier barrier)
 Generates code for the given value. More...
 
void GenerateCode (Broadcast broadcast)
 Generates code for the given value. More...
 
void GenerateCode (WarpShuffle shuffle)
 Generates code for the given value. More...
 
void GenerateCode (SubWarpShuffle shuffle)
 Generates code for the given value. More...
 
void GenerateCode (DebugOperation debug)
 Generates code for the given value. More...
 
void GenerateCode (ReturnTerminator returnTerminator)
 Generates code for the given value. More...
 
void GenerateCode (UnconditionalBranch branch)
 Generates code for the given value. More...
 
void GenerateCode (IfBranch branch)
 Generates code for the given value. More...
 
void GenerateCode (SwitchBranch branch)
 Generates code for the given value. More...
 
void Merge (TKernelBuilder builder)
 Merges all changes inside the current code generator into the given builder. More...
 

Public Attributes

const string KernelViewNameFormat = "view_{0}"
 The string format of a kernel-view parameter name. More...
 
const string DynamicSharedMemoryParamName = "dynamic_shared_memory"
 The parameter name of dynamic shared memory parameter. More...
 

Properties

SeparateViewEntryPoint EntryPoint [get]
 Returns the associated entry point. More...
 
CLKernelTypeGenerator KernelTypeGenerator [get]
 The current kernel type generator. More...
 
AllocaKindInformation DynamicSharedAllocations [get]
 All dynamic shared memory allocations. More...
 
- Properties inherited from ILGPU.Backends.OpenCL.CLCodeGenerator
CLBackend Backend [get]
 Returns the associated backend. More...
 
Method Method [get]
 Returns the associated method. More...
 
Allocas Allocas [get]
 Returns all local allocas. More...
 
IntrinsicImplementationProvider< CLIntrinsic.HandlerImplementationProvider [get]
 Returns the current intrinsic provider for code-generation purposes. More...
 
StringBuilder Builder [get]
 Returns the associated string builder. More...
 
int Indent [get]
 The current indentation level. More...
 
- Properties inherited from ILGPU.Backends.OpenCL.CLVariableAllocator
CLTypeGenerator TypeGenerator [get]
 Returns the associated type generator. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ILGPU.Backends.OpenCL.CLVariableAllocator
static Variable GetSharedMemoryAllocationVariable (in AllocaInformation allocaInfo)
 Returns a shared memory allocation variable reference. More...
 
static string GetSharedMemoryAllocationName (in AllocaInformation allocaInfo)
 Returns a unique shared memory allocation name. More...
 
- Protected Member Functions inherited from ILGPU.Backends.OpenCL.CLCodeGenerator
void MarkLabel (string label)
 Marks the given label. More...
 
void SetupParameters< TSetupLogic > (StringBuilder targetBuilder, ref TSetupLogic logic, int paramOffset)
 Generates parameter declarations by writing them to the target builder provided. More...
 
Variable DeclareAllocation (in AllocaInformation allocaInfo, MemoryAddressSpace addressSpace)
 Setups a given allocation. More...
 
void SetupAllocations (AllocaKindInformation allocas, MemoryAddressSpace addressSpace)
 Setups local or shared allocations. More...
 
void BindSharedMemoryAllocation (in AllocaKindInformation allocas)
 Binds shared memory allocations. More...
 
void GenerateCodeInternal ()
 Generates code for all basic blocks. More...
 
- Protected Member Functions inherited from ILGPU.Backends.VariableAllocator
 VariableAllocator ()
 Constructs a new variable allocator. More...
 
- Static Protected Member Functions inherited from ILGPU.Backends.OpenCL.CLCodeGenerator
static string GetMethodName (Method method)
 Returns the OpenCL function name for the given function. More...
 
static string GetParameterName (Parameter parameter)
 Returns the OpenCL parameter name for the given parameter. More...
 

Detailed Description

Represents a function generator for main kernel functions.

Constructor & Destructor Documentation

ILGPU.Backends.OpenCL.CLKernelFunctionGenerator.CLKernelFunctionGenerator ( in GeneratorArgs  args,
Method  method,
Allocas  allocas 
)

Creates a new OpenCL function generator.

Parameters
argsThe generation arguments.
methodThe current method.
allocasAll local allocas.

Member Function Documentation

override void ILGPU.Backends.OpenCL.CLKernelFunctionGenerator.GenerateCode ( )
virtual

Generates OpenCL code.

Implements ILGPU.Backends.OpenCL.CLCodeGenerator.

override void ILGPU.Backends.OpenCL.CLKernelFunctionGenerator.GenerateHeader ( StringBuilder  builder)
virtual

Generates a function declaration in OpenCL code.

Implements ILGPU.Backends.OpenCL.CLCodeGenerator.

Member Data Documentation

const string ILGPU.Backends.OpenCL.CLKernelFunctionGenerator.DynamicSharedMemoryParamName = "dynamic_shared_memory"

The parameter name of dynamic shared memory parameter.

const string ILGPU.Backends.OpenCL.CLKernelFunctionGenerator.KernelViewNameFormat = "view_{0}"

The string format of a kernel-view parameter name.

Property Documentation

AllocaKindInformation ILGPU.Backends.OpenCL.CLKernelFunctionGenerator.DynamicSharedAllocations
get

All dynamic shared memory allocations.

SeparateViewEntryPoint ILGPU.Backends.OpenCL.CLKernelFunctionGenerator.EntryPoint
get

Returns the associated entry point.

CLKernelTypeGenerator ILGPU.Backends.OpenCL.CLKernelFunctionGenerator.KernelTypeGenerator
get

The current kernel type generator.


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