目录

About This Kit

Compute Architecture for Neural Networks (CANN) is a heterogeneous computing architecture launched by Huawei, designed for AI with device-cloud consistency. On HarmonyOS devices, the CANN Kit (CANN heterogeneous computing framework service) provides a unified access and running environment for various AI models and algorithms, oriented towards the Kirin chipset platform. Your app can leverage CANN Kit's APIs and developer data to perform intelligent inference and model optimization on the device, fully utilizing the local intelligent processing capabilities.

A model is the result of applying AI algorithms to a large amount of training data. You can use the model to perform intelligent inference and prediction based on new input data. Models can accomplish many complex tasks that are difficult or inefficient to implement with conventional code. For example, you can train a model to perform semantic segmentation on images, recognizing and precisely delineating different object classes within the images, or process voice data to enable voice wake-up, speech recognition, and speech synthesis.

You can use the CANN development platform provided by Huawei Ascend to build and train models. Trained models can be converted to the format compatible with CANN Kit, allowing seamless integration into your app. Additionally, you can develop models based on other open-source or self-developed machine learning frameworks and then adapt these models to the HarmonyOS ecosystem using the toolchain provided by CANN Kit.

CANN Kit efficiently optimizes on-device intelligent computing performance by coordinating the Neural Network Processing Unit (NPU), CPU, and other hardware resources. While enhancing computing efficiency, it minimizes memory and power consumption. Running models directly on the device reduces network dependency, ensuring the privacy and security of developer data. This allows apps to maintain quick response times in various network environments, providing developers with a smooth and intelligent interaction experience.

CANN Kit is built on underlying hardware and optimized computing libraries, oriented toward the computing core of Huawei-developed Da Vinci NPU. It supports the Ascend C custom operator programming language and related toolchain, in conjunction with the cloud-side Ascend processors. This ensures that NPU-oriented development and optimization can be performed once and deployed across multiple devices.

CANN Kit is a cornerstone of the HarmonyOS intelligent ecosystem, providing core support for intelligent apps across various fields. For example, it supports AI computing acceleration capabilities such as Core Vision Kit for image vision-related tasks and Natural Language Kit for natural language processing. It also supports MindSpore Lite Kit and Neural Network Runtime Kit of HarmonyOS, as well as third-party inference frameworks like MNN and PaddleLite, collectively creating rich intelligent app scenarios.

Scenarios

[h2]Model Optimization

[h2]Model Conversion

[h2]On-device Deployment

[h2]Single Operator

During the loading phase of the original model in third-party application frameworks, corresponding single-operator executor objects are created and loaded based on parameters such as input, output, and weight information of the operators. When a third-party application framework performs model inference, the single-operator inference API is called during the operator computation process to complete the operator computation.

[h2]Custom Ascend C Operator Development

Ascend C is a programming language of CANN Kit specifically developed for operator development scenarios. It complies with C and C++ standard specifications to best adapt to your development habits. It also incorporates key technologies such as multi-layer interface abstraction, automatic parallel computing, and twin debugging. These technologies can improve development efficiency and help AI developers develop operators and optimize and deploy models at low costs.

Basic Concepts

Before you get started with development using CANN Kit, familiarize yourself with the following concepts:

Constraints

This kit is only applicable to phones, tablets, PCs/2-in-1 devices, and TV devices that are equipped with Kirin NPUs.

Starting from version 5.1.1(19), TVs are supported.

Supported Emulators

Currently, this kit is not supported on the Emulator.

Relationship with Other Kits

The HarmonyOS AI openness layers, from top to bottom, are as follows:

NNRt supports the built-in MindSpore Lite inference framework, that is, MindSpore Lite Kit, which has opened native APIs for NNRt configuration.

Image composition is not required for interconnection between MindSpore Lite Kit and NNRt. They share the same model image format, that is, MindIR. Therefore, using MindSpore Lite to load models on NNRt is faster than using any other AI inference frameworks. In addition, MindSpore Lite supports heterogeneous model inference across general-purpose computing hardware (CPUs/GPUs) and NNRt AI acceleration hardware.

CANN Kit connects to NNRt as the backend of the Kirin platform, facilitating NNRt's AI computing capability on the Kirin platform. CANN Kit is built on the underlying hardware drivers and optimized computing libraries. It works with Ascend chips on the cloud to support the Ascend C custom operator programming language and related tool chains. As an important cornerstone of the HarmonyOS intelligent ecosystem, CANN Kit provides core support for intelligent applications in various fields.