Basic Data Structures and API List
This document describes the basic data structures and APIs required for operator development and graph development. The data structures and APIs are classified by namespace as follows:
- GE
Graph Engine (GE) is a general namespace dedicated to graph construction and compilation. It provides a rich set of APIs for building and managing complex graph structures. With universality and flexibility, it can meet various graph processing requirements in the design and compilation processes.
- gert
GE Runtime (gert) is the namespace designed for the runtime environment and provides a series of high-performance data structures to ensure optimal performance during execution.
gert Namespace
Category |
Data Structure/API |
Function |
|---|---|---|
Class and structure |
Describes the relationship between the input of the IR definition prototype of an operator and the actual input. The header file is in include/exe_graph/runtime/compute_node_info.h under the CANN component directory. |
|
Describes the tensor information during compilation, including the dtype and format information. The header file is in include/exe_graph/runtime/compute_node_info.h under the CANN component directory. |
||
Serializes and saves operator compilation information so that the information can be efficiently obtained during graph execution. The header file is in include/exe_graph/runtime/compute_node_info.h under the CANN component directory. |
||
Allocates a continuous space in the memory to store data descriptions and actual data elements. The element type is ContinuousVector. The header file is in include/exe_graph/runtime/continuous_vector.h under the CANN component directory. |
||
This class is a POD class, which allocates a continuous space in the memory to store descriptions and actual memory data. The header file is in include/exe_graph/runtime/continuous_vector.h under the CANN component directory. |
||
Defines the rules for expanding dimensions based on the shapes resulting from the expansion. The header file is in include/exe_graph/runtime/expand_dims_type.h under the CANN component directory. |
||
Base class of InferShapeContext and TilingContext. The methods provided in ExtendedKernelContext, such as the APIs for obtaining the operator type, name, and attributes, can be called in the InferShape and tiling functions. The header file is in include/exe_graph/runtime/extended_kernel_context.h under the CANN component directory. |
||
Context structure used for datatype derivation. The header file is in include/exe_graph/runtime/infer_datatype_context.h under the CANN component directory. |
||
Context structure used for shape derivation. The header file is in include/exe_graph/runtime/infer_shape_context.h under the CANN component directory. |
||
Context structure used for shape range derivation. The header file is in include/exe_graph/runtime/infer_shape_range_context.h under the CANN component directory. |
||
As a registration API class, OpImplRegisterV2 provides a series of operator prototype registration APIs for users to register information of a specific operator type, including the tiling function, Infershape function, and private attributes. This class is indirectly used when users call the operator prototype registration API for registration. The header file is in include/register/op_impl_registry.h under the CANN component directory. |
||
Describes the upper and lower bounds of an object. The header file is in include/exe_graph/runtime/range.h under the CANN component directory. |
||
Stores operator attributes. The header file is in include/exe_graph/runtime/runtime_attrs.h under the CANN component directory. |
||
Describes the shape of a tensor. The header file is in include/exe_graph/runtime/shape.h under the CANN component directory. |
||
Includes the original format, runtime format, and dimension expansion rule. The header file is in include/exe_graph/runtime/storage_format.h under the CANN component directory. |
||
Describes shapes of a tensor, including origin_shape and storage_shape. The header file is in include/exe_graph/runtime/storage_shape.h under the CANN component directory. |
||
Stores tensor data. The header file is in include/exe_graph/runtime/tensor_data.h under the CANN component directory. |
||
Provides a group of functions to determine the position of TensorPlacement. The header file is in include/exe_graph/runtime/tensor_data.h under the CANN component directory. |
||
Describes the information and behavior of a tensor object, including the shape, format, datatype, and tensor data. The header file is in include/exe_graph/runtime/tensor.h under the CANN component directory. |
||
Context structure used for operator tiling. The header file is in include/exe_graph/runtime/tiling_context.h under the CANN component directory. |
||
Stores tiling data. The header file is in include/exe_graph/runtime/tiling_data.h under the CANN component directory. |
||
Inherits from the ContinuousVector class. Unlike the ContinuousVector class, MutableData and GetData return addresses of a specified type instead of void *. Therefore, Typed is added to the class name. The header file is in include/exe_graph/runtime/continuous_vector.h under the CANN component directory. |
||
Enum |
Enumerates the tensor locations. The header file is in include/exe_graph/runtime/tensor_data.h under the CANN component directory. |
GE Namespace
Category |
Data Structure/API |
Function |
|---|---|---|
Class and structure |
Supports the external allocator registered by users. The header file is in include/ge/ge_allocator.h under the CANN component directory. |
|
Stores strings.
|
||
Stores attribute values.
|
||
An internal associated API, used during plugin adaptation, is called indirectly and remains imperceptible to developers. |
||
An internal associated API, used during plugin adaptation, is called indirectly and remains imperceptible to developers. |
||
Obtains the inference context object and sets the shape and data type of the object for resource operators. The header file is in include/graph/inference_context.h under the CANN component directory. |
||
Registers the operator InferFormat function. This API is referenced by other header files and is not directly called by the operator developer. |
||
Registers the operator infershape function. This API is referenced by other header files and is not directly called by the operator developer. |
||
Registers the operator InferValueRangeFuncRegister function. This API is referenced by other header files and is not directly called by the operator developer. |
||
Defines the data types supported by the input or output. It is the encapsulation of TensorType and is used to list the multiple supported data types. The header file is in include/graph/types.h under the CANN component directory. |
||
Used together with the Allocator class to support the external allocator registered by users. The header file is in include/ge/ge_allocator.h under the CANN component directory. |
||
Registers an operator prototype and is referenced by other header files. Therefore, it is not directly called by the operator developer. |
||
An internal associated API, which is referenced by other header files and is not directly called by the operator developer. |
||
Operator class.
|
||
Receives the registration information of custom operators for the development of plugins to adapt to AI frameworks. The header file is in include/register/register.h under the CANN component directory. |
||
Registers the mapping relationship when writing adapter plugins to adapt operators for AI framework integration. The header file is in include/register/register.h under the CANN component directory. |
||
Indicates that the output data type is the promotion type between the data types specified by the input or attribute. The header file is in include/graph/types.h under the CANN component directory. |
||
Sets and obtains the shape and data type of an object. The header file is in include/graph/inference_context.h under the CANN component directory. |
||
Stores the shape information of a tensor.
|
||
Stores the tensor description. |
||
Accesses and manages the tensor description.
|
||
Defines the data types supported by the input or output. |
||
Tensor structure.
|
||
Type conversion tool class. The header file is in include/graph/utils/type_utils.h under the CANN component directory. |
||
Registers the operator verifyFunc function. This API is referenced by other header files and is not directly called by the operator developer. |
||
Function |
A template function to convert strings of different types to those of the AscendString type. Accepts a template parameter T and converts it to the AscendString type. The header file is in include/graph/operator_reg.h under the CANN component directory. |
|
Defines a template function ConvertToListAscendString to convert strings of different types to those of the AscendString type. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Obtains the value of C0 format based on the actual format. The header file is in include/graph/types.h under the CANN component directory. |
||
Parses C0 format information from the actual format. The header file is in include/graph/types.h under the CANN component directory. |
||
Obtains the actual format based on the input format and C0 format. The header file is in include/graph/types.h under the CANN component directory. |
||
Obtains the actual format based on the input primary format and sub-format. The header file is in include/graph/types.h under the CANN component directory. |
||
Obtains the actual format based on the input primary format, sub-format, and C0 format. The header file is in include/graph/types.h under the CANN component directory. |
||
Obtains the string description of the format based on the input format type. The header file is in include/graph/types.h under the CANN component directory. |
||
Parses primary format information from the actual format. The header file is in include/graph/types.h under the CANN component directory. |
||
Obtains the memory size occupied by the passed data_type. The header file is in include/graph/types.h under the CANN component directory. |
||
Obtains the total memory size occupied by data_type (number specified by element_cout) based on the passed element_cout and data_type. The header file is in include/graph/types.h under the CANN component directory. |
||
Parses sub-format information from the actual format. The header file is in include/graph/types.h under the CANN component directory. |
||
Returns if the actual format contains a C0 format. The header file is in include/graph/types.h under the CANN component directory. |
||
Returns if the actual format contains a sub-format. The header file is in include/graph/types.h under the CANN component directory. |
||
Type definition |
Return code status description. The header file is in include/graph/ge_error_codes.h under the CANN component directory. |
|
Enum |
Data type enum values. The header file is in include/graph/types.h under the CANN component directory. |
|
Data format enum values. The header file is in include/graph/types.h under the CANN component directory. |
||
Macro |
Encapsulated macro of common functions, facilitating the development of the InferShape function. This function sets the output shape based on the shapes of two inputs. This macro sets the shape only, and does not set the data type. The header file is in include/graph/operator_reg.h under the CANN component directory. |
|
Registers the InferShape function of an operator. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Registers error codes along with their corresponding descriptions. The header file is in include/register/register_error_codes.h under the CANN component directory. |
||
Encapsulated macro of common functions, facilitating the development of the InferShape function. This API sets the output shape and dtype based on the input shape and dtype. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Encapsulates the Common_InferShape function of an operator. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Encapsulates the inferFormat function of an operator. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Encapsulates the InferShape function of an operator. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Encapsulates the Verify function of an operator. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Registers the InferFormat implementation of an operator. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Registers the InferShape function of an operator. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Prototype definition API. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Prototype definition derivative APIs. The header file is in include/graph/operator_reg.h under the CANN component directory. |
||
Registers the Verify function of an operator. The header file is in include/graph/operator_reg.h under the CANN component directory. |