GetTPipePtr

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

Atlas inference product Vector Core

x

Atlas training product

Function Usage

When a TPipe object is created, a globally unique TPipe pointer is set during object initialization. This API is called to obtain the pointer. After obtaining the pointer, you can perform TPipe-related operations.

Prototype

1
__aicore__ inline AscendC::TPipe* GetTPipePtr()

Constraints

None

Example

In the following example, a TPipe object is created at the entry to the kernel function. A globally unique TPipe pointer is set during object initialization. When the Init function of the KernelAdd class is called, the TPipe pointer does not need to be explicitly passed. Instead, GetTPipePtr is directly used in the function to obtain the global TPipe pointer for operations such as InitBuffer.

// inQueueX and inQueueY are TQue instances on VECIN, and outQueueZ is a TQue instance on VECOUT.
// Obtain the global TPipe pointer and use the InitBuffer API of TPipe to allocate buffers to TQue.
GetTPipePtr()->InitBuffer(inQueueX, 2, 128 * sizeof(half));
GetTPipePtr()->InitBuffer(inQueueY, 2, 128 * sizeof(half));
GetTPipePtr()->InitBuffer(outQueueZ, 2, 128 * sizeof(half));