目录

Control Units

The control units provide instruction control for the entire computing process and are responsible for running the entire AI Core. Figure 1 shows the control units of an AI Core. For details about each module, see Table 1.

Figure 1 Control units

Table 1 Control units and related instruction queues (pipes)

Control Unit/Instruction Queue Description
Scalar Unit Scalar compute unit.
Cube Queue Cube instruction queue. Instructions in the same queue are executed in sequence, and instructions in different queues can be executed in parallel.
Vector Queue Vector instruction queue. Instructions in the same queue are executed in sequence, and instructions in different queues can be executed in parallel.
MTE Queue MTE instruction queue. Instructions in the same queue are executed in sequence, and instructions in different queues can be executed in parallel.
Event Sync A module used to control the dependency and synchronization between instructions across queues.

Multiple instructions enter the instruction cache module of the AI Core from the system memory through the bus. Based on the instruction type, there are two kinds of subsequent instruction execution processes:

Instructions in the same queue are executed according to their enqueue sequence, and instructions in different queues can be executed in parallel. Such parallelism improves overall execution efficiency. For data dependency that may occur during parallel execution, the Event Sync module inserts synchronization instructions to control pipeline synchronization. The PipeBarrier and SetFlag/WaitFlag instructions are provided to ensure that the instructions inside a queue and across queues are executed based on the logical relationship.

Ascend C provides synchronization control APIs. You can control synchronization by yourself. However, it is recommended that you use the programming model and paradigm described in Programming Model for development. Synchronization control has been automatically completed, and you do not need to follow synchronization. Self-service synchronization control may make programming complex.

We hope that you can understand the basic principles of synchronization to better understand and design parallel computing programs. In a few cases, you need to manually insert synchronization. For details, see When Do I Need to Manually Insert Synchronization.