Ascend C operator is programmed using the standard C++ syntax and a set of class library APIs. You can select appropriate APIs based on your requirements. The following figure shows the programming class library APIs of Ascend C. The operands of Ascend C APIs are of the tensor type: GlobalTensor and LocalTensor. The class library APIs are classified into basic APIs and high-level APIs.
Basic APIs: implement abstract hardware capabilities and open chip capabilities to ensure completeness and compatibility. The APIs marked as Instruction Set Architecture Special Interface (ISASI, hardware architecture-related APIs) do not guarantee compatibility across hardware versions.
High-level APIs: implement common computing algorithms to improve programming and development efficiency based on basic APIs. High-level APIs include math library, Matmul, and Softmax APIs. High-level APIs can ensure compatibility.
Figure 1 Ascend C programming class library APIs

Basic APIs are classified into the following types:
Compute APIs, including scalar compute APIs, vector compute APIs, and matrix compute APIs, are used to call the Scalar Unit, Vector Unit, and Cube Unit to perform computation.
Data transfer APIs. The compute APIs perform computation based on data in local memory. Therefore, data needs to be transferred from global memory to local memory, computed by calling the compute APIs, and then transferred from local memory to global memory. The APIs that move data are called data movement APIs, for example, the DataCopy API.
Memory management APIs, such as the AllocTensor and FreeTensor APIs, are used to allocate and manage memory.
Synchronization control APIs, such as the EnQue and DeQue APIs, are used to implement communication and synchronization between tasks. Different API instructions may depend on each other. It can be learned from Hardware Architecture Abstraction that different instructions are executed asynchronously in parallel. To ensure that instructions in different instruction queues are executed according to correct logic, synchronization instructions need to be sent to different units. Synchronization control APIs complete the process of sending synchronization instructions internally. You do not need to pay attention to the internal implementation logic. Instead, you can simply use the APIs to complete the process.
Instruction Set Architecture Special APIs (ISASIs) are related to the hardware architecture. This type of APIs cannot ensure cross-hardware version compatibility.
Compute APIs involve the following computation methods based on data operation methods:
Computation of the entire tensor: This type of computation is implemented through operator overloading. Operators (+, -, *, /, |, &, <, >, <=, >=, ==, !=) are supported to simplify the computation. Examples:
dst = src1 + src2
Computation of the first n data elements of a tensor: Computes the continuous n data elements of the source operand and continuously writes the data to the destination operand to solve the continuous computing problem of the one-dimensional tensor. Examples:
Add(dst, src1, src2, n);
The following figure uses vector addition as an example to show the characteristics of these computation methods.
Figure 2 Characteristics of computation methods of compute APIs

Header file directory of Ascend C APIs:
Basic APIs: ${DDK_INSTALL_PATH}/tools/tools_ascendc/include/tikcpp/tikcfw/kernel_operator.h
High-level APIs: ${DDK_INSTALL_PATH}/tools/tools_ascendc/include/tikcpp/tikcfw/lib, where ${DDK_INSTALL_PATH} indicates the installation directory of the DDK. (Note that if the APIs contained in the header file directory are not declared in the documentation, they are called indirectly, and you do not need to pay attention to them.)