Operator APIs (aclnn)

How to Use

To make it easier to call operators, a set of C-based APIs (with the aclnn prefix) are provided. You do not need to provide the Intermediate Representation (IR) definition to facilitate efficient model and application development. This method is called single-operator API calling, or aclnn calling for short.

When calling operator APIs, you need to reference the dependency header file and library file. Generally, the header file is stored in ${INSTALL_DIR}/include/aclnnop and the library file is stored in ${INSTALL_DIR}/lib64. The specific files are as follows:

  • Dependent header files: ① Method 1 (recommended): Include the general operator header file aclnn_ops_{ops_project}.h. ② Method 2: Include single-operator API header files as required aclnn_*.h.
  • Dependent library files: Include the general operator library file libopapi_${ops_project}.so as required. Note that libopapi.so, the general library file of the original all-operator repository, will be deprecated later. It is not recommended and cannot be used together with a single-operator repository library file.

Here, ${INSTALL_DIR} indicates the CANN installation path; ${ops_project} indicates the operator repository name (such as ras, nn, and math). Please configure it as the actual operator repository name.

  • Version Evolution

    Note that some APIs have multiple versions. Select the latest version. (APIs of a later version are compatible with all capabilities of an earlier version.)

API List

  • Operator features: Before calling an API, please learn basic operator knowledge, including deterministic algorithms, batch consistency, and common quantization modes. For details, see Basic Concepts of Operators.
  • Symbols: In the table, "-" indicates that the API does not support the products in the current column yet.

The following table lists the operator APIs.

API NameDescriptionDeterministic Computation (A2/A3)Deterministic Computation (Ascend 950)
aclnnObfuscationCalculateSends tensor x and configuration parameters (such as param and cmd) to the PMCC obfuscation engine. The CA module of the engine calls the TA module to obfuscate the tensor, and returns the obfuscated tensor y whose shape is the same as that of x.Defaults to a deterministic implementation.-
aclnnObfuscationCalculateV2Sends tensor x and configuration parameters (such as param and cmd) to the PMCC obfuscation engine. The CA module of the engine calls the TA module to obfuscate the tensor, and returns the obfuscated tensor y whose shape is the same as that of x.Defaults to a deterministic implementation.-
aclnnObfuscationSetupInitializes and releases resources of the PMCC model obfuscation engine.Defaults to a deterministic implementation.-
aclnnObfuscationSetupV2Initializes and releases resources of the PMCC model obfuscation engine.Defaults to a deterministic implementation.-
aclnnCryptoCalls the aicpu encryption and decryption operator and executes it based on input parameters.Defaults to a deterministic implementation.-
aclnnMatmulAbftVerifyPerforms fault tolerance detection on the precomputed matmul result based on V-ABFT and outputs row-wise detection results.Defaults to a deterministic implementation.-