Ascend C Overview

CANN Overview

Artificial Intelligence (AI) chips are specialized processors designed to accelerate AI computing tasks. With highly parallel hardware architectures, they efficiently handle large-scale tensor operations in deep learning scenarios. As a typical representative of AI chips, the Neural-Network Processing Unit (NPU) excels at efficiently executing neural network tasks. The Ascend AI Processor, as a dedicated NPU, integrates a large number of high-performance computing cores, further strengthening this hardware advantage and providing solid support for the efficient execution of AI tasks.

In a neural network model, an operator is the fundamental computing unit that constitutes the model. It encapsulates specific mathematical operation logic for tensor data, such as convolution, matrix multiplication, and activation functions. The inference and training processes of a neural network model are essentially a series of operators executing in an orderly manner according to preset logic to collaboratively complete computing tasks. To fully unleash the hardware computing power of the Ascend NPU, a software platform is required that can efficiently bridge upper-layer AI frameworks and underlying hardware. Compute Architecture for Neural Networks (CANN) is exactly the full-stack software solution that Huawei has built for the Ascend NPU.

CANN is built on a layered architecture that seamlessly connects upper-layer applications with underlying hardware. Upward, it is compatible with mainstream AI frameworks such as PyTorch, ensuring compatibility and ease of use at the application layer. Downward, it deeply adapts to the Ascend AI Processor, fully leveraging the hardware's computing potential, thereby establishing a heterogeneous computing system that deeply integrates the CPU and NPU. Within this system, CANN drives efficient collaborative scheduling between the CPU and NPU through the Runtime interface: the CPU completes data preparation, task decomposition, and scheduling, then dispatches operator tasks to the NPU for accelerated execution. After computation is complete, the results are retrieved by the CPU or further processed according to business requirements. This collaboration mechanism spans all layers of operators, models, and applications, effectively achieving an optimal balance between computing performance and execution efficiency, and providing core software support for fully unleashing the computing power of the Ascend AI Processor.

Ascend C Overview

In the era of large models, the demand for computing power is surging at an unprecedented rate. How to develop high-performance operators and fully unleash every bit of hardware potential has become the key to the deployment of AI applications. To help developers efficiently build high-performance operators that can run directly on the NPU, Ascend C was created. Ascend C is a dedicated operator development language for Ascend AI processors within the CANN ecosystem, natively compatible with the C and C++ standard specifications. In addition, Ascend C adheres to the design philosophy of opening up complete chip programming capabilities to support ultimate performance, and builds a multi-level API system to meet operator development requirements in various scenarios. This allows you to flexibly balance development efficiency and runtime performance based on project requirements, team skills, and performance goals, achieving an optimal trade-off.

To meet the requirements of different scenarios, Ascend C builds a multi-level API system ranging from single-instruction abstraction and single-core common algorithms to multi-core operators. Its overall logical architecture is as follows:

  • Language extension layer C API: A pure C interface that provides array memory allocation and pointer-based computation interfaces, continuing the familiar C programming experience in the industry while fully opening up chip capabilities. Ascend 950PR/Ascend 950DT add SIMT and SIMD/SIMT hybrid programming capabilities.
  • Basic API: A C++ class library abstracted at the single-instruction level, generally based on Tensor programming, and gradually improving the Tensor programming experience through Layout.
  • Advanced API: Abstracts and encapsulates common single-core algorithms, providing out-of-the-box common algorithm implementations.
  • Operator template library: Provides complete operator implementation references based on templates, reducing the complexity of Tiling development and supporting user-defined extensions.
  • Python frontend PyAsc: Based on native Python interfaces (see PyAsc), it provides complete low-level chip programming capabilities and will gradually introduce Layout-based Tensor programming, SIMT programming, and more, enabling high-performance operator development in Python.

💡 For how to choose among the multi-level APIs, see the Ascend C multi-level API selection guide.

Note Ascend C supports the following AI processor models:

  • Ascend 950PR/Ascend 950DT
  • Atlas A3 training products/Atlas A3 inference products
  • Atlas A2 training products/Atlas A2 inference products
  • Atlas 200I/500 A2 inference product
  • Atlas inference products
  • Atlas training products

Ascend C Learning Path

🚀 Quick Start: Get Hands-on Quickly and Build a Full Picture

The goal of the beginner stage is to help you run your first operator in the shortest possible time and understand the basic working mechanism of Ascend C.

🔧 Environment Setup
CANN Environment Installation

⚡ Advanced Programming: Master the Programming Model for Custom Development

This stage focuses on understanding and mastering the SIMD and SIMT programming models of Ascend C, enabling you to independently develop vector and matrix operators to meet the basic performance requirements of common scenarios.

🔧 Compilation and Execution
Asynchronous Execution | Operator Compilation
📦 Operator Deployment
PyTorch Framework Adaptation

🏆 Advanced Programming: Unlock Extreme Performance and Master Complex Scenarios

This stage focuses on gaining an in-depth understanding of the underlying hardware details and fully mastering advanced programming features to support the goal of achieving extreme operator performance.

🔄 Cross-generation Migration
Cross-generation Migration Compatibility Guide