InitBuffer

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

Calls TBufPool::InitBuffer to allocate buffer for the TQue/TBuf.

Prototype

1
2
template <class T> __aicore__ inline bool InitBuffer(T& que, uint8_t num, uint32_t len)
template <TPosition pos> __aicore__ inline bool InitBuffer(TBuf<pos>& buf, uint32_t len)

Parameters

Table 1 Template parameters

Parameter

Description

T

Type of the que parameter.

pos

Logical location of the buffer. The value can be VECIN, VECOUT, VECCALC, A1, B1, or C1. For details about TPosition, see TPosition.

Table 2 Parameters in InitBuffer(T& que, uint8_t num, uint32_t len) prototype definition

Parameter

Input/Output

Meaning

que

Input

TQue object that requires buffer allocation.

num

Input

Number of allocated buffers.

len

Input

Size of each buffer, in bytes. If the size is not 32-byte aligned, it is automatically padded up to 32-byte aligned.

Table 3 Parameters in InitBuffer(TBuf<pos>& buf, uint32_t len) prototype definition

Parameter

Input/Output

Meaning

buf

Input

TBuf object that requires buffer allocation.

len

Input

Size of the buffer allocated to the TBuf, in bytes. If the size is not 32-byte aligned, it is automatically padded up to 32-byte aligned.

Constraints

When declaring TBufPool, you can use bufIDSize to specify the maximum number of buffers that can be allocated. The default upper limit is 4, and the maximum value is 16. The physical memory of the TQue or TBuf must be the same as that of the TBufPool.

Returns

None

Example

For details, see InitBufPool.