Binds the source and destination logical locations to determine the memory allocation location and insert the corresponding synchronization event, solving 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 TQue.

Table 1 Expression of TQueBind and TQue for data paths
| 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::VECOUT, 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 the Cube-related data paths in the preceding table be implemented using Cube high-level APIs (such as Matmul). Directly using TQueBind for control is more 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.

If vector computation is not required, for example, only format conversion along data movement is required, the preceding process can be optimized by binding VECIN and VECOUT. In this way, the same buffer can be used for the input and output, implementing double buffering.
