Auto Tiler Library
|
Functions | |
void | AT_SetGraphCtrl (AT_GraphCtrl_T Ctrl, void *Val) |
Set graph processing options. More... | |
char * | CNNGraphName () |
Returns the name of the defined graph. More... | |
CNNGraph_T * | CNNGraph () |
Returns the defined graph. More... | |
CNNGraph_T * | CreateGraph (char *GraphName, CKernel_Arg_T **CArgs, CKernel_Arg_T **Locals) |
Declare a new CNN Graph and open it. More... | |
void | AddGraphCArg (CKernel_Arg_T *CArg) |
Declare a new CNN Graph CArg argument. More... | |
void | AddGraphLocal (CKernel_Arg_T *CArg) |
Declare a new CNN Graph Local argument. More... | |
void | CommitGraphArgsAndLocals () |
Commit to open CNN Graph AddGraphCArg and AddGraphLocal contributions. More... | |
void | AddNode (char *NodeName, ArgBindingDescr_T **BindingList) |
Add a layer to the opened CNN graph. More... | |
void | AddCallToNode (char *NodeName, CallLocationT Where, char *FunName, ArgBindingDescr_T **FunArgs) |
Add a C call before or after a graph node. More... | |
ArgBindingDescr_T * | GNodeArg (GraghNodeArgT Type, char *ArgName, char *AliasedArgName) |
Binds a given Graph node arg to a user kernel kernel argument. More... | |
ArgBindingDescr_T * | GNodeCArg (char *ArgName) |
Binds a given Graph node arg to a user kernel kernel C argument. More... | |
ArgBindingDescr_T * | GNodeArgImmOper (GraghNodeArgT Type, char *ArgName, char *AliasedArgName, char Oper, int Value) |
Binds a given Graph node arg applying an immediate operation to it. More... | |
void | AddGraphArgExportSymbols (char *GraphCArgName, char *ExportAddrName, char *ExportLocName) |
Add a pair of symbols to a graph C arg to pass it's allocated address and memory location. More... | |
ArgBindingDescr_T * | GArg (char *ArgName) |
Binds a given Graph node arg, simplified form. More... | |
void | CloseGraph () |
Close the currently open CNN Graph and process it. More... | |
int | GenerateCodeForCNNGraph (CNNGraph_T *Graph, int Declare, unsigned int TensorDumpFilter, char *L2_DumpBuffer, unsigned int L2_DumpBufferSize, FILE *Fi) |
Generate code for the CNN Graph if any. More... | |
void | CNN_InitGenCtrl (CNN_GenControl_T *Ctrl) |
Initializes a CNN Generator control descriptor, all fields are set to default. More... | |
void | CNN_SetGenCtrl (CNN_GenControl_T *Ctrl, char *Name, void *Val) |
Overides default behaviour of a CNN Generator. Set one CNN generator control descriptor field described by it's name to Val. More... | |
void | CNN_SetGenCtrlList (CNN_GenControl_T *Ctrl,...) |
Overides default behaviour of a CNN Generator. Set list of CNN generator control descriptor fields (Name, Val) stops when Name = 0. More... | |
int * | CNN_Type (int I1, int I2, int I3, int I4, int O) |
Create a CNN type size vector(4) More... | |
KernelOper_T * | CNN_OperList (int N,...) |
Create a list of N CNN operation. More... | |
CNN_LayerOp_T * | CNN_Match (KernelOper_T *KerOper1, KernelOper_T *KerOper2, int ParFeat, int *OpType, int Fx, int Fy, int Dx, int Dy, int Sx, int Sy) |
Create a CNN matching condition for a Basic Kernel. More... | |
char * | CNN_FindMatchingKernel (KernelOper_T KerOper1, KernelOper_T KerOper2, int ParallelOutFeat, int I1Size, int I2Size, int I3Size, int I4Size, int OSize, int FX, int FY, int DX, int DY, int SX, int SY, int *NeedFx, int *NeedFy, int *NeedDx, int *NeedDy, int *NeedSx, int *NeedSy, int *ArgCount) |
Look into KernelLibs operation descriptor, return best match if any. More... | |
char * | CNN_ArgDataType (int DataSize, int Pointer, int Restrict) |
Returns a signed C type for an argument given it's size in byte. More... | |
char * | CNN_ArgDataTypeUns (int DataSize, int Pointer, int Restrict) |
Returns an unsigned C type for an argument given it's size in byte. More... | |
KernelOper_T | CNN_CompositeKernel (KernelOper_T K1, KernelOper_T K2, KernelOper_T K3) |
For merged CNN layers retrieves composite Layer operation from individual operations. More... | |
char * | CNN_KernelOperImage (KernelOper_T Op) |
Returns CNN Oper Name. More... | |
CNN Graph related functions
CNN Kernels operation related functions
void AddCallToNode | ( | char * | NodeName, |
CallLocationT | Where, | ||
char * | FunName, | ||
ArgBindingDescr_T ** | FunArgs | ||
) |
Add a C call before or after a graph node. Calls order follows insertion order
NodeName | Existing graph node name |
Where | Before: CALL_PROLOG. After: CALL:EPILOG |
FunName | Called function name |
FunArgs | Function Argument list, use GArg |
void AddGraphArgExportSymbols | ( | char * | GraphCArgName, |
char * | ExportAddrName, | ||
char * | ExportLocName | ||
) |
Add a pair of symbols to a graph C arg to pass it's allocated address and memory location
GraphCArgName | Graph CArg name, should be CArg with scope=ARG_SCOPE_GLOBAL |
ExportAddrName | Legal C Name to store Graph CArg allocated address, type is unsigned int |
ExportLocName | Legal C Name to store n which memort Graph CArg has been allocated, an int |
void AddGraphCArg | ( | CKernel_Arg_T * | CArg | ) |
Declare a new CNN Graph CArg argument
void AddGraphLocal | ( | CKernel_Arg_T * | CArg | ) |
Declare a new CNN Graph Local argument
void AddNode | ( | char * | NodeName, |
ArgBindingDescr_T ** | BindingList | ||
) |
Add a layer to the opened CNN graph
NodeName | A user kernel name or a user kernel group name |
BindingList | Bindings for this kernel call |
void AT_SetGraphCtrl | ( | AT_GraphCtrl_T | Ctrl, |
void * | Val | ||
) |
Set graph processing options Possible Ctrl are: AT_GRAPH_MONITOR_CYCLES, Enable automatic cycle capture for each node of the graph, default is 0 AT_GRAPH_MONITOR_CVAR_NAME, When monitor cycles is on name of the C var array to receive results, default is AT_GraphPerf AT_GRAPH_PRODUCE_NODE_NAMES, Enable production of an array containing the name of each graph node, default is 0 AT_GRAPH_PRODUCE_NODE_CVAR_NAME, When producing node names is on name of the C array receiving the names as strings, default is AT_GraphNodeNames AT_GRAPH_PRODUCE_OPERINFOS, Enable production of number of macs for each layer, default is 0 AT_GRAPH_PRODUCE_OPERINFOS_CVAR_NAME, When Number of oper Infos is on name of the C array receiving mac infos for each node, default is AT_GraphOperInfosNames AT_GRAPH_REORDER_CONSTANT_IN, Enable reodering of constant inputs in order to transform 2D accesses into 1D accesses, default is 1 AT_GRAPH_TRACE_EXEC, Enable trace of activity, default is 1 AT_GRAPH_NOINLINE_NODE, If 1 all user kernel function is marked as noinline, default is 0 AT_GRAPH_PREF_L3_EXEC, In case a symbol must be allocated in L3 for execution this is the prefered memory, default is AT_MEM_L3_HRAM AT_GRAPH_CONST_EXEC_FROM_FLASH, If 1, for constant symbol executes from home location, default is 0 AT_GRAPH_PREF_L3_HOME, For constant symbols which L3 flash prefered memory, default is AT_MEM_L3_HFLASH
For Val use Use APT_OPT_ON, AT_OPT_OFF, AT_OPT_VAL(Val)
Ctrl | Which option |
Val | Value for this option. Use APT_OPT_ON, AT_OPT_OFF, AT_OPT_VAL(Val) |
void CloseGraph | ( | ) |
Close the currently open CNN Graph and process it
char* CNN_ArgDataType | ( | int | DataSize, |
int | Pointer, | ||
int | Restrict | ||
) |
Returns a signed C type for an argument given it's size in byte
DataSize | Argument size in byte (1,2 or 4) |
Pointer | Is this argument a pointer |
Restrict | In case this argument is a pointer can it be restricted? |
char* CNN_ArgDataTypeUns | ( | int | DataSize, |
int | Pointer, | ||
int | Restrict | ||
) |
Returns an unsigned C type for an argument given it's size in byte
DataSize | Argument size in byte (1,2 or 4) |
Pointer | Is this argument a pointer |
Restrict | In case this argument is a pointer can it be restricted? |
KernelOper_T CNN_CompositeKernel | ( | KernelOper_T | K1, |
KernelOper_T | K2, | ||
KernelOper_T | K3 | ||
) |
For merged CNN layers retrieves composite Layer operation from individual operations.
K1 | First CNN operation |
K2 | Second CNN operation or KOP_NONE |
K3 | Third CNN operation or KOP_NONE |
char* CNN_FindMatchingKernel | ( | KernelOper_T | KerOper1, |
KernelOper_T | KerOper2, | ||
int | ParallelOutFeat, | ||
int | I1Size, | ||
int | I2Size, | ||
int | I3Size, | ||
int | I4Size, | ||
int | OSize, | ||
int | FX, | ||
int | FY, | ||
int | DX, | ||
int | DY, | ||
int | SX, | ||
int | SY, | ||
int * | NeedFx, | ||
int * | NeedFy, | ||
int * | NeedDx, | ||
int * | NeedDy, | ||
int * | NeedSx, | ||
int * | NeedSy, | ||
int * | ArgCount | ||
) |
Look into KernelLibs operation descriptor, return best match if any. When a basic kernel can perform 2 sucessive operations the 2nd operation can be specified.
KerOper1 | Primary operation |
KerOper2 | Optional operation to be performed on the output of the primary one |
ParallelOutFeat | Choose a kernel using channel centric parallelization, otherwise feature centric parallelization |
I1Size | Size in byte of the first input operand, 0 if not relevant. Order assumption: In,Filter,Bias,Out |
I2Size | Size in byte of the second input operand, 0 if not relevant |
I3Size | Size in byte of the third input operand, 0 if not relevant |
I4Size | Size in byte of the fourth input operand, 0 if not relevant |
OSize | Size in byte of the output input operand, 0 if not relevant |
FX | If this operation is a filter, Filter X dimension, 0: not relevant, -1: All value are matching, >0 a specific dimension |
FY | If this operation is a filter, Filter Y dimension, 0: not relevant, -1: All value are matching, -2 all values but equal to FX, >0 a specific dimension |
DX | If this operation is a filter, Filter dilation for X dimension, 0: not relevant, -1: All value are matching, >0 a specific dimension |
DY | If this operation is a filter, Filter dilation for Y dimension, 0: not relevant, -1: All value are matching, -2 all values but equal to FX, >0 a specific dimension |
SX | If this operation is a filter, Filter Stride for X dimension, 0: not relevant, -1: All value are matching, >0 a specific dimension |
SY | If this operation is a filter, Filter Stride for Y dimension, 0: not relevant, -1: All value are matching, -2 all values but equal to FX, >0 a specific dimension |
NeedFx | FX should be explictly passed to the basic kernel |
NeedFy | FY should be explictly passed to the basic kernel |
NeedDx | DX should be explictly passed to the basic kernel |
NeedDy | DY should be explictly passed to the basic kernel |
NeedSx | SX should be explictly passed to the basic kernel |
NeedSy | SY should be explictly passed to the basic kernel |
ArgCount | Nunber of arguments of the basic kernel implementing this CNN operation |
void CNN_InitGenCtrl | ( | CNN_GenControl_T * | Ctrl | ) |
Initializes a CNN Generator control descriptor, all fields are set to default
Ctrl | Address of a CNN generator control descriptor |
char* CNN_KernelOperImage | ( | KernelOper_T | Op | ) |
Returns CNN Oper Name
Op | A CNN operation |
CNN_LayerOp_T* CNN_Match | ( | KernelOper_T * | KerOper1, |
KernelOper_T * | KerOper2, | ||
int | ParFeat, | ||
int * | OpType, | ||
int | Fx, | ||
int | Fy, | ||
int | Dx, | ||
int | Dy, | ||
int | Sx, | ||
int | Sy | ||
) |
Create a CNN matching condition for a Basic Kernel
KerOper1 | List of N_Oper1 primary CNN operation matching |
KerOper2 | Number of N_Oper2 secondary CNN operation matching |
ParFeat | If basic kernel evaluates channels in parallel |
OpType | Operand's type size: In1,In2,In3,Out usually (In,Filter,Bias,Out). 0 to ignore otherwise size in bytes |
Fx | Filter X dimension, 0 if don't care, -1 if match all input |
Fy | Filter Y dimension, 0 if don't care, -1 if match all input, -2 match all input by equal to Fx |
Dx | Filter X dilation, 0 if don't care, -1 if match all input |
Dy | Filter Y dilation, 0 if don't care, -1 if match all input, -2 match all input by equal to Dx |
Sx | Filter X stride, 0 if don't care, -1 if match all input |
Sy | Filter Y stride, 0 if don't care, -1 if match all input, -2 match all input by equal to Sx |
KernelOper_T* CNN_OperList | ( | int | N, |
... | |||
) |
Create a list of N CNN operation
N | Number of CNN operations |
void CNN_SetGenCtrl | ( | CNN_GenControl_T * | Ctrl, |
char * | Name, | ||
void * | Val | ||
) |
Overides default behaviour of a CNN Generator. Set one CNN generator control descriptor field described by it's name to Val Name is case insensitive, list of names TileOrientation Controls tiling orientation. -1: use default, TILE_HOR or TILE_VER ParallelFeatures Controls parallelization strategy. -1: use default, 0: Each output feature is evaluated in parallel, 1: several output features are evalauted in parallel ForcedDPConv Controls double precision option for convolution: -1: use default, 0: Disable double precision, 1: Enable double precision UseHwCE Controls HWCE usage: -1: use default, 0: Disable HWCE, 1: Enable HWCE and use it if possible PadType Controls padding strategy: left/right/balanced_left/balanced_right EnableIm2Col Controls if Matrix Multiply based convolution should be used when possibleValue, an integer or a string. Use APT_OPT_ON, AT_OPT_OFF, AT_OPT_VAL(Val)
Ctrl | Address of a CNN generator control descriptor |
Name | Field name, case insensitive |
void CNN_SetGenCtrlList | ( | CNN_GenControl_T * | Ctrl, |
... | |||
) |
Overides default behaviour of a CNN Generator. Set list of CNN generator control descriptor fields (Name, Val) stops when Name = 0
Ctrl | Address of a CNN generator control descriptor |
int* CNN_Type | ( | int | I1, |
int | I2, | ||
int | I3, | ||
int | I4, | ||
int | O | ||
) |
Create a CNN type size vector(4). Usually the 4 operands are In,Filter,Bias,Out. Byte size currently limited to 4Output operand type size in byte, 0 to ignore
I1 | First operand type size in byte, 0 to ignore |
I2 | Second operand type size in byte, 0 to ignore |
I3 | Third operand type size in byte, 0 to ignore |
I4 | Fourth operand type size in byte, 0 to ignore |
CNNGraph_T* CNNGraph | ( | ) |
Returns the defined graph
char* CNNGraphName | ( | ) |
Returns the name of the defined graph
void CommitGraphArgsAndLocals | ( | ) |
CNNGraph_T* CreateGraph | ( | char * | GraphName, |
CKernel_Arg_T ** | CArgs, | ||
CKernel_Arg_T ** | Locals | ||
) |
Declare a new CNN Graph and open it
GraphName | CNN Graph name |
CArgs | C arguments of this CNN graph |
Locals | Local arguments of this CNN graph |
ArgBindingDescr_T* GArg | ( | char * | ArgName | ) |
Binds a given Graph node arg, simplified form
ArgName | Argument name, should be in internal or external graph variables |
int GenerateCodeForCNNGraph | ( | CNNGraph_T * | Graph, |
int | Declare, | ||
unsigned int | TensorDumpFilter, | ||
char * | L2_DumpBuffer, | ||
unsigned int | L2_DumpBufferSize, | ||
FILE * | Fi | ||
) |
Generate code for the CNN Graph if any
Graph | Pointer to the CNN graph |
Declare | if 1 declare graph related entry points, if 0 generate bodies |
TensorDumpFilter | Automatic dump control |
L2_DumpBuffer | L2 Dump Buffer if needed (tensor trace) |
L2_DumpBufferSize | Size of the L2 Buffer |
Fi | File where to dump generated code |
ArgBindingDescr_T* GNodeArg | ( | GraghNodeArgT | Type, |
char * | ArgName, | ||
char * | AliasedArgName | ||
) |
Binds a given Graph node arg to a user kernel kernel argument
Type | Direction: GNA_IN, GNA_OUT or GNA_INOUT |
ArgName | Argument name, should be in internal or external graph variables and a user kernel kernel argument |
AliasedArgName | In case Direction is GNA_INOUT output ArgName is aliased to input AliasedArgName |
ArgBindingDescr_T* GNodeArgImmOper | ( | GraghNodeArgT | Type, |
char * | ArgName, | ||
char * | AliasedArgName, | ||
char | Oper, | ||
int | Value | ||
) |
Binds a given Graph node arg applying an immediate operation to it
Type | Direction: GNA_IN, GNA_OUT or GNA_INOUT |
ArgName | Argument name, should be in internal or external graph variables |
AliasedArgName | In case Direction is GNA_INOUT output ArgName is aliased to input AliasedArgName |
Oper | Offset operation to be applied |
Value | Offset value |
ArgBindingDescr_T* GNodeCArg | ( | char * | ArgName | ) |
Binds a given Graph node arg to a user kernel kernel C argument
ArgName | Argument name, should be an external graph variable and a user kernel C argument |