Introduction
Overview
CANN provides a diverse array of hardware-adaptive operators, directly applicable to AI services and laying a foundation for accelerating network computing on AI processors.
Figure 1 shows where the operator libraries sit in the CANN architecture:
- Math: numerical calculation operators, like Add and Abs, for use cases such as tensor shape transformation, basic mathematical operations, and random number generation.
- NN: neural network operators, common in deep learning models, for use cases such as convolution, matrix multiplication, activation functions, and normalization.
- CV: computer vision operators, such as GridSample, for image processing and object detection.
- Transformer: foundation model computation operators in major classes such as Attention, LayerNorm, and merged compute and communication (MC2).
- Opbase: basic framework library on which all other operator libraries depend. It realizes basic scheduling (such as aclTensor creation/release and workspace reuse) and common dependencies.
Each operator has two parts: device-side kernel implementation and host-side calls (via a single-operator API, or host API, in C). Figure 2 shows the API call flow. For details, see Calling Built-in CANN Operators in Application Development (C&C++).
This document describes the intermediate representation (IR) specifications for operators and operator APIs, while also detailing the operator specifications defined by IR in different AI deep learning frameworks (such as TensorFlow and Caffe), helping you build required network models.
Instructions for Use
- CANN does not guarantee operator performance in use cases beyond the operator API references or operator specifications (such as product models, data types, data formats, and data dimensions).
- Operator packages: Before calling an operator, ensure that the CANN Toolkit and ops packages have been installed. For details, see CANN Software Installation.
- Ascend virtual instance: Not supported for current fused operators. A fused operator, such as Flash Attention or MC2, is a combination of multiple independent basic operators (such as vector and cube). It delivers the same functions as those basic operators but with better performance.
Instructions for Use
Start with Table 1 to understand the applied use cases, operator classification, and header files of the operator libraries.
Header file and library file descriptions: To call an operator API, include the dependent files. Generally, header files are stored in the ${INSTALL_DIR}/include/ directory, and library files are in ${INSTALL_DIR}/lib64/. Replace ${INSTALL_DIR} with the CANN component directory. For example, if the installation is performed by the root user, the default file storage path is /usr/local/Ascend/cann.
|
Item |
Guide |
Description |
Dependent Header File or Library File |
|---|---|---|---|
|
1. Operator library basics to learn |
Basic concepts, terminology, key technologies, etc. |
- |
|
|
2. Common APIs on which the operator library depends during API calling |
Common meta APIs such as those for creating aclTensor, aclScalar, and aclIntArray |
|
|
|
3. Types of operator APIs (aclnn) |
Mathematical calculation operators, such as Add and Abs |
NOTE:
|
|
|
Neural network operators such as Matmul. Operators of this type account for the largest proportion in the operator library. |
|||
|
Computer vision operators such as GridSample. |
|||
|
Large model computation operators for use cases like FlashAttention, MC2 (merged compute and communication), and Mixture of Experts (MoE). |
|||
|
5. Operator information defined based on the Ascend IR in the operator library |
Operator information defined based on the Ascend IR. |
- |
|
|
6. Operator information defined based on the native IR of the AI framework |
Operator information defined based on the native IR of mainstream AI frameworks (such as TensorFlow and Caffe). |
- |
|
|
7. Operator library resources |
|
- |

