Auto Tiler Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AutoTilerLib.h File Reference

Macros

#define Max(a, b)
 
#define Min(a, b)
 
#define AT_OPT_ON
 Macros to pass value to AT_SetGraphCtrl and to CNN_SetGenCtrl/CNN_SetGenCtrlList. More...
 
#define AT_OPT_OFF
 
#define AT_OPT_VAL(Val)
 
#define MAX_KERNEL
 
#define MAX_KERNEL_LIB_TEMPL
 
#define MAX_KERNEL_LIB
 
#define MAX_KERNEL_GROUP
 
#define MAX_KERNEL_ARG
 

Functions

void SetStyle (int Old)
 Set user kernel style modelization mode. More...
 
int TilerParseOptions (int argc, char **argv)
 Parses AutoTiler options and performs initialization. More...
 
void GenerateTilingCode ()
 Generate code from the user model. More...
 
void SetUsedFilesNames (char *StdTypedefsName, unsigned int LibKernelFileCount,...)
 Provides header file for basic kernels standard data type and a list of basic kernels header files. More...
 
void SetGeneratedFilesNames (char *CallTemplatesName, char *CallTemplatesNameHeader)
 Defines files's names for code generation output. More...
 
void SetSymbolNames (char *L1SymbName, char *L2SymbName)
 Defines C symbol names used for user kernel's code generation. More...
 
void SetMemoryBaseNames (char *L1SymbName, char *L2SymbName, char *L3SymbName)
 Defines C symbol names used for user kernel's code generation. More...
 
void SetSymbolDynamics ()
 Set variables used for AutoTiler dynamic needs in cluster shared L1 memory and in L2 memory to be dynamic, e.g pointers, instead of arrays. More...
 
void SetL1MemorySize (unsigned int Size)
 Set the maximum amount in shared L1 memory that the AutoTiler can use. More...
 
void SetMemorySizes (unsigned int L1Size, unsigned int L2Size, unsigned int L3Size)
 Set the maximum amount in shared L1 memory, L2 internal memory and L3 external RAM that the AutoTiler can use. More...
 
void SetMemoryDeviceInfos (int Count,...)
 Configure memory devices. More...
 
void SetInlineMode (InlineModeT Mode)
 Control code generation inline strategy. More...
 
void SetKernelOpts (KernelOptimizationT On, KernelOptimizationT Off)
 Control user kernel optimizations. More...
 
void SetConstDir (char *DirName)
 Provides a folder name where to find constant files passed to ConstInfo() More...
 
void LibKernelTemplate (char *TemplateName, CKernel_Arg_T **CArgs)
 Adds a new basic kernel type template. More...
 
CKernel_Arg_T ** KerTypeTemplate (char *TemplateName)
 Returns Template type for TemplateName. More...
 
void LibKernel (char *KernelName, KernelCallTypeT CallType, CKernel_Arg_T **CArgs, char *ParArgTypeName, CNN_LayerOp_T *CNN_Match)
 Adds a new basic kernel template. More...
 
KernelLib_TKerLibMatch (KernelOper_T KerOper1, KernelOper_T KerOper2, int ParallelFeatures, int I1_Type, int I2_Type, int I3_Type, int I4_Type, int O_Type, int Fx, int Fy, int Dx, int Dy, int Sx, int Sy)
 Find best mapping for the group KerOper1,KerOper2 in the existing Kernel library. More...
 
void UserSymbols (int SCount,...)
 Define user defined symbols with associated value. Used in non inlined code generation. Returns NULL. More...
 
void InitKernelIterInfos (int OldStyle)
 
KernelDynamicSymbol_TS_Dyn (char *Name, int Value)
 Define one user defined symbol with associated value. More...
 
KernelDynamicSymbol_T ** KerDynamicSymbols (int SCount,...)
 Define user defined symbols with associated value. Used in non inlined code generation. More...
 
KernelIteratorDescrTIterFixedSpace (KernelIteratorT IterSpace, unsigned int Dim)
 Creates a list of ArgCount C arguments, each C argument is created by TCArg() More...
 
KernelIteratorDescrTIterParSpace (KernelIteratorT IterSpace, unsigned int Dim, unsigned int PrefDiv)
 Define one iteration dimension of the current kernel iteration space, dimension must not be a tiled one. Actual dimension value is provided and subject to division. More...
 
KernelIteratorDescrTIterTiledSpace (KernelIteratorT IterSpace)
 Define one iteration dimension of the current kernel iteration space, this dimension must be a tiled one. The autotiler will figure out the actual dimension. More...
 
KernelIterationSpaceTKernelIterSpace (unsigned int Dim,...)
 Define the number of iteration spaces and and how they are nested. More...
 
CKernel_Arg_T ** AllocateCArgs (unsigned int ArgCount)
 Creates a list of ArgCount Kernel C arguments. More...
 
CKernel_Arg_T ** CArgs (unsigned int ArgCount,...)
 Creates a list of ArgCount Kernel C arguments, then list of TCArg(), one for each Argument. More...
 
CKernel_Arg_TTCArg (char *ArgType, char *ArgName)
 Creates a typed C argument. More...
 
ConstInit_TConstInfo (char *FileName, int Format, int Binary, int Size, int Fract)
 Creates a descriptor for an initialized constant vector. More...
 
CKernel_Arg_TTCArgInfo (char *ArgType, char *ArgName, ArgScope_T Scope, ArgDirection_T Dir, AT_MemLocation_T HomeLoc, AT_MemLocation_T ExecLoc, ConstInit_T *ConstInit)
 Creates a typed C argument with location info. More...
 
CKernel_Arg_TTCArgInfoA (char *ArgType, char *ArgName, ArgScope_T Scope, ArgDirection_T Dir, AT_MemLocation_T HomeLoc, AT_MemLocation_T ExecLoc, ConstInit_T *ConstInit)
 Creates a typed C argument with location info, symbol considered to be allocated externally by the user. More...
 
CArg_Descriptor_TArgInfo (ArgScope_T Scope, ArgDirection_T Dir, AT_MemLocation_T HomeLoc, AT_MemLocation_T ExecLoc, ConstInit_T *ConstInit)
 Creates a C argument location info only. More...
 
CKernelCall_T ** Calls (unsigned int CallCount,...)
 Creates a list of calls to basic or user kernels. More...
 
CKernelCall_T ** AllocateCalls (unsigned int CallCount)
 Prepares a list of CallCount calls. More...
 
CKernelCall_TCall (char *CallName, KernelCallLocationT CallLocation, ArgBindingDescr_T **BindingList)
 Create a call to a basic or a user kernel. More...
 
ArgBindingDescr_T ** Bindings (int BCount,...)
 Create a list of bindings between an argument and an actual value. More...
 
ArgBindingDescr_TC_Arg (char *ArgName)
 Binds argument to a C user kernel or user kernel group. More...
 
ArgBindingDescr_TC_ArgPlusImmOffset (char *ArgName, int Offset)
 Binds argument to a C user kernel or user kernel group argument and adds an immediate Offset. More...
 
ArgBindingDescr_TC_ArgImmOper (char *ArgName, char Oper, int Value)
 Binds argument to a C user kernel or user kernel group argument and combines it with an immediate Value. More...
 
ArgBindingDescr_TC_ImmArgOper (int Value, char *Oper, char *ArgName)
 Binds argument to an immediate value combined to a C user kernel or user kernel group argument through oper. More...
 
ArgBindingDescr_TC_ArgCOper (char *ArgName, char Oper, char *Cvar)
 Binds argument to a C user kernel or user kernel group argument and combines it with a C variable. More...
 
ArgBindingDescr_TC_ArgPlusCvarOffset (char *ArgName, char *Cvar)
 Binds argument to a C user kernel or user kernel group argument and adds an Offset which is another C argument. More...
 
ArgBindingDescr_TC_ArgPlusPlaneOffset (char *ArgName, KernelIteratorT Sel, int Mult)
 Binds argument to a C user kernel or user kernel group argument and adds the current plane index given by Sel multiplied by Mult. More...
 
ArgBindingDescr_TC_ArgIndex (char *ArgName, KernelIteratorT Sel, int Mult)
 Binds argument to a C user kernel or user kernel group subscripted by an Index. More...
 
ArgBindingDescr_TC_ArgIndirect (char *ArgName, int Offset)
 Binds argument to a C user kernel or user kernel group subscripted by an Offset. More...
 
ArgBindingDescr_TImm (int Value)
 Binds argument to an immediate integer value. More...
 
ArgBindingDescr_TUserSymb (char *Name)
 Binds argument to a user defined symbol's associated value. More...
 
ArgBindingDescr_TKerDim (KernelDimT Dim)
 Binds argument to one of the user kernel dimension InPlane/OutPlane/Width/Height. More...
 
ArgBindingDescr_TKer_IteratorIndex (KernelIteratorT Sel)
 Binds argument to one of the user kernel iterator actual value. More...
 
ArgBindingDescr_TK_Arg (char *ArgName, KernelArgSelect_T ArgSelect)
 Binds argument to a user kernel argument (a tiled argument). More...
 
ArgBindingDescr_TK_ArgPar (char *ArgName, KernelArgSelect_T ArgSelect, KernelIteratorT ItSpace)
 Binds argument to one of the parametric sub space of a user kernel argument. More...
 
ArgBindingDescr_TK_ArgPred (char *ArgName, KernelArgSelect_T ArgSelect, KernelIteratorT ItSpace)
 Binds argument to kernel argument tile attribute predicate for a given sub space of this kernel argument. More...
 
ArgBindingDescr_TK_ArgPredList (ArgBindingT Conj, int N,...)
 Binds to a list of anded/ored predicates. More...
 
ArgBindingDescr_TK_ArgOper (char *ArgName, KernelIteratorT KerIter, char Oper, int Value)
 Binds argument to a user kernel argument (a tiled argument) and combine it with Value using Oper. More...
 
ArgBindingDescr_TK_TileOper (char *ArgName, char *ArgAccessType, char Oper, int Value)
 Binds argument to a user kernel argument (a tiled argument) and combine it with Value using Oper. More...
 
unsigned int MkTCons (unsigned int Div, unsigned int Rem)
 Creates a tile dimension constraint for a kernel argument. More...
 
Object_T ** AllocateKerArgs (unsigned int KerArgCount)
 Creates a list of user kernel arguments. More...
 
Object_T ** KerArgs (unsigned int KerArgCount,...)
 Creates a list of user kernel arguments. More...
 
KernelArgDimDescrTKerArgSpace (unsigned int Dim,...)
 Define Kernel argument's iteration space. More...
 
Object_TKerArg (char *KerArgName, KernelArgDimDescrT *KerArgSpace, Object_Type_T ObjType, unsigned int W, unsigned int H, unsigned int ItemSize, int TileOverlap, KernelArgConstraints_T Constraint, unsigned int PreferedTileSize, char *CArgName)
 Creates one user kernel argument. Kernel argument Space is explicitely described. More...
 
Object_TKerArgAliased (char *KerArgName, KernelArgDimDescrT *KerArgSpace, unsigned int Alias, Object_Type_T ObjType, unsigned int W, unsigned int H, unsigned int ItemSize, int TileOverlap, KernelArgConstraints_T Constraint, unsigned int PreferedTileSize, char *CArgName)
 
Object_TKerArgP (char *KerArgName, KernelArgDimDescrT *KerArgSpace, Object_Type_T ObjType, unsigned int W, unsigned int H, unsigned int UsedW, unsigned int UsedH, v4s PadTile, v4s PadExec, unsigned int ItemSize, int TileOverlap, KernelArgConstraints_T Constraint, unsigned int PreferedTileSize, char *CArgName)
 Creates one user kernel argument with padding on the boundaries. Kernel argument Space is explicitely described. More...
 
Object_TKerArgPadAlign (char *KerArgName, KernelArgDimDescrT *KerArgSpace, Object_Type_T ObjType, unsigned int W, unsigned int H, unsigned int TileWPadAlign, unsigned int ItemSize, unsigned int RawItemSize, int TileOverlap, KernelArgConstraints_T Constraint, unsigned int PreferedTileSize, char *CArgName)
 Creates one user kernel argument, extra pad on variable dim for alignment sake. Kernel argument Space is explicitely described. More...
 
Object_TKerArgPad (char *KerArgName, KernelArgDimDescrT *KerArgSpace, Object_Type_T ObjType, unsigned int W, unsigned int H, unsigned int BottomBuffer, unsigned int TopBuffer, unsigned int ItemSize, int TileOverlap, KernelArgConstraints_T Constraint, unsigned int PreferedTileSize, char *CArgName)
 Creates one user kernel argument with fixed padding before and after the tile generated for this argument. Kernel argument Space is explicitely described. More...
 
Object_TKerArgPart (char *KerArgName, KernelArgDimDescrT *KerArgSpace, Object_Type_T ObjType, unsigned int W, unsigned int UsedW, unsigned int H, unsigned int UsedH, unsigned int ItemSize, int TileOverlap, KernelArgConstraints_T Constraint, unsigned int PreferedTileSize, char *CArgName)
 Creates one user kernel argument with dimension [WxH] but used partially as [UsedWxUsedH]. Kernel argument Space is explicitely described. More...
 
Kernel_TUserKernel (char *TemplateName, KernelIterationSpaceT *KerIter, Tile_Orientation_T Orientation, CKernel_Arg_T **CArg, CKernelCall_T **CCalls, Object_T **KerArg)
 Creates a user kernel. More...
 
void AddKernelInfos (char *Name, AT_KernelInfo_T Info, long long int NumVal, void *Val)
 Add informations to selected user kernel. More...
 
void AddKernelArgDim (char *Name, char *ArgName, int Dim,...)
 Add informations to selected argument of selected user kernel. More...
 
void SetKernelArgInterleave (char *Name, char *ArgName, unsigned int TileLineInterleave)
 For 2D parametric const arg interleave each tile by group of TileLineInterleave Lines. More...
 
void SetKerArgInL3 (char *Name, char *ArgName)
 Set L2DB (in L3) property to Kernel Name, Kernel Argument ArgName. More...
 
void AT_SetKernelCtrl (AT_GraphCtrl_T Ctrl, void *Val)
 Alter the behaviour of UserKernel processing. More...
 
void * AT_GetKernelCtrl (AT_GraphCtrl_T Ctrl)
 
void OpenKernelGroup (char *GroupName)
 Open a user kernel group. More...
 
void CloseKernelGroup ()
 Close currently open user kernel group. More...
 
void CloseKernelGroupNoMerge ()
 Close currently open user kernel group setting KER_OPT_KEEP_GROUP for nodes in the group. More...
 
CKernelCall_TUserKernelCall (char *CallName, KernelCallLocationT CallLocation, ArgBindingDescr_T **BindingList)
 Call a user kernel in a user kernel group. More...
 
Object_TKerGroupArg (char *KerArgName, Object_Type_T ObjType, int ArgSize, int ItemSize, char *CArgName)
 
ArgBindingDescr_TKG_ArgOper (char *ArgName, char Oper, int Value)
 Binds argument to a user kernel group argument and combine it with Value using Oper. More...
 
StackedTensors_TAT_StackedTensors (char *OutTensorName, int Count,...)
 Creates a stacked tensor, resulting object is OutTensorName, Count in tensors passed as names are stacked according to list order. More...
 
void AddStackedTensors (char *OutTensorName, int Count,...)
 Add a stacked tensor to the open graph. More...
 
StackedTensors_TAT_StackedTensorsList (int Count,...)
 Creates a list of stacked tensors. More...
 
CKernel_Arg_TStackedTensorsLookup (StackedTensors_T *List, NameT *Name)
 Given input tensor Name returns corresponding Out Stacked Tensor if it exists. More...
 
void UserKernelGroup (char *GroupName, CKernel_Arg_T **CArg, CKernelCall_T **CCalls)
 Declare a user kernel group. More...
 
KernelGroup_TUserKernelGroupK (char *GroupName, unsigned int IterCount, CKernel_Arg_T **CArg, StackedTensors_T *StackedTensors, CKernelCall_T **CCalls, Object_T **KerArg)
 
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_TCNNGraph ()
 Returns the defined graph. More...
 
CNNGraph_TCreateGraph (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_TGNodeArg (GraghNodeArgT Type, char *ArgName, char *AliasedArgName)
 Binds a given Graph node arg to a user kernel kernel argument. More...
 
ArgBindingDescr_TGNodeCArg (char *ArgName)
 Binds a given Graph node arg to a user kernel kernel C argument. More...
 
ArgBindingDescr_TGNodeArgImmOper (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_TGArg (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_TCNN_OperList (int N,...)
 Create a list of N CNN operation. More...
 
CNN_LayerOp_TCNN_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...
 
char * AppendNames (char *Name1, char *Name2)
 Return the concatenation of 2 names. More...
 
char * AppendIndex (char *Name, unsigned int Index)
 Return the concatenation of 1 names and an index. More...
 
void GenTilingError (const char *Message,...)
 Generates an error message and aborts execution. More...
 
void GenTilingWarning (const char *Message,...)
 Generates a warning message. Does not abort. More...
 
void SetAT_TestFile (char *AT_TestFileName)
 
void AT_PrepareForTest (char *Name, v4s DataSize, v4s L3, int InFeat, int OutFeat, int Width, int Height, int FScW, int FScH, int ConvStrideW, int ConvStrideH, int DcW, int DcH, v4s PadInp, int FSpW, int FSpH, int PoolStrideW, int PoolStrideH, int DpW, int DpH, v4s PadInc, KernelOper_T KerOper, int Norm, int NormBias)
 
void AT_PrepareForTest_SQ8 (char *Name, int InFeat, int OutFeat, int Width, int Height, int BiasDataSize, KernelOper_T OpC, int Fcx, int Fcy, int Dcx, int Dcy, int Scx, int Scy, v4s PadC, KernelOper_T OpP, int Fpx, int Fpy, int Dpx, int Dpy, int Spx, int Spy, v4s PadP, KernelOper_T OpA)
 
void AT_TestFinalize ()
 
void AT_TestFinalize_SQ8 ()
 
void DecodeCNNOper (KernelOper_T Oper, int *DoConv, int *IsDWconv, int *IsDPconv, int *DoPool, int *DoLinear, int *DoReLU, int *DoMatAdd, int *DoMatMul, int *DoSoftMax)
 

Variables

ArgBindingDescr_TAT_NO_ARG_BINDING
 
ArgBindingDescr_TAT_IGNORE_ARG_BINDING
 
CKernelCall_TAT_NO_CALL
 
Object_TAT_NO_KER_ARG
 
CKernel_Arg_TAT_NO_C_ARG
 

Macro Definition Documentation

#define Max (   a,
 
)
#define MAX_KERNEL
#define MAX_KERNEL_ARG
#define MAX_KERNEL_GROUP
#define MAX_KERNEL_LIB
#define MAX_KERNEL_LIB_TEMPL
#define Min (   a,
 
)

Function Documentation

void AT_PrepareForTest ( char *  Name,
v4s  DataSize,
v4s  L3,
int  InFeat,
int  OutFeat,
int  Width,
int  Height,
int  FScW,
int  FScH,
int  ConvStrideW,
int  ConvStrideH,
int  DcW,
int  DcH,
v4s  PadInp,
int  FSpW,
int  FSpH,
int  PoolStrideW,
int  PoolStrideH,
int  DpW,
int  DpH,
v4s  PadInc,
KernelOper_T  KerOper,
int  Norm,
int  NormBias 
)
void AT_PrepareForTest_SQ8 ( char *  Name,
int  InFeat,
int  OutFeat,
int  Width,
int  Height,
int  BiasDataSize,
KernelOper_T  OpC,
int  Fcx,
int  Fcy,
int  Dcx,
int  Dcy,
int  Scx,
int  Scy,
v4s  PadC,
KernelOper_T  OpP,
int  Fpx,
int  Fpy,
int  Dpx,
int  Dpy,
int  Spx,
int  Spy,
v4s  PadP,
KernelOper_T  OpA 
)
void AT_TestFinalize ( )
void AT_TestFinalize_SQ8 ( )
void DecodeCNNOper ( KernelOper_T  Oper,
int *  DoConv,
int *  IsDWconv,
int *  IsDPconv,
int *  DoPool,
int *  DoLinear,
int *  DoReLU,
int *  DoMatAdd,
int *  DoMatMul,
int *  DoSoftMax 
)
void SetAT_TestFile ( char *  AT_TestFileName)

Variable Documentation

ArgBindingDescr_T * AT_IGNORE_ARG_BINDING
ArgBindingDescr_T* AT_NO_ARG_BINDING
CKernel_Arg_T* AT_NO_C_ARG
CKernelCall_T* AT_NO_CALL
Object_T* AT_NO_KER_ARG