Internal Associated APIs
During operator prototype registration, tiling implementation, and shape inference, some auxiliary data structures and APIs are called in the external open APIs, which are referred to as internal associated APIs. Developers will not directly call internal associated APIs, so this section is only for brief introduction.
CTilingDataClassFactory
The CTilingDataClassFactory class is used to register tiling structures defined by Ascend C high-level APIs and users. It is a factory class implemented through a singleton and is used in REGISTER_TILING_DATA_CLASS in TilingData Structure Registration.
Function |
Meaning |
|---|---|
GetInstance |
Obtains the singleton of the CTilingDataClassFactory class. |
RegisterTilingData |
Registers the tiling structure constructor of op_type with the CTilingDataClassFactory class. |
CreateTilingDataInstance |
Obtains the tiling structure based on the operator name. |
OpDef-related APIs
This part describes internal APIs related to prototype registration, including OpDef, OpParamDef, and OpAICoreConfig. These APIs are required only by the framework to generate related projects and can be ignored by users.
Class |
API |
Description |
|---|---|---|
OpAICoreDef |
GetTiling |
Obtains the tiling information. |
GetCheckSupport |
Obtains the parameter verification information. |
|
GetOpSelectFormat |
Obtains the inference function. |
|
GetOpSupportInfo |
Obtains the operator tiling information function. |
|
GetOpSpecInfo |
Obtains additional operator information for the FE to parse functions. |
|
GetParamGeneralize |
Obtains the operator generalization function. |
|
SetOpSupportInfo |
Sets the operator tiling information function. |
|
SetOpSpecInfo |
Sets additional operator information for the FE to parse functions. |
|
SetParamGeneralize |
Sets the operator generalization function. |
|
OpDef |
GetInferShape |
Obtains the Shape inference function. |
GetInferShapeRange |
Obtains the ShapeRange inference function. |
|
GetInferDataType |
Obtains the DataType inference function. |
|
OpDefFactory |
OpDefRegister |
Registers an operator. |
OpCheckFuncHelper |
- |
Checks operator-related functions and verifies input and output shapes, including operator parameter validation and callback function derivation. |
Tiling Definition Auxiliary APIs
The following APIs are auxiliary Tiling definition APIs. Ascend C provides a series of definition macros of Tiling type, including BEGIN_TILING_DATA_DEF, TILING_DATA_FIELD_DEF, TILING_DATA_FIELD_DEF_ARR, TILING_DATA_FIELD_DEF_STRUCT, and REGISTER_TILING_DATA_CLASS. When these macros are called, the following APIs are called to further process the tiling information, including structure reservation and byte alignment.
// TilingDef class void SaveToBuffer(void *pdata, size_t capacity); std::vector<FieldInfo> GetFieldInfo() const; const char *GetTilingClassName() const; size_t GetDataSize() const; void SetDataPtr(void *dataPtr); void CheckAlignAndGenPlaceHolder(const char *name, size_t typeSize); // FieldInfo class FieldInfo(const char *dtype, const char *name) FieldInfo(const char *dtype, const char *name, size_t arrSize) FieldInfo(const char *dtype, const char *name, const char *structType,size_t structSize)
Auxiliary APIs for OpLib Registration
Auxiliary APIs for OpLib registration, including the OpBinInfo class and related member functions. The OpBinInfo class and related member functions are required for generating related projects by the framework. You do not need to pay attention to them.
Class |
API |
Description |
|---|---|---|
OpBinInfo |
OpBinInfo |
Constructs an object of class OpBinInfo. |
Generate |
Decompresses the library file of the custom operator project. |
|
Check |
Checks whether the type is dynamic library. |