ILGPU  0.9.0
ILGPU.Backends.PTX.PTXCodeGenerator Class Referenceabstract

Generates PTX code out of IR values. More...

Inheritance diagram for ILGPU.Backends.PTX.PTXCodeGenerator:
ILGPU.Backends.PTX.PTXRegisterAllocator ILGPU.Backends.IBackendCodeGenerator< StringBuilder > ILGPU.Backends.RegisterAllocator< PTXRegisterKind > ILGPU.Backends.PTX.PTXFunctionGenerator ILGPU.Backends.PTX.PTXKernelFunctionGenerator

Classes

struct  CommandEmitter
 Represents a general PTX command emitter. More...
 
struct  EmptyParameterSetupLogic
 Represents an empty parameter setup logic. More...
 
struct  GeneratorArgs
 Generation arguments for code-generator construction. More...
 
interface  IComplexCommandEmitter
 Encapsulates a complex command emission process. More...
 
interface  IComplexCommandEmitterWithOffsets
 Encapsulates a complex command emission process. More...
 
interface  IIOEmitter
 Emits a sequence of IO instructions. More...
 
interface  IParameterSetupLogic
 Represents a setup logic for function parameters.
 
interface  IVectorizedCommandEmitter
 Encapsulates a complex command emission process. More...
 
struct  MappedParameter
 Represents a parameter that is mapped to PTX.
 
struct  PredicateConfiguration
 Represents a predicate-register configuration. More...
 
struct  PredicateScope
 Represents a scoped predicate-register allocation. More...
 

Public Member Functions

abstract void GenerateHeader (StringBuilder builder)
 Generates a function declaration in PTX code. More...
 
abstract void GenerateCode ()
 Generates PTX code. More...
 
void GenerateConstants (StringBuilder builder)
 Generates PTX constant declarations. More...
 
void Merge (StringBuilder builder)
 
void EmitComplexCommand< TEmitter > (string command, in TEmitter emitter, params Register[] registers)
 Emits a complex command that might depend on non-primitive registers. More...
 
void EmitComplexCommandWithOffsets< TEmitter > (string command, in TEmitter emitter, Register register, int offset=0)
 A specialized version of EmitComplexCommand<TEmitter>(string, in TEmitter, RegisterAllocator<PTXRegisterKind>.Register[]). This version uses a single register and uses internal ABI-specific offset computations to resolve the correct offset in bytes within a structure. More...
 
void EmitVectorizedCommand< TEmitter > (Value pointerValue, int safeAlignment, string command, in TEmitter emitter, Register register)
 A specialized version of EmitComplexCommand<TEmitter>(string, in TEmitter, RegisterAllocator<PTXRegisterKind>.Register[]). This version uses a single register and uses internal ABI-specific offset computations to resolve the correct offset in bytes within a structure. More...
 
PredicateScope ConvertToPredicateScope (HardwareRegister register)
 Converts the given register to a predicate register scope. More...
 
void ConvertPredicateToValue (PrimitiveRegister register, HardwareRegister targetRegister)
 Converts the given predicate register to a default integer register. More...
 
HardwareRegister ConvertValueToPredicate (HardwareRegister register)
 Converts the given register to a predicate register scope. More...
 
void ConvertValueToPredicate (PrimitiveRegister register, HardwareRegister targetRegister)
 Converts the given register to a predicate value in the target register. More...
 
void EmitIOLoad< TIOEmitter, T > (TIOEmitter emitter, string command, HardwareRegister register, T userState)
 Emits a generic IO load operation. More...
 
void EmitIOStore< TIOEmitter, T > (TIOEmitter emitter, string command, PrimitiveRegister register, T userState)
 Emits a generic IO load operation. More...
 
CommandEmitter BeginCommand (string commandString, PredicateConfiguration?predicate=null)
 Begins a new command. More...
 
void Command (string commandString, PredicateConfiguration?predicate=null)
 Emits the given command. More...
 
void Move (HardwareRegister source, HardwareRegister target, PredicateConfiguration?predicate=null)
 Emits a simple move command. More...
 
CommandEmitter BeginMove (PredicateConfiguration?predicate=null)
 Begins a new move command. More...
 
HardwareRegister MoveFromIntrinsicRegister (PTXRegisterKind registerKind, int dimension=0)
 Allocates a new target register and moves the value of the specified intrinsic register to the target register. More...
 
PrimitiveRegister MoveFromIntrinsicRegister (Value value, PTXRegisterKind registerKind, int dimension=0)
 Allocates a new target register and moves the value of the specified intrinsic register to the target register. More...
 
HardwareRegister EnsureHardwareRegister (PrimitiveRegister register)
 Ensures that the given primitive register is a hardware register. If is a constant register, its value will be moved into a newly allocated hardware register. 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.PTX.PTXRegisterAllocator
 PTXRegisterAllocator (PTXBackend backend)
 Constructs a new register allocator. More...
 
HardwareRegister AllocatePlatformRegister (out RegisterDescription description)
 Allocates a platform-specific register and returns the resulting PTX type for the current platform. More...
 
HardwareRegister AllocatePlatformRegister (Value node, out RegisterDescription description)
 Allocates a platform-specific register for the given node and returns the resulting PTX type for the current platform. More...
 
sealed override void FreeRegister (HardwareRegister hardwareRegister)
 Frees the given hardware register. More...
 
HardwareRegister AllocateInt32Register ()
 Allocates a new 32bit integer register. More...
 
sealed override HardwareRegister AllocateRegister (RegisterDescription description)
 Allocates a register that is compatible with the given description. More...
 
- Public Member Functions inherited from ILGPU.Backends.RegisterAllocator< PTXRegisterKind >
HardwareRegister Allocate (Value node, RegisterDescription description)
 Allocates a specific register kind for the given node. More...
 
Register Allocate (Value node)
 Allocates a specific register kind for the given node. More...
 
HardwareRegister AllocateHardware (Value node)
 Allocates a specific register kind for the given node. More...
 
void Bind (Value node, Register targetRegister)
 Binds the given value to the target register. More...
 
Register AllocateType (TypeNode typeNode)
 Allocates a new register recursively More...
 
void Alias (Value node, Value aliasNode)
 Registers a register alias. More...
 
LoadAs< T > (Value node)
 Loads the allocated register of the given node. More...
 
Register Load (Value node)
 Loads the allocated register of the given node. More...
 
PrimitiveRegister LoadPrimitive (Value node)
 Loads the allocated primitive register of the given node. More...
 
HardwareRegister LoadHardware (Value node)
 Loads the allocated primitive register of the given node. More...
 
void Free (Value node)
 Frees the given node. 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...
 

Static Public Member Functions

static HardwareRegister GetIntrinsicRegister (PTXRegisterKind registerKind, int dimension=0)
 Resolves the desired hardware register. More...
 
- Static Public Member Functions inherited from ILGPU.Backends.PTX.PTXRegisterAllocator
static PTXRegisterKind GetRegisterKind (BasicValueType basicValueType)
 Returns the associated register kind. More...
 
static BasicValueType ResolveParameterBasicValueType (BasicValueType basicValueType)
 Returns the associated register kind. More...
 
static string GetStringRepresentation (HardwareRegister register)
 Returns the string representation of the given hardware register. More...
 

Public Attributes

new PTXBackend Backend => base.Backend as PTXBackend
 Returns the associated backend. More...
 

Static Public Attributes

static readonly IEnumerable< PTXInstructionSetSupportedInstructionSets
 The supported PTX instruction sets (in descending order). More...
 

Protected Member Functions

void MarkLabel (string label)
 Marks the given label. More...
 
void PrepareCodeGeneration ()
 Prepares the general code generation process. More...
 
void GenerateCodeInternal (int registerOffset)
 Generates code for all basic blocks. More...
 
void SetupAllocations< TCollection > (AllocaKindInformation allocas, string addressSpacePrefix, string namePrefix, TCollection result)
 Setups local or shared allocations. More...
 
void EmitLoadParam (string paramName, Register register)
 Emits a new set of load param instructions with the appropriate configuration. More...
 
void EmitStoreParam (string paramName, Register register)
 Emits a new set of store param instructions with the appropriate configuration. More...
 
void AppendParamDeclaration (StringBuilder targetBuilder, TypeNode paramType, string paramName)
 Appends parameter information. More...
 
- Protected Member Functions inherited from ILGPU.Backends.PTX.PTXRegisterAllocator
RegisterDescription ResolveParameterRegisterDescription (TypeNode type)
 Resolves a register description for the given parameter type. More...
 
sealed override RegisterDescription ResolveRegisterDescription (TypeNode type)
 Resolves a new PTX compatible register description. More...
 
- Protected Member Functions inherited from ILGPU.Backends.RegisterAllocator< PTXRegisterKind >
 RegisterAllocator (Backend backend)
 Constructs a new register allocator. More...
 
abstract RegisterDescription ResolveRegisterDescription (TypeNode type)
 Resolves a register description for the given type. More...
 

Static Protected Member Functions

static string GetMethodName (Method method)
 Returns the PTX function name for the given function. More...
 
static string GetParameterName (Parameter parameter)
 Returns the PTX parameter name for the given parameter. More...
 
- Static Protected Member Functions inherited from ILGPU.Backends.PTX.PTXRegisterAllocator
static RegisterDescription ResolveRegisterDescription (BasicValueType basicValueType)
 Resolves a register description for the basic value type. More...
 

Protected Attributes

const string DynamicSharedMemoryAllocationName = "__dyn_shared_alloca"
 The name for the globally registered dynamic shared memory alloca (if any). More...
 

Properties

Method Method [get]
 Returns the associated method. More...
 
Allocas Allocas [get]
 Returns all local allocas. More...
 
PTXArchitecture Architecture [get]
 Returns the currently used PTX architecture. More...
 
PTXDebugInfoGeneratorScope DebugInfoGenerator [get]
 Returns the associated debug information generator. More...
 
IntrinsicImplementationProvider< PTXIntrinsic.HandlerImplementationProvider [get]
 Returns the current intrinsic provider for code-generation purposes. More...
 
bool FastMath [get]
 Returns true if fast math is active. More...
 
bool EnableAssertions [get]
 Returns true if assertions are enabled. More...
 
StringBuilder Builder [get]
 Returns the associated string builder. More...
 
string ReturnParamName [get]
 Returns the name of the return parameter. More...
 
PointerAlignments PointerAlignments [get]
 Returns detailed information about all pointer alignments. More...
 
- Properties inherited from ILGPU.Backends.RegisterAllocator< PTXRegisterKind >
Backend Backend [get]
 Returns the underlying ABI. More...
 

Detailed Description

Generates PTX code out of IR values.

The code needs to be prepared for this code generator.

Member Function Documentation

void ILGPU.Backends.PTX.PTXCodeGenerator.AppendParamDeclaration ( StringBuilder  targetBuilder,
TypeNode  paramType,
string  paramName 
)
protected

Appends parameter information.

Parameters
targetBuilderThe target builder to append the information to.
paramTypeThe param type.
paramNameThe name of the param argument.
CommandEmitter ILGPU.Backends.PTX.PTXCodeGenerator.BeginCommand ( string  commandString,
PredicateConfiguration predicate = null 
)

Begins a new command.

Parameters
commandStringThe command to begin.
predicateThe predicate under which to execute the command.
Returns
The created command emitter.
CommandEmitter ILGPU.Backends.PTX.PTXCodeGenerator.BeginMove ( PredicateConfiguration predicate = null)

Begins a new move command.

Parameters
predicateThe predicate under which to execute the command.
Returns
The created command emitter.
void ILGPU.Backends.PTX.PTXCodeGenerator.Command ( string  commandString,
PredicateConfiguration predicate = null 
)

Emits the given command.

Parameters
commandStringThe command to emit.
predicateThe predicate under which to execute the command.
void ILGPU.Backends.PTX.PTXCodeGenerator.ConvertPredicateToValue ( PrimitiveRegister  register,
HardwareRegister  targetRegister 
)

Converts the given predicate register to a default integer register.

Parameters
registerThe source register.
targetRegisterThe target register to write to.
PredicateScope ILGPU.Backends.PTX.PTXCodeGenerator.ConvertToPredicateScope ( HardwareRegister  register)

Converts the given register to a predicate register scope.

Parameters
registerThe register to convert.
Returns
The created predicate scope.
HardwareRegister ILGPU.Backends.PTX.PTXCodeGenerator.ConvertValueToPredicate ( HardwareRegister  register)

Converts the given register to a predicate register scope.

Parameters
registerThe register to convert.
Returns
The created predicate scope.
void ILGPU.Backends.PTX.PTXCodeGenerator.ConvertValueToPredicate ( PrimitiveRegister  register,
HardwareRegister  targetRegister 
)

Converts the given register to a predicate value in the target register.

Parameters
registerThe register to convert.
targetRegisterThe target register.
void ILGPU.Backends.PTX.PTXCodeGenerator.EmitComplexCommand< TEmitter > ( string  command,
in TEmitter  emitter,
params Register[]  registers 
)

Emits a complex command that might depend on non-primitive registers.

Template Parameters
TEmitterThe emitter type.
Parameters
commandThe generic command to emit.
emitterThe current emitter.
registersAll involved registers.
Type Constraints
TEmitter :IComplexCommandEmitter 
void ILGPU.Backends.PTX.PTXCodeGenerator.EmitComplexCommandWithOffsets< TEmitter > ( string  command,
in TEmitter  emitter,
Register  register,
int  offset = 0 
)

A specialized version of EmitComplexCommand<TEmitter>(string, in TEmitter, RegisterAllocator<PTXRegisterKind>.Register[]). This version uses a single register and uses internal ABI-specific offset computations to resolve the correct offset in bytes within a structure.

Template Parameters
TEmitterThe emitter type.
Parameters
commandThe generic command to emit.
emitterThe current emitter.
registerThe involved register.
offsetThe current offset in bytes.
Type Constraints
TEmitter :IComplexCommandEmitterWithOffsets 
void ILGPU.Backends.PTX.PTXCodeGenerator.EmitIOLoad< TIOEmitter, T > ( TIOEmitter  emitter,
string  command,
HardwareRegister  register,
userState 
)

Emits a generic IO load operation.

Template Parameters
TIOEmitterThe type of the load emitter.
TThe user state type.
Parameters
emitterThe emitter type.
commandThe command to emit.
registerThe register for emission.
userStateThe user state.
Type Constraints
TIOEmitter :struct 
TIOEmitter :IIOEmitter<T> 
T :struct 
void ILGPU.Backends.PTX.PTXCodeGenerator.EmitIOStore< TIOEmitter, T > ( TIOEmitter  emitter,
string  command,
PrimitiveRegister  register,
userState 
)

Emits a generic IO load operation.

Template Parameters
TIOEmitterThe type of the load emitter.
TThe user state type.
Parameters
emitterThe emitter type.
commandThe command to emit.
registerTHe register for emission.
userStateThe user state.
Type Constraints
TIOEmitter :struct 
TIOEmitter :IIOEmitter<T> 
T :struct 
void ILGPU.Backends.PTX.PTXCodeGenerator.EmitLoadParam ( string  paramName,
Register  register 
)
protected

Emits a new set of load param instructions with the appropriate configuration.

Parameters
paramNameThe parameter name.
registerThe source register.
void ILGPU.Backends.PTX.PTXCodeGenerator.EmitStoreParam ( string  paramName,
Register  register 
)
protected

Emits a new set of store param instructions with the appropriate configuration.

Parameters
paramNameThe parameter name.
registerThe target register.
void ILGPU.Backends.PTX.PTXCodeGenerator.EmitVectorizedCommand< TEmitter > ( Value  pointerValue,
int  safeAlignment,
string  command,
in TEmitter  emitter,
Register  register 
)

A specialized version of EmitComplexCommand<TEmitter>(string, in TEmitter, RegisterAllocator<PTXRegisterKind>.Register[]). This version uses a single register and uses internal ABI-specific offset computations to resolve the correct offset in bytes within a structure.

Template Parameters
TEmitterThe emitter type.
Parameters
pointerValueThe pointer to get the alignment for.
safeAlignmentThe safe minimum alignment in bytes.
commandThe generic command to emit.
emitterThe current emitter.
registerThe involved register.
Type Constraints
TEmitter :IVectorizedCommandEmitter 
HardwareRegister ILGPU.Backends.PTX.PTXCodeGenerator.EnsureHardwareRegister ( PrimitiveRegister  register)

Ensures that the given primitive register is a hardware register. If is a constant register, its value will be moved into a newly allocated hardware register.

Parameters
registerThe register to put into a hardware register.
Returns
The hardware register (could be the input register).
void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( ReturnTerminator  returnTerminator)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( LoadElementAddress  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( MethodCall  methodCall)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( UnconditionalBranch  branch)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( IfBranch  branch)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( SwitchBranch  branch)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( AddressSpaceCast  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( Parameter  parameter)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( PhiValue  phiValue)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( UnaryArithmeticValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( BinaryArithmeticValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( TernaryArithmeticValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( CompareValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( ConvertValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( PointerCast  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( FloatAsIntCast  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( IntAsFloatCast  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( IfPredicate  predicate)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( SwitchPredicate  predicate)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( GenericAtomic  atomic)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( AtomicCAS  atomicCAS)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( Alloca  alloca)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( MemoryBarrier  barrier)

abstract void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( )
pure virtual
void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( Load  load)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( Store  store)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( LoadFieldAddress  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( PrimitiveValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( StringValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( NullValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( StructureValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( GetField  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( SetField  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( GridIndexValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( GroupIndexValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( GridDimensionValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( GroupDimensionValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( WarpSizeValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( LaneIdxValue  value)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( PredicateBarrier  barrier)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( Barrier  barrier)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( Broadcast  broadcast)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( WarpShuffle  shuffle)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( SubWarpShuffle  shuffle)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCode ( DebugOperation  debug)

void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateCodeInternal ( int  registerOffset)
protected

Generates code for all basic blocks.

Parameters
registerOffsetThe internal register offset.
void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateConstants ( StringBuilder  builder)

Generates PTX constant declarations.

Parameters
builderThe target builder.
abstract void ILGPU.Backends.PTX.PTXCodeGenerator.GenerateHeader ( StringBuilder  builder)
pure virtual

Generates a function declaration in PTX code.

Implemented in ILGPU.Backends.PTX.PTXKernelFunctionGenerator, and ILGPU.Backends.PTX.PTXFunctionGenerator.

static HardwareRegister ILGPU.Backends.PTX.PTXCodeGenerator.GetIntrinsicRegister ( PTXRegisterKind  registerKind,
int  dimension = 0 
)
static

Resolves the desired hardware register.

static string ILGPU.Backends.PTX.PTXCodeGenerator.GetMethodName ( Method  method)
staticprotected

Returns the PTX function name for the given function.

Parameters
methodThe method.
Returns
The resolved PTX function name.
static string ILGPU.Backends.PTX.PTXCodeGenerator.GetParameterName ( Parameter  parameter)
staticprotected

Returns the PTX parameter name for the given parameter.

Parameters
parameterThe parameter.
Returns
The resolved PTX parameter name.
void ILGPU.Backends.PTX.PTXCodeGenerator.MarkLabel ( string  label)
protected

Marks the given label.

Parameters
labelThe label to mark.
void ILGPU.Backends.PTX.PTXCodeGenerator.Merge ( StringBuilder  builder)

void ILGPU.Backends.PTX.PTXCodeGenerator.Move ( HardwareRegister  source,
HardwareRegister  target,
PredicateConfiguration predicate = null 
)

Emits a simple move command.

Parameters
sourceThe source register.
targetThe target register.
predicateThe predicate under which to execute the command.
HardwareRegister ILGPU.Backends.PTX.PTXCodeGenerator.MoveFromIntrinsicRegister ( PTXRegisterKind  registerKind,
int  dimension = 0 
)

Allocates a new target register and moves the value of the specified intrinsic register to the target register.

Parameters
registerKindThe intrinsic register kind.
dimensionThe register dimension (if any).
Returns
PrimitiveRegister ILGPU.Backends.PTX.PTXCodeGenerator.MoveFromIntrinsicRegister ( Value  value,
PTXRegisterKind  registerKind,
int  dimension = 0 
)

Allocates a new target register and moves the value of the specified intrinsic register to the target register.

Parameters
valueThe value.
registerKindThe intrinsic register kind.
dimensionThe register dimension (if any).
void ILGPU.Backends.PTX.PTXCodeGenerator.PrepareCodeGeneration ( )
protected

Prepares the general code generation process.

void ILGPU.Backends.PTX.PTXCodeGenerator.SetupAllocations< TCollection > ( AllocaKindInformation  allocas,
string  addressSpacePrefix,
string  namePrefix,
TCollection  result 
)
protected

Setups local or shared allocations.

Parameters
allocasThe allocations to setup.
addressSpacePrefixThe source address-space prefix (like .local).
namePrefixThe name prefix.
resultThe resulting list of allocations.
Type Constraints
TCollection :ICollection 
TCollection :Alloca 
TCollection :string 

Member Data Documentation

new PTXBackend ILGPU.Backends.PTX.PTXCodeGenerator.Backend => base.Backend as PTXBackend

Returns the associated backend.

const string ILGPU.Backends.PTX.PTXCodeGenerator.DynamicSharedMemoryAllocationName = "__dyn_shared_alloca"
protected

The name for the globally registered dynamic shared memory alloca (if any).

readonly IEnumerable<PTXInstructionSet> ILGPU.Backends.PTX.PTXCodeGenerator.SupportedInstructionSets
static
Initial value:
=
ImmutableSortedSet.Create(
Comparer<PTXInstructionSet>.Create((first, second) =>
second.CompareTo(first)),
PTXInstructionSet.ISA_70,
PTXInstructionSet.ISA_65,
PTXInstructionSet.ISA_64,
PTXInstructionSet.ISA_63,
PTXInstructionSet.ISA_62,
PTXInstructionSet.ISA_61,
PTXInstructionSet.ISA_60)

The supported PTX instruction sets (in descending order).

Property Documentation

Allocas ILGPU.Backends.PTX.PTXCodeGenerator.Allocas
get

Returns all local allocas.

PTXArchitecture ILGPU.Backends.PTX.PTXCodeGenerator.Architecture
get

Returns the currently used PTX architecture.

StringBuilder ILGPU.Backends.PTX.PTXCodeGenerator.Builder
get

Returns the associated string builder.

PTXDebugInfoGeneratorScope ILGPU.Backends.PTX.PTXCodeGenerator.DebugInfoGenerator
get

Returns the associated debug information generator.

bool ILGPU.Backends.PTX.PTXCodeGenerator.EnableAssertions
get

Returns true if assertions are enabled.

bool ILGPU.Backends.PTX.PTXCodeGenerator.FastMath
get

Returns true if fast math is active.

IntrinsicImplementationProvider<PTXIntrinsic.Handler> ILGPU.Backends.PTX.PTXCodeGenerator.ImplementationProvider
get

Returns the current intrinsic provider for code-generation purposes.

Method ILGPU.Backends.PTX.PTXCodeGenerator.Method
get

Returns the associated method.

PointerAlignments ILGPU.Backends.PTX.PTXCodeGenerator.PointerAlignments
get

Returns detailed information about all pointer alignments.

string ILGPU.Backends.PTX.PTXCodeGenerator.ReturnParamName
getprotected

Returns the name of the return parameter.


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