PipeBarrier(ISASI)
Function Usage
Blocks a pipeline. This synchronization operation needs to be inserted between the same pipelines with data dependency.
Prototype
1 2 | template <pipe_t pipe> __aicore__ inline void PipeBarrier() |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
pipe |
Input |
Template parameter, indicating the type of blocked pipelines. For details about supported pipelines, see Hardware Pipelines. |
Returns
None
Availability
Constraints
The synchronization between Scalar pipelines is automatically ensured by the hardware. If PipeBarrier<PIPE_S>() is called, a hardware error occurs.
Example
In the following example, the input dst0Local of the Mul instruction is the output of the Add instruction. The two vector operation instructions depend on each other. Therefore, PipeBarrier needs to be inserted to ensure the execution sequence of the two instructions.
Figure 1 The Mul instruction and the Add instruction are in a serial relationship. The Mul instruction can be executed only after the Add instruction is executed.


1 2 3 4 5 6 7 8 9 | AscendC::LocalTensor<half> src0Local; AscendC::LocalTensor<half> src1Local; AscendC::LocalTensor<half> src2Local; AscendC::LocalTensor<half> dst0Local; AscendC::LocalTensor<half> dst1Local; AscendC::Add(dst0Local, src0Local, src1Local, 512); AscendC::PipeBarrier<PIPE_V>(); AscendC::Mul(dst1Local, dst0Local, src2Local, 512); |
Parent topic: Intra-Core Synchronization