Introduction to TQueBind
TQueBind binds the source and destination logical locations. Based on the source and destination locations, TQueBind determines the memory allocation location and inserts the corresponding synchronization event, helping developers solve problems such as memory allocation, management, and synchronization. Tque is a simplified mode of TQueBind. Generally, developers use TQue for programming. TQueBind provides memory management and synchronization control for some special data channels. When these channels are involved, TQueBind can be directly used.
As shown in the following figure, the red and blue lines can be expressed by using the TQueBind definition, and the blue line can be simplified by using the TQue.

Data Path |
Definition of TQueBind |
Definition of TQue |
|---|---|---|
GM->VECIN |
TQueBind<TPosition::GM, TPosition::VECIN, 1> |
TQue<TPosition::VECIN, 1> |
VECOUT->GM |
TQueBind<TPosition::VECOUT, TPosition::GM, 1> |
TQue<TPosition::VEOUT, 1> |
VECIN->VECOUT |
TQueBind<TPosition::VECIN, TPosition::VECOUT, 1> |
- |
GM->A1 |
TQueBind<TPosition::GM, TPosition::A1, 1> |
TQue<TPosition::A1, 1> |
GM->B1 |
TQueBind<TPosition::GM, TPosition::B1, 1> |
TQue<TPosition::B1, 1> |
GM->C1 |
TQueBind<TPosition::GM, TPosition::C1, 1> |
TQue<TPosition::C1, 1> |
A1->A2 |
TQueBind<TPosition::A1, TPosition::A2, 1> |
TQue<TPosition::A2, 1> |
B1->B2 |
TQueBind<TPosition::B1, TPosition::B2, 1> |
TQue<TPosition::B2, 1> |
C1->C2 |
TQueBind<TPosition:C1, TPosition::C2, 1> |
TQue<TPosition::C2, 1> |
CO1->CO2 |
TQueBind<TPosition::CO1, TPosition::CO2, 1> |
TQue<TPosition::CO1, 1> |
CO2->GM |
TQueBind<TPosition::CO2, TPosition::GM, 1> |
TQue<TPosition::CO2, 1> |
VECOUT->A1/B1/C1 |
TQueBind<TPosition::VECOUT, TPosition::A1, 1> TQueBind<TPosition::VECOUT, TPosition::B1, 1> TQueBind<TPosition::VECOUT, TPosition::C1, 1> |
- |
CO2->VECIN |
TQueBind<TPosition::CO2, TPosition::VECIN, 1> |
- |
It is recommended that Cube-related data paths in the preceding table be implemented using Cube high-level APIs (such as Matmul). Using TQueBind to control data paths is complex.
The following uses two examples to describe how to use TQueBind in vector programming scenarios:
- In the following programming paradigm example, the two queues in the figure are bound to GM VECIN and VECOUT GM, respectively.

